Skip to content

Statistics

Get usage by label

You can get the account usage for a specific date range, subdivided by label and country. This can e.g. be used for billing your own customers (specified by label). Even if you do not use the label feature, this can still be used to get statistics about your SMS traffic. Everything will just have the label null.

POST /api/usage/labels

Request JSON Object:

  • from (string) - The from date, in YYYY-MM-DD format. Required
  • to (string) - The to date, in YYYY-MM-DD format. Required
  • label (string) - Optional label you want to look for.

Response JSON Array of Objects:

  • amount (float) - Amount of SMS messages
  • cost (float) - Cost of the SMS messages
  • country (string) - The country the SMS messages were sent to
  • currency (string) - Either DKK or EUR
  • label (string) - The label specified when the SMS messages were sent
  • messageclass_id (string) - The class specified when the SMS messages were sent

Status Codes:

Request example

1
2
3
4
5
6
7
8
9
POST /api/usage/labels HTTP/1.1
Host: gatewayapi.com
Authorization: Basic Zm9vOmJhcg==
Content-Type: application/json

{
    "from": "2019-08-01",
    "to": "2019-08-24"
}

Response example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
HTTP/1.1 200 OK
Content-Type: application/json

[
    {
        "amount": 29,
        "cost": 3.48,
        "country": "DK",
        "currency": "DKK",
        "label": null,
        "messageclass_id": "standard"
    },
    {
        "amount": 6,
        "cost": 1.5,
        "country": "IT",
        "currency": "DKK",
        "label": null,
        "messageclass_id": "standard"
    }
]