Skip to main content
POST

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

limit
integer

Max number of results that should be returned

Required range: 1 <= x <= 100
next_page
string

Cursor that indicates where the next page of results should start.

Body

application/json

The usage query to run

customer_id
string<uuid>
required
billable_metric_id
string<uuid>
required
window_size
enum<string>
required

A window_size of "day" or "hour" will return the usage for the specified period segmented into daily or hourly aggregates. A window_size of "none" will return a single usage aggregate for the entirety of the specified period.

Available options:
hour,
day,
none,
HOUR,
DAY,
NONE,
Hour,
Day,
None
starting_on
string<date-time>
ending_before
string<date-time>
group_by
object
deprecated

Use group_key and group_filters instead. Use a single group key to group by. Compound group keys are not supported.

group_key
string[]

Group key to group usage by. Supports both simple (single key) and compound (multiple keys) group keys.

For simple group keys, provide a single key e.g. ["region"]. For compound group keys, provide multiple keys e.g. ["region", "team"].

For streaming metrics, the keys must be defined as a simple or compound group key on the billable metric. For compound group keys, all keys must match an exact compound group key definition — partial matches are not allowed.

Cannot be used together with group_by.

Minimum array length: 1
Minimum string length: 1
Example:
group_filters
object

Object mapping group keys to arrays of values to filter on. Only usage matching these filter values will be returned. Keys must be present in group_key. Omit a key or use an empty array to include all values for that dimension.

Example:
current_period
boolean

If true, will return the usage for the current billing period. Will return an error if the customer is currently uncontracted or starting_on and ending_before are specified when this is true.

Response

200 - application/json

Success

data
object[]
required
next_page
string | null
required