Connected Devices API

Manage Active Sessions and Connected Devices

Introduction to Connected Devices API

Welcome to SMSGatewayCenter's Connected Devices API! This powerful Security API allows you to manage your active sessions and connected devices programmatically. View all active sessions, logout specific devices, and secure your account by logging out all other devices. Our RESTful endpoints support POST and GET methods over HTTP with full VAPT compliance for secure integration.

About Connected Devices API

The Connected Devices API enables you to:

  • View all active sessions - List all devices currently logged into your account
  • Monitor device information - See device name, browser, OS, location, IP address, and login time
  • Track last activity - View when each device was last active
  • Logout specific device - Terminate a session on a particular device
  • Logout all other devices - Secure your account by logging out all devices except the current one
  • Identify current session - Know which device you're currently using
  • Security monitoring - Detect unauthorized access and manage account security

All operations include comprehensive VAPT security measures including session validation, authorization checks, and secure session management.

Security Features

  • Session Validation: All session operations verify ownership before execution
  • Authorization Checks: Only account owner can view and manage their sessions
  • Device Tracking: Complete device information including browser, OS, and location
  • Activity Monitoring: Track last activity time for each session
  • Secure Logout: Safely terminate sessions without affecting current device
  • IP Address Tracking: Monitor IP addresses for security auditing

Get Connected Devices

Retrieve a list of all active sessions and connected devices for your account. This includes device information, location, login time, and last activity.

API Endpoint

https://unify.smsgateway.center/SMSApi/security/connectedDevices

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
outputStringOptionalResponse format. Use json for JSON response (recommended)
Sample Request Code
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://unify.smsgateway.center/SMSApi/security/connectedDevices",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => array(
    'userid' => 'YourUsername',
    'password' => 'YourPassword',
    'output' => 'json'
  ),
));

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

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
Sample Response (Success)
{
  "response": {
    "api": "security",
    "action": "connectedDevices",
    "status": "success",
    "msg": "Connected devices retrieved successfully",
    "code": 200,
    "count": 2,
    "sessions": [
      {
        "sessionId": "abc123def456ghi789jkl012mno345pqr678stu901vwx234yz",
        "sessionToken": "xyz789abc123def456ghi789jkl012mno345pqr678stu901vwx234",
        "deviceName": "Chrome on Windows",
        "deviceType": "Desktop",
        "platform": "Desktop",
        "os": "Windows",
        "browser": "Chrome",
        "location": "Mumbai, Maharashtra, India",
        "ipAddress": "192.168.1.1",
        "loginMethod": "UI",
        "loginTime": "2025-01-15 10:30:00",
        "lastActivity": "2025-01-15 11:45:00",
        "lastActivityTimestamp": 1705303500000,
        "timeAgo": "15 minutes ago",
        "isCurrentSession": false
      },
      {
        "sessionId": "current123session456id789abc012def345ghi678jkl901mno234",
        "sessionToken": "current789token123abc456def789ghi012jkl345mno678pqr901stu234",
        "deviceName": "Safari on macOS",
        "deviceType": "Desktop",
        "platform": "Desktop",
        "os": "macOS",
        "browser": "Safari",
        "location": "Delhi, Delhi, India",
        "ipAddress": "192.168.1.100",
        "loginMethod": "UI",
        "loginTime": "2025-01-15 09:00:00",
        "lastActivity": "2025-01-15 12:00:00",
        "lastActivityTimestamp": 1705312800000,
        "timeAgo": "Just now",
        "isCurrentSession": true
      }
    ]
  }
}

Logout Specific Device

Terminate a session on a specific device by providing either the session ID or session token. This is useful for logging out a device you no longer have access to or suspect is compromised.

API Endpoint

https://unify.smsgateway.center/SMSApi/security/logoutDevice

HTTP Method

POST

 

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
sessionIdStringConditionalSession ID of the device to logout. Required if sessionToken is not provided
sessionTokenStringConditionalSession token of the device to logout. Required if sessionId is not provided
outputStringOptionalResponse format. Use json for JSON response (recommended)

Note: You must provide either sessionId or sessionToken, but not both.

