v52

latestOpenAPI 3.0.0raw.githubusercontent.com2026-08-03101355448.4 KB
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

fromstring date-time

RFC3339 formatted date-time string in UTC.

tostring date-time

RFC3339 formatted date-time string in UTC.

granularity'PT1M' | 'PT1H' | 'P1D' | 'P1M'

The granularity of the time grouping. Time durations are specified in ISO 8601 format.

time_zonestring

The value is the name of the time zone as defined in the IANA Time Zone Database (http://www.iana.org/time-zones). The time zone is used to determine the start and end of the time buckets. If not specified, the UTC timezone will be used.

group_by_dimensionsstring[]

The dimensions to group the results by.

Example request

{
  "from": "2023-01-01T00:00:00Z",
  "to": "2023-01-02T00:00:00Z",
  "granularity": "P1D",
  "time_zone": "UTC"
}

Response

The request has succeeded.

fromstring date-time

RFC3339 formatted date-time string in UTC.

tostring date-time

RFC3339 formatted date-time string in UTC.

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"
      }
    }
  ]
}