Skip to content

Statistics

Get usage by label

You can get the account usage for a specific date range, sub divided by label and country. This can be used for billing your own customers (specified by label) if you do not keep track of each SMS sent yourself. 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 SMSes
  • cost (float) - Cost of the SMSes
  • country (string) - The country the SMSes was sent to
  • currency (string) - Either DKK or EUR
  • label (string) - The label specified when the SMSes was sent
  • messageclass_id (string) - The class specified when the SMSes was sent

Status Codes:

Request example

1
2
3
4
5
6
7
8
9
GET /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"
    }
]