Metrics

Cumulative usage time-series

Return usage as a **cumulative time-series**: for each requested `usage_types` dimension, a list of `{ timestamp, value }` points where `value` is the **running total** at that bucket boundary. Counts (`inbox_count`, `message_count`, `thread_count`) accumulate over the window; `storage_bytes` reports the current live counter at each point. The window is `start`–`end` (ISO-8601, at most 90 days apart), bucketed by `period` seconds. The number of buckets — `(end − start) ÷ period` — may not exceed 500; use a larger `period` for a longer window. `limit` takes at most that many buckets from the tail of the window, and `descending` returns the newest bucket first. Requires the key's `metrics_read` permission; a key without it gets `403`.

GET
/metrics/usage

Return usage as a cumulative time-series: for each requested usage_types dimension, a list of { timestamp, value } points where value is the running total at that bucket boundary. Counts (inbox_count, message_count, thread_count) accumulate over the window; storage_bytes reports the current live counter at each point.

The window is startend (ISO-8601, at most 90 days apart), bucketed by period seconds. The number of buckets — (end − start) ÷ period — may not exceed 500; use a larger period for a longer window. limit takes at most that many buckets from the tail of the window, and descending returns the newest bucket first.

Requires the key's metrics_read permission; a key without it gets 403.

Authorization

x-api-key<token>

The per-tenant API key. Sent as the x-api-key request header. The key is tenant-scoped.

In: header

Query Parameters

usage_types*array<>

The metered dimensions to report. Repeat the parameter, or pass a comma-separated list, for more than one.

start*string

Window start (inclusive), ISO-8601 UTC.

end*string

Window end, ISO-8601 UTC. At most 90 days after start.

period*integer

Bucket size in seconds. (end − start) ÷ period must be ≤ 500.

limit?integer

Return at most this many buckets, taken from the tail of the window.

descending?boolean

Return the newest bucket first when true. Defaults to oldest-first.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/metrics/usage?usage_types=inbox_count&start=2019-08-24T14%3A15%3A22Z&end=2019-08-24T14%3A15%3A22Z&period=1"
{  "inbox_count": [    {      "timestamp": "2019-08-24T14:15:22Z",      "value": 0    }  ],  "message_count": [    {      "timestamp": "2019-08-24T14:15:22Z",      "value": 0    }  ],  "thread_count": [    {      "timestamp": "2019-08-24T14:15:22Z",      "value": 0    }  ],  "storage_bytes": [    {      "timestamp": "2019-08-24T14:15:22Z",      "value": 0    }  ],  "property1": [    {      "timestamp": "2019-08-24T14:15:22Z",      "value": 0    }  ],  "property2": [    {      "timestamp": "2019-08-24T14:15:22Z",      "value": 0    }  ]}
{  "name": "string",  "message": "string"}
{  "name": "string",  "message": "string"}
{  "name": "validation",  "errors": {    "property1": "string",    "property2": "string"  }}
{  "name": "string",  "message": "string"}