List
Get batched usage data
post/v1/usage
Fetch aggregated usage data for multiple customers and billable-metrics, broken into intervals of the specified length.
Query Parameters
next_pagestring
optional
Cursor that indicates where the next page of results should start.
Body Parameters
ending_beforestring
formatdate-time
starting_onstring
formatdate-time
window_sizeenum
"HOUR" OR "DAY" OR "NONE"
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.
billable_metricsarray of object
optional
A list of billable metrics to fetch usage for. If absent, all billable metrics will be returned.
customer_idsarray of string
optional
A list of Metronome customer IDs to fetch usage for. If absent, usage for all customers will be returned.
Returns
dataarray of object
next_pagestring
curl https://api.metronome.com/v1/usage \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $METRONOME_BEARER_TOKEN" \
-d '{
"ending_before": "2021-01-03T00:00:00Z",
"starting_on": "2021-01-01T00:00:00Z",
"window_size": "HOUR"
}'
200 Example
{
"data": [
{
"billable_metric_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"billable_metric_name": "billable_metric_name",
"customer_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"end_timestamp": "2019-12-27T18:11:19.117Z",
"start_timestamp": "2019-12-27T18:11:19.117Z",
"value": 0,
"groups": {
"foo": 0
}
}
],
"next_page": "next_page"
}