meters
Stable. Describes behaviour that is built and covered by tests in this repository.
GET /v1/meters #
List meters (latest version of each code)
Not paged: the response is the complete list.
Responses
| Status | Meaning | Body |
|---|---|---|
200 | OK | ListMetersResponse |
Example response
{
"meters": [
{
"code": "string",
"aggregation": "AGGREGATION_SUM",
"value_property": "string",
"filter": {},
"quantity_scale": 0,
"unit_label": "tokens",
"category": "AI",
"version": 1,
"create_time": "2026-11-03T10:15:00Z"
}
]
}curl
curl -X GET https://YOUR-API-ADDRESS/v1/meters \
-H "Authorization: Bearer $PAYRUDDER_API_KEY"POST /v1/meters #
Create a meter, or the next version of an existing code
Request body
| Field | Type | Description |
|---|---|---|
code required | string | |
aggregation required | AGGREGATION_SUM | AGGREGATION_COUNT | AGGREGATION_MAX | AGGREGATION_UNIQUE | AGGREGATION_LAST | How a customer's events of a billing period combine into one quantity. SUM adds the quantities, COUNT counts the events, MAX keeps the largest quantity. UNIQUE counts the distinct values of the event property named by value_property (an event without the property is not counted; quantity_scale must be 0). LAST is the quantity of the latest event of the period by event_time, ties broken by event id; an event that arrives after the period's cutoff never changes it. A code cannot change into or out of UNIQUE or LAST in a later version. |
value_property | string | Required for SUM, MAX and LAST (the event property holding the quantity) and for UNIQUE (the property whose distinct values are counted) |
filter | object | |
quantity_scale | integer | Decimal places, fixed per code |
unit_label required | string | Any unit of your choice: tokens, GB-h, seats, minutes |
category | string | Any group of your choice to file the meter under (compute, storage, AI); changes nothing in metering or billing |
Example
{
"code": "string",
"aggregation": "AGGREGATION_SUM",
"unit_label": "tokens"
}Responses
| Status | Meaning | Body |
|---|---|---|
201 | Created | Meter |
400 | Error envelope | Error |
429 | Error envelope | Error |
Example response
{
"code": "string",
"aggregation": "AGGREGATION_SUM",
"value_property": "string",
"filter": {},
"quantity_scale": 0,
"unit_label": "tokens",
"category": "AI",
"version": 1,
"create_time": "2026-11-03T10:15:00Z"
}curl
curl -X POST https://YOUR-API-ADDRESS/v1/meters \
-H "Authorization: Bearer $PAYRUDDER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"code":"string","aggregation":"AGGREGATION_SUM","unit_label":"tokens"}'GET /v1/meters/{code} #
Get the latest version of a meter
Parameters
| Name | In | Type | Description |
|---|---|---|---|
code required | path | string |
Responses
| Status | Meaning | Body |
|---|---|---|
200 | OK | Meter |
404 | Error envelope | Error |
Example response
{
"code": "string",
"aggregation": "AGGREGATION_SUM",
"value_property": "string",
"filter": {},
"quantity_scale": 0,
"unit_label": "tokens",
"category": "AI",
"version": 1,
"create_time": "2026-11-03T10:15:00Z"
}curl
curl -X GET https://YOUR-API-ADDRESS/v1/meters/<code> \
-H "Authorization: Bearer $PAYRUDDER_API_KEY"Models
CreateMeterRequest
| Field | Type | Description |
|---|---|---|
code required | string | |
aggregation required | AGGREGATION_SUM | AGGREGATION_COUNT | AGGREGATION_MAX | AGGREGATION_UNIQUE | AGGREGATION_LAST | How a customer's events of a billing period combine into one quantity. SUM adds the quantities, COUNT counts the events, MAX keeps the largest quantity. UNIQUE counts the distinct values of the event property named by value_property (an event without the property is not counted; quantity_scale must be 0). LAST is the quantity of the latest event of the period by event_time, ties broken by event id; an event that arrives after the period's cutoff never changes it. A code cannot change into or out of UNIQUE or LAST in a later version. |
value_property | string | Required for SUM, MAX and LAST (the event property holding the quantity) and for UNIQUE (the property whose distinct values are counted) |
filter | object | |
quantity_scale | integer | Decimal places, fixed per code |
unit_label required | string | Any unit of your choice: tokens, GB-h, seats, minutes |
category | string | Any group of your choice to file the meter under (compute, storage, AI); changes nothing in metering or billing |
Error
| Field | Type | Description |
|---|---|---|
error required | object |
ListMetersResponse
| Field | Type | Description |
|---|---|---|
meters required | array of Meter |
Meter
| Field | Type | Description |
|---|---|---|
code required | string | |
aggregation required | AGGREGATION_SUM | AGGREGATION_COUNT | AGGREGATION_MAX | AGGREGATION_UNIQUE | AGGREGATION_LAST | |
value_property required | string | Required for SUM, MAX, UNIQUE and LAST |
filter required | object | |
quantity_scale required | integer | Decimal places, fixed per code |
unit_label required | string | Any unit of your choice: tokens, GB-h, seats, minutes |
category required | string | Any group of your choice to file the meter under (compute, storage, AI); changes nothing in metering or billing |
version required | integer | |
create_time required | string · date-time |