Sample Request Code (Using Session ID)
curl --location 'https://unify.smsgateway.center/SMSApi/security/logoutDevice' \
--form 'userid="YourUsername"' \
--form 'password="YourPassword"' \
--form 'sessionId="abc123def456ghi789jkl012mno345pqr678stu901vwx234yz"' \
--form 'output="json"'
Sample Request Code (Using Session Token)
curl --location 'https://unify.smsgateway.center/SMSApi/security/logoutDevice' \
--form 'userid="YourUsername"' \
--form 'password="YourPassword"' \
--form 'sessionToken="xyz789abc123def456ghi789jkl012mno345pqr678stu901vwx234"' \
--form 'output="json"'
Sample Response (Success)
{
  "response": {
    "api": "security",
    "action": "logoutDevice",
    "status": "success",
    "msg": "Device logged out successfully",
    "code": 200,
    "count": 1,
    "logout": {
      "sessionId": "abc123def456ghi789jkl012mno345pqr678stu901vwx234yz",
      "deviceName": "Chrome on Windows",
      "loggedOut": true,
      "timestamp": "2025-01-15T12:00:00+00:00"
    }
  }
}

Logout All Other Devices

Securely logout all devices except the current one. This is useful when you want to ensure only your current device has access to your account, or if you suspect unauthorized access.

API Endpoint

https://unify.smsgateway.center/SMSApi/security/logoutAllOtherDevices

HTTP Method

POST

 

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
outputStringOptionalResponse format. Use json for JSON response (recommended)
Sample Request Code
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://unify.smsgateway.center/SMSApi/security/logoutAllOtherDevices",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => array(
    'userid' => 'YourUsername',
    'password' => 'YourPassword',
    'output' => 'json'
  ),
));

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

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
Sample Response (Success)
{
  "response": {
    "api": "security",
    "action": "logoutAllOtherDevices",
    "status": "success",
    "msg": "All other devices logged out successfully",
    "code": 200,
    "count": 1,
    "logoutAll": {
      "currentSessionId": "current123session456id789abc012def345ghi678jkl901mno234",
      "devicesLoggedOut": 3,
      "timestamp": "2025-01-15T12:00:00+00:00"
    }
  }
}

Response Fields Explained

Session Object Fields

FieldTypeDescription
sessionIdStringUnique session identifier for the device
sessionTokenStringSession token for authentication (can be used instead of sessionId)
deviceNameStringHuman-readable device name (e.g., "Chrome on Windows")
deviceTypeStringType of device: Desktop, Mobile, Tablet
platformStringPlatform category: Desktop, Mobile, Tablet
osStringOperating system (e.g., Windows, macOS, Linux, Android, iOS)
browserStringBrowser name (e.g., Chrome, Safari, Firefox, Edge)
locationStringGeographic location based on IP address (e.g., "Mumbai, Maharashtra, India")
ipAddressStringIP address of the device
loginMethodStringMethod used to login: UI (web interface) or API
loginTimeStringDate and time when the session was created (format: Y-m-d H:i:s)
lastActivityStringDate and time of last activity on this session (format: Y-m-d H:i:s)
lastActivityTimestampIntegerUnix timestamp of last activity (milliseconds)
timeAgoStringHuman-readable time since last activity (e.g., "15 minutes ago", "Just now")
isCurrentSessionBooleanTrue if this is the current session making the API call, false otherwise

Error Codes

Error CodeHTTP StatusDescription
200200Success - Request completed successfully
Logout Device Errors (448-453)
448400Session ID or Session Token is required
449400Invalid session ID
450404Session not found
451403Unauthorized - Session doesn't belong to user
452500Failed to logout device
453500Error occurred while logging out device
Logout All Other Devices Errors (454-456)
454500Failed to logout other devices
455404No active sessions found
456500Error occurred while logging out other devices
General Errors
500500General error

Integration Examples

Example 1: Display Connected Devices in Mobile App

