Querying Usage
2 min
Query Usage data
Usage API payload:

{ // replace business_unit_id with customerId for a billing use case
"meterApiName": "ApiCalls",
"aggregation": "SUM",
"timeGroupingInterval": "Day",
"timeRange": {
"startTimeInSeconds": 1619293642
},
"filter": { "business_unit_id": ["xxx", "yyy"]},
"groupBy": ["business_unit_id"],
"take": {
"limit": 10,
"isAscending": false
}
}API response breakdown:

Sample API response:
{ // replace business_unit_id with customerId for a billing use case
"metadata": {
"account": null,
"meterApiName": "ApiCalls",
"aggregation": "sum",
"timeRange": {
"startTimeInSeconds": 1619294851,
"endTimeInSeconds": 1619467650
},
"filter": {
"business_unit_id": [
"xxx",
"yyy"
]
},
"groupBy": [
"customerId"
],
"take": {
"limit": 10,
"isAscending": false
},
"timeGroupingInterval": "day"
},
"secondsSinceEpochIntervals": [
1619222400,
1619308800,
1619395200
],
"clientMeters": [
{
"group": {
"groupInfo": {
"business_unit_id": "xxx"
}
},
"groupValue": 23645.0,
"values": [
{
"percentageFromPrevious": 0.0,
"value": 0.0,
"secondsSinceEpochUtc": 1619222400
},
{
"percentageFromPrevious": 100.0,
"value": 4040.0,
"secondsSinceEpochUtc": 1619308800
},
{
"percentageFromPrevious": 385.2722772277228,
"value": 19605.0,
"secondsSinceEpochUtc": 1619395200
}
]
},
{
"group": {
"groupInfo": {
"business_unit_id": "yyy"
}
},
"groupValue": 22608.0,
"values": [
{
"percentageFromPrevious": 0.0,
"value": 0.0,
"secondsSinceEpochUtc": 1619222400
},
{
"percentageFromPrevious": 100.0,
"value": 2507.0,
"secondsSinceEpochUtc": 1619308800
},
{
"percentageFromPrevious": 701.7949740725967,
"value": 20101.0,
"secondsSinceEpochUtc": 1619395200
}
]
}
]
}