Billing & Subscription
Monitor GlobalSIM billing, track data usage costs, and manage your subscription.
Get Billing Information
Retrieve detailed billing information including data usage costs and subscription fees.
Endpoint
GET /v1/globalsim/sims/billing
Query Parameters
| Parameter | Type | Description | Default |
|---|---|---|---|
start_date | string | Start date (YYYY-MM-DD) | Current month start |
end_date | string | End date (YYYY-MM-DD) | Current date |
iccid | string | Filter by specific ICCID | all |
Request Example
curl -X GET https://api.wayscloud.services/v1/globalsim/sims/billing \
-H "Authorization: Bearer YOUR_API_KEY"
Response
{
"billing_period": {
"start_date": "2025-11-01",
"end_date": "2025-11-05",
"billing_cycle": "monthly"
},
"summary": {
"total_cost": 124.56,
"subscription_fees": 84.00,
"data_costs": 40.56,
"currency": "EUR"
},
"subscription": {
"active_sims": 42,
"monthly_fee_per_sim": 2.00,
"total_monthly_fees": 84.00
},
"data_usage": {
"total_mb": 812.3
},
"by_sim": [
{
"iccid": "8901234567890123456",
"msisdn": "+4791234567",
"subscription_fee": 2.00,
"data_usage_mb": 125.4,
"data_cost": 6.27,
"total_cost": 8.27
},
{
"iccid": "8901234567890234567",
"msisdn": "+46701234567",
"subscription_fee": 2.00,
"data_usage_mb": 456.8,
"data_cost": 22.84,
"total_cost": 24.84
}
]
}
Python Example
import requests
from datetime import datetime, timedelta
API_KEY = 'YOUR_API_KEY'
API_URL = 'https://api.wayscloud.services/v1/globalsim'
def get_billing(start_date=None, end_date=None):
headers = {'Authorization': f'Bearer {API_KEY}'}
params = {}
if start_date:
params['start_date'] = start_date
if end_date:
params['end_date'] = end_date
response = requests.get(
f'{API_URL}/sims/billing',
headers=headers,
params=params
)
return response.json()
# Get current month billing
billing = get_billing()
print(f"=== Billing Summary ===")
print(f"Period: {billing['billing_period']['start_date']} to {billing['billing_period']['end_date']}")
print(f"\nTotal Cost: {billing['summary']['currency']} {billing['summary']['total_cost']:.2f}")
print(f" Subscription Fees: {billing['summary']['currency']} {billing['summary']['subscription_fees']:.2f}")
print(f" Data Costs: {billing['summary']['currency']} {billing['summary']['data_costs']:.2f}")
print(f"\nData Usage: {billing['data_usage']['total_mb']:.2f} MB")
# Top 5 most expensive SIMs
print("\nTop 5 Most Expensive SIMs:")
top_sims = sorted(billing['by_sim'], key=lambda x: x['total_cost'], reverse=True)[:5]
for sim in top_sims:
print(f" {sim['iccid']}: {billing['summary']['currency']} {sim['total_cost']:.2f} ({sim['data_usage_mb']:.2f} MB)")
Get Subscription Details
Retrieve your GlobalSIM subscription plan details and quotas.
Endpoint
GET /v1/globalsim/subscription
Request Example
curl -X GET https://api.wayscloud.services/v1/globalsim/subscription \
-H "Authorization: Bearer YOUR_API_KEY"
Response
{
"plan": "business",
"status": "active",
"limits": {
"max_sims": 100,
"api_rate_limit": 500
},
"usage": {
"active_sims": 42,
"api_requests_today": 1245
},
"billing": {
"billing_cycle": "monthly",
"next_billing_date": "2025-12-01",
"payment_method": "credit_card",
"auto_renewal": true
},
"features": [
"Global coverage (160+ countries)",
"Real-time usage tracking",
"API access",
"24/7 support"
],
"created_at": "2025-01-15T10:00:00Z"
}
Node.js Example
const axios = require('axios');
async function getSubscription() {
try {
const response = await axios.get(
`${API_URL}/subscription`,
{
headers: { 'Authorization': `Bearer ${API_KEY}` }
}
);
const sub = response.data;
console.log('=== Subscription Details ===');
console.log(`Plan: ${sub.plan}`);
console.log(`Status: ${sub.status}`);
console.log(`\nUsage:`);
console.log(` SIMs: ${sub.usage.active_sims}/${sub.limits.max_sims}`);
console.log(` API requests today: ${sub.usage.api_requests_today}`);
console.log(`\nNext billing: ${sub.billing.next_billing_date}`);
return sub;
} catch (error) {
console.error('Error:', error.message);
}
}
getSubscription();
Get Device SIM Billing
Retrieve billing information for a specific device's SIM card.
Endpoint
GET /v1/globalsim/devices/{device_id}/sim/billing
Request Example
curl -X GET https://api.wayscloud.services/v1/globalsim/devices/iot_dev_abc123/sim/billing \
-H "Authorization: Bearer YOUR_API_KEY"
Response
{
"device_id": "iot_dev_abc123",
"device_name": "Temperature Sensor 01",
"sim": {
"iccid": "8901234567890123456",
"msisdn": "+4791234567"
},
"billing_period": {
"start_date": "2025-11-01",
"end_date": "2025-11-05"
},
"costs": {
"subscription_fee": 2.00,
"data_cost": 6.27,
"total_cost": 8.27,
"currency": "EUR"
},
"data_usage": {
"total_mb": 125.4
},
"sessions": [
{
"session_id": "ses_abc123",
"start_time": "2025-11-05T08:00:00Z",
"data_mb": 47.8,
"network": "Telenor Norway"
},
{
"session_id": "ses_def456",
"start_time": "2025-11-04T14:00:00Z",
"data_mb": 65.3,
"network": "Telia Sweden"
}
]
}
Monitor High Usage SIMs
def find_high_usage_sims(threshold_mb=500):
"""Identify SIMs with high data usage"""
headers = {'Authorization': f'Bearer {API_KEY}'}
response = requests.get(
f'{API_URL}/sims/billing',
headers=headers
)
billing = response.json()
high_usage = [
sim for sim in billing['by_sim']
if sim['data_usage_mb'] > threshold_mb
]
print(f"=== SIMs using >{threshold_mb} MB ===")
for sim in high_usage:
print(f"{sim['iccid']}: {sim['data_usage_mb']:.2f} MB ({billing['summary']['currency']} {sim['data_cost']:.2f})")
return high_usage
# Find SIMs using more than 500 MB
high_usage_sims = find_high_usage_sims(500)
Generate Billing Report
import pandas as pd
from datetime import datetime
def generate_billing_report(months=3):
"""Generate billing report for multiple months"""
headers = {'Authorization': f'Bearer {API_KEY}'}
reports = []
for i in range(months):
# Calculate month range
# (implementation depends on your date calculations)
response = requests.get(
f'{API_URL}/sims/billing',
headers=headers,
params={'start_date': start, 'end_date': end}
)
reports.append(response.json())
# Create DataFrame
summary_data = []
for report in reports:
summary_data.append({
'month': report['billing_period']['start_date'][:7],
'total_cost': report['summary']['total_cost'],
'subscription_fees': report['summary']['subscription_fees'],
'data_costs': report['summary']['data_costs'],
'data_mb': report['data_usage']['total_mb']
})
df = pd.DataFrame(summary_data)
print(df)
df.to_csv('globalsim_billing_report.csv', index=False)
# Generate 3-month report
generate_billing_report(3)
Cost Analysis Example
def analyze_costs():
"""Analyze costs per SIM and identify optimization opportunities"""
headers = {'Authorization': f'Bearer {API_KEY}'}
response = requests.get(
f'{API_URL}/sims/billing',
headers=headers
)
billing = response.json()
# Calculate average cost per SIM
sims = billing['by_sim']
total_sims = len(sims)
avg_cost = billing['summary']['total_cost'] / total_sims if total_sims > 0 else 0
print(f"=== Cost Analysis ===")
print(f"Total SIMs: {total_sims}")
print(f"Average cost per SIM: {billing['summary']['currency']} {avg_cost:.2f}")
# Find inactive SIMs (low usage)
inactive = [s for s in sims if s['data_usage_mb'] < 1]
print(f"\nInactive SIMs (< 1 MB): {len(inactive)}")
if inactive:
inactive_cost = sum(s['total_cost'] for s in inactive)
print(f" Potential savings: {billing['summary']['currency']} {inactive_cost:.2f}")
# Find high-cost SIMs
high_cost = [s for s in sims if s['total_cost'] > avg_cost * 2]
print(f"\nHigh-cost SIMs (> 2x average): {len(high_cost)}")
for sim in high_cost[:5]:
print(f" {sim['iccid']}: {billing['summary']['currency']} {sim['total_cost']:.2f}")
analyze_costs()
Set Up Cost Alerts
def check_cost_alerts(budget_limit=200.00, sim_limit=15.00):
"""Monitor costs and send alerts"""
headers = {'Authorization': f'Bearer {API_KEY}'}
response = requests.get(
f'{API_URL}/sims/billing',
headers=headers
)
billing = response.json()
alerts = []
# Check total cost
if billing['summary']['total_cost'] > budget_limit:
alerts.append(
f"Total cost ({billing['summary']['currency']} {billing['summary']['total_cost']:.2f}) "
f"exceeds budget ({billing['summary']['currency']} {budget_limit})"
)
# Check individual SIMs
for sim in billing['by_sim']:
if sim['total_cost'] > sim_limit:
alerts.append(
f"SIM {sim['iccid']} cost ({billing['summary']['currency']} {sim['total_cost']:.2f}) "
f"exceeds limit ({billing['summary']['currency']} {sim_limit})"
)
if alerts:
print("=== Cost Alerts ===")
for alert in alerts:
print(f" {alert}")
else:
print("All costs within budget")
return alerts
# Run cost checks
check_cost_alerts()
Rate Limits
- 500 requests/minute per API key
Next Steps
- SIM Management - Manage SIM cards
- Sessions & Activity - Monitor connectivity
- Code Examples - Complete working examples