// React Native / JavaScript example
async function getConnectedDevices() {
  const formData = new FormData();
  formData.append('userid', 'YourUsername');
  formData.append('password', 'YourPassword');
  formData.append('output', 'json');

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

    const data = await response.json();
    
    if (data.response.status === 'success') {
      const sessions = data.response.sessions;
      
      sessions.forEach(session => {
        console.log(`Device: ${session.deviceName}`);
        console.log(`Location: ${session.location}`);
        console.log(`Last Activity: ${session.timeAgo}`);
        console.log(`Current Session: ${session.isCurrentSession ? 'Yes' : 'No'}`);
        console.log('---');
      });
      
      return sessions;
    } else {
      console.error(`Error: ${data.response.msg}`);
    }
  } catch (error) {
    console.error('Network error:', error);
  }
}

getConnectedDevices();

Example 2: Logout Specific Device

import requests

def logout_device(session_id):
    url = 'https://unify.smsgateway.center/SMSApi/security/logoutDevice'
    data = {
        'userid': 'YourUsername',
        'password': 'YourPassword',
        'sessionId': session_id,
        'output': 'json'
    }
    
    response = requests.post(url, data=data)
    result = response.json()
    
    if result['response']['status'] == 'success':
        print(f"Device logged out: {result['response']['logout']['deviceName']}")
        return True
    else:
        print(f"Error: {result['response']['msg']}")
        return False

# Usage
logout_device('abc123def456ghi789jkl012mno345pqr678stu901vwx234yz')

Example 3: Secure Account by Logging Out All Other Devices

<?php
function secureAccount() {
    $url = "https://unify.smsgateway.center/SMSApi/security/logoutAllOtherDevices";
    
    $postData = array(
        'userid' => 'YourUsername',
        'password' => 'YourPassword',
        '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') {
        $logoutAll = $data['response']['logoutAll'];
        echo "Account secured successfully!\n";
        echo "Devices logged out: " . $logoutAll['devicesLoggedOut'] . "\n";
        echo "Current session ID: " . $logoutAll['currentSessionId'] . "\n";
        return true;
    } else {
        echo "Error: " . $data['response']['msg'] . "\n";
        return false;
    }
}

// Usage
secureAccount();

Example 4: Monitor and Auto-Logout Inactive Devices

// JavaScript example - Logout devices inactive for more than 30 days
async function cleanupInactiveDevices() {
  const formData = new FormData();
  formData.append('userid', 'YourUsername');
  formData.append('password', 'YourPassword');
  formData.append('output', 'json');

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

  const data = await response.json();
  
  if (data.response.status === 'success') {
    const sessions = data.response.sessions;
    const thirtyDaysAgo = Date.now() - (30 * 24 * 60 * 60 * 1000);
    
    for (const session of sessions) {
      // Skip current session
      if (session.isCurrentSession) continue;
      
      // Check if inactive for more than 30 days
      if (session.lastActivityTimestamp < thirtyDaysAgo) {
        const logoutFormData = new FormData();
        logoutFormData.append('userid', 'YourUsername');
        logoutFormData.append('password', 'YourPassword');
        logoutFormData.append('sessionId', session.sessionId);
        logoutFormData.append('output', 'json');
        
        await fetch('https://unify.smsgateway.center/SMSApi/security/logoutDevice', {
          method: 'POST',
          body: logoutFormData
        });
        
        console.log(`Logged out inactive device: ${session.deviceName}`);
      }
    }
  }
}

cleanupInactiveDevices();

Best Practices

Recommendations

  • Regular Monitoring: Periodically check connected devices to detect unauthorized access
  • Session Management: Logout devices you no longer use or recognize
  • Security Alerts: Monitor for suspicious locations or IP addresses
  • Current Session: Always check isCurrentSession before logging out to avoid logging yourself out
  • Error Handling: Implement comprehensive error handling for all error codes (448-456)
  • Session IDs: Store session IDs securely if you need to reference them later
  • Auto-Cleanup: Consider implementing automatic logout for inactive sessions
  • Location Verification: Verify device locations match expected geographic areas
  • IP Monitoring: Track IP addresses for security auditing purposes
  • Account Security: Use "Logout All Other Devices" if you suspect account compromise

Use Cases

Account Security

Monitor and manage active sessions to secure your account from unauthorized access.

Device Management

View all connected devices and logout specific devices you no longer use.

Location Tracking

Monitor device locations and IP addresses to detect suspicious activity.

Activity Monitoring

Track last activity time for each session and cleanup inactive devices.

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