Activity Logs API

Retrieve User Activity Logs and Audit Trail

Introduction to Activity Logs API

Welcome to SMSGatewayCenter's Activity Logs API! This read-only API allows mobile app users to retrieve their complete activity history with pagination support. Track user actions including logins, SMS sends, API calls, configuration changes, contact management, credit transactions, and more. Perfect for building activity feeds, audit trails, security monitoring, and compliance reporting in mobile applications. Our RESTful endpoint supports POST and GET methods over HTTP for flexible integration.

About Activity Logs API

The Activity Logs API enables you to:

  • Track all user actions - Complete audit trail of account activities
  • Monitor logins - View login/logout history with IP addresses
  • SMS activity - Track message sending activities
  • API calls - Monitor API integrations and calls
  • Configuration changes - Track account setting modifications
  • Contact management - View group and contact operations
  • Credit transactions - Track credit purchases and usage
  • Pagination support - Efficient loading with limit/offset parameters
  • IP address tracking - See from where actions were performed

Activity logs are returned in reverse chronological order (newest first) and only show the authenticated user's own activities.

Key Features

  • Reverse Chronological: Newest activities appear first
  • Pagination: Efficient data loading with limit/offset support
  • IP Tracking: View IP address for each activity
  • Formatted Timestamps: Both ISO 8601 and human-readable formats
  • Security: Only authenticated user's logs are accessible
  • Performance: Maximum 200 records per request
  • Read-Only: Logs cannot be created, modified, or deleted via API

Read Activity Logs

Retrieve paginated activity logs for the authenticated user. Returns logs in reverse chronological order with comprehensive pagination information.

API Endpoint

https://unify.smsgateway.center/SMSApi/activity/read

HTTP Method

POST GET

 

Required Parameters
KeyValueDescription
Login Credentials (Required)
Authenticate your API request using userid-password or apiKey—choose one method.
useridYour Registered UsernameYour registered username; use if apiKey isn't provided. Signup for User ID
passwordYour PasswordURL-encoded password (for special characters); use if apiKey isn't provided. Signup for API Key
Header (optional) Parameters
apiKeyYour unique apiKeyapiKey needs to be sent as HTTP header when you are not using userid-password method. You can avail this from your user control panel and use instead of userid-password HTTP Request parameter. Please do not disclose this to anyone.

 

