Meters
Query meter
Query a meter for usage.
Set Accept: application/json (the default) to get a structured JSON response. Set Accept: text/csv to download the same data as a CSV file suitable for spreadsheets. The CSV columns, in order, are:
from, to, [subject,] [customer_id, customer_key, customer_name,] <dimensions...>, value
The subject column is emitted only when subject is in the query's group_by_dimensions. The three customer_* columns are emitted together only when customer_id is in the query's group_by_dimensions.
post/openmeter/meters/{meterId}/query
Path parameters
meterIdstring required
ULID (Universally Unique Lexicographically Sortable Identifier).
Example:01G65Z755AFWAKHE12NY0CQ9FH
Request body
Example request
{
"from": "2023-01-01T00:00:00Z",
"to": "2023-01-02T00:00:00Z",
"granularity": "P1D",
"time_zone": "UTC"
}Response
The request has succeeded.
Example response
{
"from": "2023-01-01T00:00:00Z",
"to": "2023-01-02T00:00:00Z",
"data": [
{
"value": "12.3456",
"from": "2023-01-01T00:00:00Z",
"to": "2023-01-02T00:00:00Z",
"dimensions": {
"customer_id": "01G65Z755AFWAKHE12NY0CQ9FH",
"model": "gpt-4-turbo",
"type": "input"
}
}
]
}