Sessions & Activity
Track SIM card connectivity sessions and monitor activity events in real-time.
Get SIM Sessions
Retrieve connectivity sessions for a specific SIM card with detailed data usage.
Endpoint
GET /v1/globalsim/sims/{iccid}/sessions
Query Parameters
| Parameter | Type | Description | Default |
|---|---|---|---|
limit | integer | Max results per page (1-100) | 50 |
offset | integer | Pagination offset | 0 |
start_date | string | Filter from date (YYYY-MM-DD) | - |
end_date | string | Filter to date (YYYY-MM-DD) | - |
Request Example
curl -X GET https://api.wayscloud.services/v1/globalsim/sims/8901234567890123456/sessions \
-H "Authorization: Bearer YOUR_API_KEY"
Response
{
"iccid": "8901234567890123456",
"sessions": [
{
"session_id": "ses_abc123",
"start_time": "2025-11-05T08:00:00Z",
"end_time": "2025-11-05T10:30:00Z",
"duration_seconds": 9000,
"network": {
"country": "Norway",
"country_code": "NO",
"operator": "Telenor Norway",
"network_code": "24201",
"network_type": "4G"
},
"data_usage": {
"upload_mb": 2.5,
"download_mb": 45.3,
"total_mb": 47.8
},
"ip_address": "10.123.45.67"
},
{
"session_id": "ses_def456",
"start_time": "2025-11-04T14:00:00Z",
"end_time": "2025-11-04T18:45:00Z",
"duration_seconds": 17100,
"network": {
"country": "Sweden",
"country_code": "SE",
"operator": "Telia Sweden",
"network_code": "24001",
"network_type": "4G"
},
"data_usage": {
"upload_mb": 3.2,
"download_mb": 62.1,
"total_mb": 65.3
},
"ip_address": "10.234.56.78"
}
],
"total": 2,
"summary": {
"total_sessions": 2,
"total_data_mb": 113.1,
"average_session_duration_seconds": 13050
}
}
Python Example
import requests
from datetime import datetime, timedelta
API_KEY = 'YOUR_API_KEY'
API_URL = 'https://api.wayscloud.services/v1/globalsim'
def get_sim_sessions(iccid, days=7):
headers = {'Authorization': f'Bearer {API_KEY}'}
end_date = datetime.now().date()
start_date = end_date - timedelta(days=days)
params = {
'start_date': start_date.isoformat(),
'end_date': end_date.isoformat()
}
response = requests.get(
f'{API_URL}/sims/{iccid}/sessions',
headers=headers,
params=params
)
return response.json()
# Get sessions for last 7 days
iccid = '8901234567890123456'
sessions_data = get_sim_sessions(iccid, days=7)
print(f"Total sessions: {sessions_data['summary']['total_sessions']}")
print(f"Total data: {sessions_data['summary']['total_data_mb']:.2f} MB")
print("\nRecent sessions:")
for session in sessions_data['sessions'][:5]:
print(f" {session['network']['country']}: {session['data_usage']['total_mb']:.2f} MB")
Get SIM Activity
Retrieve activity events and alerts for a specific SIM card.
Endpoint
GET /v1/globalsim/sims/{iccid}/activity
Query Parameters
| Parameter | Type | Description | Default |
|---|---|---|---|
limit | integer | Max results per page (1-100) | 50 |
offset | integer | Pagination offset | 0 |
event_type | string | Filter by event type | all |
Event Types
connection- Network connection establisheddisconnection- Network connection endednetwork_change- SIM switched to different networkdata_usage_update- Data usage threshold reachedlocation_update- Location/network change detected
Request Example
curl -X GET https://api.wayscloud.services/v1/globalsim/sims/8901234567890123456/activity \
-H "Authorization: Bearer YOUR_API_KEY"
Response
{
"iccid": "8901234567890123456",
"activity": [
{
"event_id": "evt_abc123",
"event_type": "connection",
"timestamp": "2025-11-05T08:00:00Z",
"network": {
"country": "Norway",
"operator": "Telenor Norway",
"network_code": "24201"
},
"details": {
"network_type": "4G",
"signal_strength": -65
}
},
{
"event_id": "evt_def456",
"event_type": "data_usage_update",
"timestamp": "2025-11-05T09:30:00Z",
"details": {
"current_usage_mb": 870.5,
"period": "current_month"
}
},
{
"event_id": "evt_ghi789",
"event_type": "network_change",
"timestamp": "2025-11-04T16:20:00Z",
"previous_network": {
"country": "Norway",
"operator": "Telenor Norway",
"network_code": "24201"
},
"current_network": {
"country": "Sweden",
"operator": "Telia Sweden",
"network_code": "24001"
},
"details": {
"reason": "roaming"
}
}
],
"total": 3
}
Get All SIM Activity
Retrieve paginated activity logs for all your SIM cards.
Endpoint
GET /v1/globalsim/sims/activity
Query Parameters
| Parameter | Type | Description | Default |
|---|---|---|---|
limit | integer | Max results per page (1-100) | 50 |
offset | integer | Pagination offset | 0 |
event_type | string | Filter by event type | all |
iccid | string | Filter by specific ICCID | all |
device_id | string | Filter by IoT device ID | all |
start_date | string | Filter from date (YYYY-MM-DD) | - |
end_date | string | Filter to date (YYYY-MM-DD) | - |
Request Example
curl -X GET "https://api.wayscloud.services/v1/globalsim/sims/activity?event_type=connection&limit=20" \
-H "Authorization: Bearer YOUR_API_KEY"
Response
{
"activity": [
{
"event_id": "evt_abc123",
"iccid": "8901234567890123456",
"msisdn": "+4791234567",
"device_id": "iot_dev_abc123",
"event_type": "connection",
"timestamp": "2025-11-05T08:00:00Z",
"network": {
"country": "Norway",
"operator": "Telenor Norway"
}
},
{
"event_id": "evt_xyz789",
"iccid": "8901234567890234567",
"msisdn": "+46701234567",
"device_id": "iot_dev_xyz789",
"event_type": "connection",
"timestamp": "2025-11-05T07:45:00Z",
"network": {
"country": "Sweden",
"operator": "Telia Sweden"
}
}
],
"total": 2,
"limit": 20,
"offset": 0
}
Node.js Example
const axios = require('axios');
async function monitorActivity(eventType = null) {
const params = new URLSearchParams();
if (eventType) {
params.append('event_type', eventType);
}
const response = await axios.get(
`${API_URL}/sims/activity?${params.toString()}`,
{
headers: { 'Authorization': `Bearer ${API_KEY}` }
}
);
return response.data;
}
// Monitor connection events
const connections = await monitorActivity('connection');
connections.activity.forEach(event => {
console.log(`SIM ${event.iccid} connected to ${event.network.operator}`);
});
Get Device SIM Information
Retrieve SIM information for a specific IoT device.
Endpoint
GET /v1/globalsim/devices/{device_id}/sim
Request Example
curl -X GET https://api.wayscloud.services/v1/globalsim/devices/iot_dev_abc123/sim \
-H "Authorization: Bearer YOUR_API_KEY"
Response
{
"device_id": "iot_dev_abc123",
"device_name": "Temperature Sensor 01",
"sim": {
"iccid": "8901234567890123456",
"status": "active",
"msisdn": "+4791234567",
"current_network": {
"country": "Norway",
"operator": "Telenor Norway",
"network_type": "4G"
},
"data_usage_mb": 125.4,
"linked_at": "2025-10-15T10:00:00Z"
}
}
Get Device SIM Sessions
Retrieve connectivity sessions for a device's SIM card.
Endpoint
GET /v1/globalsim/devices/{device_id}/sim/sessions
Request Example
curl -X GET https://api.wayscloud.services/v1/globalsim/devices/iot_dev_abc123/sim/sessions \
-H "Authorization: Bearer YOUR_API_KEY"
Response format is identical to /v1/globalsim/sims/{iccid}/sessions.
Get Device SIM Activity
Retrieve activity events for a device's SIM card.
Endpoint
GET /v1/globalsim/devices/{device_id}/sim/activity
Request Example
curl -X GET https://api.wayscloud.services/v1/globalsim/devices/iot_dev_abc123/sim/activity \
-H "Authorization: Bearer YOUR_API_KEY"
Response format is identical to /v1/globalsim/sims/{iccid}/activity.
Real-time Monitoring Example
import requests
import time
def monitor_sim_activity(iccid, interval_seconds=60):
"""Monitor SIM activity in real-time"""
headers = {'Authorization': f'Bearer {API_KEY}'}
last_event_id = None
while True:
response = requests.get(
f'{API_URL}/sims/{iccid}/activity',
headers=headers,
params={'limit': 10}
)
activity = response.json()
for event in activity['activity']:
if event['event_id'] != last_event_id:
print(f"{event['timestamp']}: {event['event_type']}")
if 'network' in event:
print(f" Network: {event['network']['operator']}")
last_event_id = event['event_id']
time.sleep(interval_seconds)
# Monitor specific SIM
monitor_sim_activity('8901234567890123456', interval_seconds=30)
Activity Report Example
import pandas as pd
from datetime import datetime, timedelta
def generate_activity_report(days=30):
"""Generate activity report for all SIMs"""
headers = {'Authorization': f'Bearer {API_KEY}'}
end_date = datetime.now().date()
start_date = end_date - timedelta(days=days)
response = requests.get(
f'{API_URL}/sims/activity',
headers=headers,
params={
'start_date': start_date.isoformat(),
'end_date': end_date.isoformat(),
'limit': 1000
}
)
activity = response.json()['activity']
# Convert to DataFrame
df = pd.DataFrame(activity)
print(f"=== Activity Report ({days} days) ===")
print(f"\nTotal events: {len(df)}")
# Count by event type
print("\nEvents by type:")
print(df['event_type'].value_counts())
# Most active SIMs
print("\nMost active SIMs:")
print(df['iccid'].value_counts().head(5))
return df
# Generate report
report = generate_activity_report(30)
Rate Limits
- 500 requests/minute per API key
Next Steps
- SIM Management - Manage SIM cards
- Billing - Track costs and usage
- Code Examples - Complete working examples