Skip to content

Statistics for Billing

To access billing statistics, you need to use an API key that can be used with every mandate, to do that, navigate to the administrator portal, create a new API key and leave the mandate select box on All mandates.

Shared options

These options are supplied as query parameters.

Key Example Description
after 2017-10-01 Only count items after this date.
truncate_by day How to truncate the datetime, available: day, month, year. Default month

Packet count

Method: GET, Endpoint: /mandates/:mandate_id/stats/packets

Example request

GET https://element-iot.com/api/v1/mandates/915bd365-dc7b-4e89-8c37-6fd8589bbb44/stats/packets?auth=46cb688e2c0b468e26e914235d4b73ea&after=2017-11-01&truncate_by=day

Example response

[
  {"packets":6,"date":"2017-11-02T00:00:00.000000"},
  {"packets":8,"date":"2017-11-08T00:00:00.000000"},
  {"packets":7,"date":"2017-11-10T00:00:00.000000"},
  {"packets":126,"date":"2017-11-13T00:00:00.000000"}
]

Created devices count

Method: GET, Endpoint: /mandates/:mandate_id/stats/created_devices

Example request

GET https://element-iot.com/api/v1/mandates/915bd365-dc7b-4e89-8c37-6fd8589bbb44/stats/created_devices?auth=46cb688e2c0b468e26e914235d4b73ea&truncate_by=day

Example response

[
  {"devices":1,"date":"2017-10-23T00:00:00.000000"},
  {"devices":1,"date":"2017-11-15T00:00:00.000000"}
]

List all mandates

To get the mandate ids, there is a mandate list route available for priviledged API keys

Method: GET, Endpoint: /mandates/

Example request

GET https://element-iot.com/api/v1/mandates?auth=46cb688e2c0b468e26e914235d4b73ea

Example response

[
  {
    "updated_at":"2017-08-15T15:53:01.849472Z",
    "slug":"demo",
    "name":"Demo GmbH",
    "limit_max_api_keys":5,
    "inserted_at":"2017-06-15T10:22:56.717045Z",
    "id":"3580d2ce-fc84-4f0d-ae6d-d5d59a2171bd",
    "default_language":"de",
    "allow_registration":true
  }
]