OpenAPI 3.0.0Apache 2.0raw.githubusercontent.com2026-08-131534331012.8 KB

1cd97f063f4a

Portal

Query meter Query meter

Query meter for consumer portal. This endpoint is publicly exposable to consumers. Query meter for consumer portal. This endpoint is publicly exposable to consumers.

get/api/v1/portal/meters/{meterSlug}/query

Path parameters

meterSlugstring required

Query parameters

clientIdstring

Client ID Useful to track progress of a query.

fromstring date-time
Example:2023-01-01T01:01:01.001Z

Start date-time in RFC 3339 format.

Inclusive.

For example: ?from=2025-01-01T00%3A00%3A00.000Z

tostring date-time
Example:2023-01-01T01:01:01.001Z

End date-time in RFC 3339 format.

Inclusive.

For example: ?to=2025-02-01T00%3A00%3A00.000Z

windowSize'MINUTE' | 'HOUR' | 'DAY' | 'MONTH'

Aggregation window size.

If not specified, a single usage aggregate will be returned for the entirety of the specified period for each subject and group.

For example: ?windowSize=DAY

windowTimeZonestring

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

For example: ?windowTimeZone=UTC

filterCustomerIdstring[]

Filtering by multiple customers.

For example: ?filterCustomerId=customer-1&filterCustomerId=customer-2

filterGroupByobject

Simple filter for group bys with exact match.

For example: ?filterGroupBy[vendor]=openai&filterGroupBy[model]=gpt-4-turbo

⚠️ Deprecated: Use advancedMeterGroupByFilters instead

Optional advanced meter group by filters. You can use this to filter for values of the meter groupBy fields.

groupBystring[]

If not specified a single aggregate will be returned for each subject and time window. subject is a reserved group by value.

For example: ?groupBy=subject&groupBy=model

Response

The request has succeeded.

fromstring date-time

The start of the period the usage is queried from. If not specified, the usage is queried from the beginning of time.

tostring date-time

The end of the period the usage is queried to. If not specified, the usage is queried up to the current time.

windowSize'MINUTE' | 'HOUR' | 'DAY' | 'MONTH'

Aggregation window size.

Example response

{
  "from": "2023-01-01T00:00:00Z",
  "to": "2023-01-02T00:00:00Z",
  "windowSize": "DAY",
  "data": [
    {
      "value": 12,
      "windowStart": "2023-01-01T00:00:00Z",
      "windowEnd": "2023-01-02T00:00:00Z",
      "subject": "customer-1",
      "groupBy": {
        "model": "gpt-4-turbo",
        "type": "prompt"
      }
    }
  ]
}