---
title: "Query meter"
method: GET
path: "/api/v1/meters/{meterIdOrSlug}/query"
tags: ["Meters"]
---

# Query meter

`GET /api/v1/meters/{meterIdOrSlug}/query`

Query meter for usage.

## Path parameters

- `meterIdOrSlug` string, required

## Query parameters

- `clientId` string
- `from` string, date-time
- `to` string, date-time
- `windowSize` 'MINUTE' | 'HOUR' | 'DAY' | 'MONTH' — Aggregation window size.
- `windowTimeZone` string
- `subject` string[]
- `filterCustomerId` string[]
- `filterGroupBy` object
- `groupBy` string[]

## Response `200`

The request has succeeded.

- MeterQueryResult — The result of a meter query.
  - `from` string, date-time — The start of the period the usage is queried from. If not specified, the usage is queried from the beginning of time.
  - `to` string, 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.
  - `data` MeterQueryRow[], required — The usage data. If no data is available, an empty array is returned.
    - `value` number, double, required — The aggregated value.
    - `windowStart` string, date-time, required — The start of the window the value is aggregated over.
    - `windowEnd` string, date-time, required — The end of the window the value is aggregated over.
    - `subject` string, nullable, required — The subject the value is aggregated over. If not specified, the value is aggregated over all subjects.
    - `customerId` string — The customer ID the value is aggregated over.
    - `groupBy` object, required — The group by values the value is aggregated over.

## Other responses

- `400` — The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).
- `401` — The request has not been applied because it lacks valid authentication credentials for the target resource.
- `403` — The server understood the request but refuses to authorize it.
- `404` — The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.
- `412` — One or more conditions given in the request header fields evaluated to false when tested on the server.
- `500` — The server encountered an unexpected condition that prevented it from fulfilling the request.
- `503` — The server is currently unable to handle the request due to a temporary overload or scheduled maintenance, which will likely be alleviated after some delay.
- `default` — An unexpected error response.

---

[API](https://skmtc.net/openmeterio/apis/openmeter-api.md) · [All operations](https://skmtc.net/openmeterio/apis/openmeter-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/openmeterio/openmeter-api/revisions/1cd97f063f4a/schema)