Request Parameters
ParameterTypeRequiredDescription
limitIntegerOptionalNumber of records to return (1-200). Default: 50, Max: 200
offsetIntegerOptionalNumber of records to skip for pagination. Default: 0
outputStringOptionalResponse format. Use json for JSON response (recommended)
Response Fields
FieldTypeDescription
Log Entry Fields
activityIdIntegerUnique identifier for the log entry
activityStringDescription of what action was performed
ipAddressStringIP address from which the activity was performed
timestampStringISO 8601 formatted timestamp (e.g., "2025-12-04T18:30:45+05:30")
formattedTimeStringHuman-readable timestamp (e.g., "04 Dec 2025, 06:30 PM")
Pagination Fields
limitIntegerNumber of records per page (as requested)
offsetIntegerNumber of records skipped (as requested)
totalIntegerTotal number of activity logs available
returnedIntegerNumber of records returned in current response
hasMoreBooleanTrue if more records are available, false if at end
Sample Request Code (Default - 50 Records)
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://unify.smsgateway.center/SMSApi/activity/read",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "userid=YourUsername&password=YourPassword&output=json",
  CURLOPT_HTTPHEADER => array(
    "cache-control: no-cache",
    "content-type: application/x-www-form-urlencoded"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
Sample Request Code (With Pagination)
# Get page 2 (records 51-100)
curl --location 'https://unify.smsgateway.center/SMSApi/activity/read' \
--form 'userid="YourUsername"' \
--form 'password="YourPassword"' \
--form 'limit="50"' \
--form 'offset="50"' \
--form 'output="json"'
Sample Response (Success)
{
  "response": {
    "api": "activity",
    "action": "read",
    "status": "success",
    "msg": "Activity logs retrieved successfully",
    "code": 200,
    "count": 1250,
    "data": {
      "logs": [
        {
          "activityId": 12345,
          "activity": "User logged in successfully",
          "ipAddress": "192.168.1.100",
          "timestamp": "2025-12-04T18:30:45+05:30",
          "formattedTime": "04 Dec 2025, 06:30 PM"
        },
        {
          "activityId": 12344,
          "activity": "SMS sent to +1234567890 - Delivered successfully",
          "ipAddress": "192.168.1.100",
          "timestamp": "2025-12-04T18:25:30+05:30",
          "formattedTime": "04 Dec 2025, 06:25 PM"
        },
        {
          "activityId": 12343,
          "activity": "API Key created via user panel",
          "ipAddress": "192.168.1.100",
          "timestamp": "2025-12-04T17:15:20+05:30",
          "formattedTime": "04 Dec 2025, 05:15 PM"
        },
        {
          "activityId": 12342,
          "activity": "Contact group 'Customers' created with 150 contacts",
          "ipAddress": "192.168.1.100",
          "timestamp": "2025-12-04T16:45:10+05:30",
          "formattedTime": "04 Dec 2025, 04:45 PM"
        },
        {
          "activityId": 12341,
          "activity": "Credit purchased: 10000 Credits added to account",
          "ipAddress": "192.168.1.100",
          "timestamp": "2025-12-04T15:30:00+05:30",
          "formattedTime": "04 Dec 2025, 03:30 PM"
        }
      ],
      "pagination": {
        "limit": 50,
        "offset": 0,
        "total": 1250,
        "returned": 50,
        "hasMore": true
      }
    }
  }
}

Pagination Logic

The Activity Logs API uses offset-based pagination to efficiently load large datasets. Here's how pagination works:

PageOffsetLimitRecords ReturnedFormula
Page 10501-50offset = 0, limit = 50
Page 2505051-100offset = 50, limit = 50
Page 310050101-150offset = 100, limit = 50
Page N(N-1) × limit50-offset = (page - 1) × limit
Pagination Formula
  • Calculate Page Number: pageNumber = (offset / limit) + 1
  • Calculate Offset: offset = (pageNumber - 1) × limit
  • Check More Pages: hasMore = (offset + returned) < total
  • Total Pages: totalPages = ceil(total / limit)

Activity Types

Activity logs capture various types of user actions across the platform:

CategoryExample Activities
AuthenticationLogin, logout, password changes, API key creation
SMS OperationsSMS sent, scheduled SMS created, bulk SMS campaigns
API CallsAPI requests, webhook configurations, integration setup
Account ManagementProfile updates, notification settings changes, rate plan views
Contact ManagementGroups created/updated, contacts added/removed, import operations
Credit TransactionsCredits purchased, balance checks, wallet transactions
SupportSupport tickets created, replies submitted, ticket status changes
ConfigurationSender ID created, DLT templates added, webhook updated

Error Codes

Error CodeHTTP StatusDescription
200200Success - Activity logs retrieved successfully
482400Invalid action. Only read action is supported
483500An error occurred while retrieving activity logs
484405Create, update, or delete actions are not supported for activity logs

Integration Examples

Example 1: Display Activity Feed in Mobile App

// React Native / JavaScript example
async function loadActivityFeed(page = 1, perPage = 50) {
  const offset = (page - 1) * perPage;
  
  const formData = new FormData();
  formData.append('userid', 'YourUsername');
  formData.append('password', 'YourPassword');
  formData.append('limit', perPage);
  formData.append('offset', offset);
  formData.append('output', 'json');

  try {
    const response = await fetch('https://unify.smsgateway.center/SMSApi/activity/read', {
      method: 'POST',
      body: formData
    });

    const data = await response.json();
    
    if (data.response.status === 'success') {
      const { logs, pagination } = data.response.data;
      
      console.log(`Total activities: ${pagination.total}`);
      console.log(`Showing ${pagination.returned} of ${pagination.total}`);
      console.log(`Has more: ${pagination.hasMore}`);
      
      logs.forEach(log => {
        console.log(`[${log.formattedTime}] ${log.activity} (IP: ${log.ipAddress})`);
      });
      
      return {
        logs,
        pagination,
        canLoadMore: pagination.hasMore
      };
    }
  } catch (error) {
    console.error('Error loading activities:', error);
  }
}

// Load first page
loadActivityFeed(1, 50);

Example 2: Infinite Scroll Implementation

import requests

class ActivityLoader:
    def __init__(self, userid, password):
        self.userid = userid
        self.password = password
        self.url = 'https://unify.smsgateway.center/SMSApi/activity/read'
        self.offset = 0
        self.limit = 50
        self.has_more = True
        self.all_logs = []
    
    def load_next_page(self):
        if not self.has_more:
            print("No more activities to load")
            return []
        
        data = {
            'userid': self.userid,
            'password': self.password,
            'limit': self.limit,
            'offset': self.offset,
            'output': 'json'
        }
        
        response = requests.post(self.url, data=data)
        result = response.json()
        
        if result['response']['status'] == 'success':
            logs = result['response']['data']['logs']
            pagination = result['response']['data']['pagination']
            
            self.all_logs.extend(logs)
            self.offset += pagination['returned']
            self.has_more = pagination['hasMore']
            
            print(f"Loaded {pagination['returned']} activities")
            print(f"Total loaded: {len(self.all_logs)}/{pagination['total']}")
            
            return logs
        else:
            print(f"Error: {result['response']['msg']}")
            return []
    
    def load_all(self, max_records=None):
        while self.has_more:
            self.load_next_page()
            if max_records and len(self.all_logs) >= max_records:
                break
        
        return self.all_logs

# Usage
loader = ActivityLoader('YourUsername', 'YourPassword')
loader.load_next_page()  # Load first page
loader.load_next_page()  # Load second page

Example 3: Filter and Search Activities

<?php
function searchActivities($userid, $password, $searchTerm, $limit = 100) {
    $url = "https://unify.smsgateway.center/SMSApi/activity/read";
    
    $postData = array(
        'userid' => $userid,
        'password' => $password,
        'limit' => $limit,
        'offset' => 0,
        'output' => 'json'
    );
    
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData));
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    
    $response = curl_exec($ch);
    curl_close($ch);
    
    $data = json_decode($response, true);
    
    if ($data['response']['status'] === 'success') {
        $logs = $data['response']['data']['logs'];
        
        // Filter logs by search term
        $filtered = array_filter($logs, function($log) use ($searchTerm) {
            return stripos($log['activity'], $searchTerm) !== false;
        });
        
        return $filtered;
    }
    
    return array();
}

