Activity Logs API
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/readHTTP Method
POST GET
| Key | Value | Description |
|---|---|---|
| Login Credentials (Required) | ||
| Authenticate your API request using userid-password or apiKey—choose one method. | ||
| userid | Your Registered Username | Your registered username; use if apiKey isn't provided. Signup for User ID |
| password | Your Password | URL-encoded password (for special characters); use if apiKey isn't provided. Signup for API Key |
| Header (optional) Parameters | ||
| apiKey | Your unique apiKey | apiKey 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. |
| Parameter | Type | Required | Description |
|---|---|---|---|
limit | Integer | Optional | Number of records to return (1-200). Default: 50, Max: 200 |
offset | Integer | Optional | Number of records to skip for pagination. Default: 0 |
output | String | Optional | Response format. Use json for JSON response (recommended) |
| Field | Type | Description |
|---|---|---|
| Log Entry Fields | ||
activityId | Integer | Unique identifier for the log entry |
activity | String | Description of what action was performed |
ipAddress | String | IP address from which the activity was performed |
timestamp | String | ISO 8601 formatted timestamp (e.g., "2025-12-04T18:30:45+05:30") |
formattedTime | String | Human-readable timestamp (e.g., "04 Dec 2025, 06:30 PM") |
| Pagination Fields | ||
limit | Integer | Number of records per page (as requested) |
offset | Integer | Number of records skipped (as requested) |
total | Integer | Total number of activity logs available |
returned | Integer | Number of records returned in current response |
hasMore | Boolean | True if more records are available, false if at end |
<?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;
}
# 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"'{
"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:
| Page | Offset | Limit | Records Returned | Formula |
|---|---|---|---|---|
| Page 1 | 0 | 50 | 1-50 | offset = 0, limit = 50 |
| Page 2 | 50 | 50 | 51-100 | offset = 50, limit = 50 |
| Page 3 | 100 | 50 | 101-150 | offset = 100, limit = 50 |
| Page N | (N-1) × limit | 50 | - | offset = (page - 1) × limit |
- 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:
| Category | Example Activities |
|---|---|
| Authentication | Login, logout, password changes, API key creation |
| SMS Operations | SMS sent, scheduled SMS created, bulk SMS campaigns |
| API Calls | API requests, webhook configurations, integration setup |
| Account Management | Profile updates, notification settings changes, rate plan views |
| Contact Management | Groups created/updated, contacts added/removed, import operations |
| Credit Transactions | Credits purchased, balance checks, wallet transactions |
| Support | Support tickets created, replies submitted, ticket status changes |
| Configuration | Sender ID created, DLT templates added, webhook updated |
Error Codes
| Error Code | HTTP Status | Description |
|---|---|---|
200 | 200 | Success - Activity logs retrieved successfully |
482 | 400 | Invalid action. Only read action is supported |
483 | 500 | An error occurred while retrieving activity logs |
484 | 405 | Create, 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 pageExample 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
hasMoreflag 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?

