Embedded Telco > Docs > Recipes - Check Usage
Recipes
Check Usage
In order to check the usage of any given subscription the subscriptions endpoint can be called in order to get the complete list of subscriptions for a specific SIM. All subscriptions that were ever used in the SIM are returned in the response and it's up to the client code to filter for active subscriptions in order to calculate the balance.
Example Request
curl -X GET \ https://services.truphone.com/connect-api/v2/subscriptions?iccid=8944474600000109251/ \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H 'Cache-Control: no-cache' \ -H 'Content-Type: application/json' \ -H 'X-Correlation-ID: unique-id-from-requester-123'
Example Response
{
"data": [
{
"id": "__bPIjtY8e5xdjn36DwUCwslKkZABh1D2HzyaZdpdTg=",
"name": "5GB 30-Day Data Bundle",
"sim_id": "8944474600000109251",
"created_date": "2020-12-04T17:20:38Z",
"expiry_date": "2021-12-04T17:20:38Z",
"status": "ACTIVE",
"spend_balance": "0",
"initial_balance": "1073741824",
"current_balance": "1073741824",
"balance_units": "Bytes",
"_metadata": {
"links": {
"_self": "/v2/subscriptions/__bPIjtY8e5xdjn36DwUCwslKkZABh1D2HzyaZdpdTg="
}
}
}
],
"_metadata": {
"page": 1,
"page_size": 1,
"page_count": 1,
"links": {
"_self": "/v2/subscriptions?page=1&page_size=1",
"_next": "/v2/subscriptions?page=2&page_size=1"
}
}
}
1GLOBAL is a trading name of 1GLOBAL Holdings B.V.