// Search for login activities
$loginActivities = searchActivities('YourUsername', 'YourPassword', 'logged in');

// Search for SMS activities
$smsActivities = searchActivities('YourUsername', 'YourPassword', 'SMS sent');

Example 4: Export Activity Report

#!/bin/bash

# Export last 200 activities to CSV
curl --location 'https://unify.smsgateway.center/SMSApi/activity/read' \
  --form "userid=\"YourUsername\"" \
  --form "password=\"YourPassword\"" \
  --form "limit=\"200\"" \
  --form "output=\"json\"" | \
jq -r '.response.data.logs[] | [.activityId, .activity, .ipAddress, .formattedTime] | @csv' \
  > activity_report.csv

echo "Activity report exported to activity_report.csv"

Best Practices

Recommendations

  • Pagination: Use reasonable page sizes (50-100 records) for optimal performance
  • Maximum Limit: API enforces 200 records maximum per request
  • Infinite Scroll: Check hasMore flag before loading next page
  • Cache Strategy: Cache activity logs client-side to reduce API calls
  • Pull-to-Refresh: Implement pull-to-refresh to load newest activities
  • Error Handling: Handle network errors gracefully with retry logic
  • IP Tracking: Display IP addresses for security monitoring
  • Search/Filter: Implement client-side search for loaded data
  • Loading States: Show loading indicators during API calls
  • Empty States: Handle cases where no activities exist

Common Use Cases

Activity Feed

Build comprehensive activity feeds in mobile apps with infinite scroll and pull-to-refresh.

Security Audit

Monitor login activities and track IP addresses for security analysis.

Compliance Reports

Generate audit trail reports for compliance and regulatory requirements.

Activity Search

Search and filter activities by keywords for quick access to specific actions.


Important Limitations

API Constraints

  • Read-Only: Activity logs cannot be created, modified, or deleted via API
  • Maximum Records: 200 records per request (enforced for performance)
  • User-Specific: Only authenticated user's own logs are accessible
  • No Filtering: API returns all activities (filter client-side if needed)
  • No Date Range: Use offset/limit for pagination, not date filtering
  • Reverse Order: Always returns newest first (cannot change sort order)

Testimonials

Why do Great Businesses Trust SMS Gateway Center?

K

Kurlon IT

2022-08-04

We have tied up with other SMS providers also, but SMS GatewayCenter is quite good. Good Service from the team. We are very happy with the service be it accounts related or technical issue. We always get good response.

I

INOX Air Products

2018-02-09

We have an excellent experience with SMS Gateway Center. The services and support has been of very high standard.

S

Shalabh Arora

2025-04-11

I’ve been using SMSGatewayCenter’s bulk SMS and WhatsApp services since early 2022 for my small business, and the experience has been fantastic. The platform is intuitive, and the message delivery is incredibly reliable, reaching my customers without fail. The 24/7 support team is quick to assist, and the cost-effectiveness is a big plus. It’s transformed how I connect with my audience, and I highly recommend it to other entrepreneurs! (Google Revirews)

R

Reflex

2025-04-11

We’ve been using your bulk SMS services for a few months, and the results have been phenomenal. The open rates and customer engagement have gone through the roof. Highly recommend for any business looking to scale fast! (Google Revirews)

V

Vedanth Gowda

2025-04-18

I’m Vedanth Gowda, leading a finance business, and I’ve been leveraging SMSGatewayCenter’s bulk SMS and WhatsApp tools —absolutely transformative! The platform’s speed and precision in delivering financial alerts to my clients are unmatched, giving me a competitive edge. Samrat’s expertise in tailoring notification workflows for market updates was a standout, and the robust security features instilled trust. The affordable pricing and proactive support team make it a no-brainer. Perfect for finance pros aiming to elevate client trust and efficiency! (Google Revirews)

N

Naval Bhatnagar

2025-04-12

From day one, the team at SMS GATEWAY CENTER guided us through setup, testing, and launching campaigns. Their support is A+. Whether you’re new to SMS marketing or experienced, they make it smooth. Thank you Aakash. (Google Revirews)


CTA for Unlock Real-Time Messaging – Integrate Today!

Unlock Real-Time Messaging – Integrate Today!

Try Our API in a Sandbox Environment Before Going Live!

Join Thousands of Developers – Try Our API Now!

Get in touchSign up