Zuplo Developer API

List meters

GET
https://dev.zuplo.com
/v3/metering/{bucketId}/meters

⚠️ Preview: The Metering APIs are in preview and subject to change.

List meters.

List meters › path Parameters

bucketId
​string · required

The id of the bucket. Zuplo automatically creates buckets for your project. You can find it in your Zuplo Portal under the Settings tab for your project.

List meters › query Parameters

page
​integer · min: 1 · style: form

Page index.

Default is 1.

Default: 1
pageSize
​integer · min: 1 · max: 1000 · style: form

The maximum number of items per page.

Default is 100.

Default: 100
order
​SortOrder · enum · style: form

The order direction.

The order direction.

Enum values:
ASC
DESC
Default: ASC
orderBy
​MeterOrderBy · enum · style: form

The order by field.

Order by options for meters.

Enum values:
key
name
aggregation
createdAt
updatedAt
includeDeleted
​boolean · style: form

Include deleted meters.

Default: false

List meters › Responses

The request has succeeded.

A meter is a configuration that defines how to match and aggregate events.
id
​string · readOnly · pattern: ^[0-7][0-9A-HJKMNP-T… · required

A unique identifier for the resource.

Example: 01G65Z755AFWAKHE12NY0CQ9FH
createdAt
​string · date-time · readOnly · required

Timestamp of when the resource was created.

Example: 2024-01-01T01:01:01.001Z
updatedAt
​string · date-time · readOnly · required

Timestamp of when the resource was last updated.

Example: 2024-01-01T01:01:01.001Z
slug
​string · minLength: 1 · maxLength: 64 · pattern: ^[a-z0-9]+(?:_[a-z0-… · required

A unique, human-readable identifier for the meter. Must consist only alphanumeric and underscore characters.

Example: tokens_total
aggregation
​string · enum · required

The aggregation type to use for the meter.

Enum values:
SUM
COUNT
UNIQUE_COUNT
AVG
MIN
MAX
LATEST
Example: SUM
eventType
​string · minLength: 1 · required

The event type to aggregate.

Example: prompt
description
​string · maxLength: 1024

Optional description of the resource. Maximum 1024 characters.

​object | null

Additional metadata for the resource.

Example: {"externalId":"019142cc-a016-796a-8113-1a942fecd26d"}
deletedAt
​string · date-time · readOnly

Timestamp of when the resource was permanently deleted.

Example: 2024-01-01T01:01:01.001Z
name
​string · minLength: 1 · maxLength: 256

Human-readable name for the resource. Between 1 and 256 characters. Defaults to the slug if not specified.

eventFrom
​string · date-time

The date since the meter should include events. Useful to skip old events. If not specified, all historical events are included.

Example: 2023-01-01T01:01:01.001Z
valueProperty
​string · minLength: 1

JSONPath expression to extract the value from the ingested event's data property.

The ingested value for SUM, AVG, MIN, and MAX aggregations is a number or a string that can be parsed to a number.

For UNIQUE_COUNT aggregation, the ingested value must be a string. For COUNT aggregation the valueProperty is ignored.

Example: $.tokens
​object

Named JSONPath expressions to extract the group by values from the event data.

Keys must be unique and consist only alphanumeric and underscore characters.

Example: {"type":"$.type"}

Create meter

POST
https://dev.zuplo.com
/v3/metering/{bucketId}/meters

⚠️ Preview: The Metering APIs are in preview and subject to change.

Create a meter.

Create meter › path Parameters

bucketId
​string · required

The id of the bucket. Zuplo automatically creates buckets for your project. You can find it in your Zuplo Portal under the Settings tab for your project.

Create meter › Request Body

A meter create model.
slug
​string · minLength: 1 · maxLength: 64 · pattern: ^[a-z0-9]+(?:_[a-z0-… · required

A unique, human-readable identifier for the meter. Must consist only alphanumeric and underscore characters.

Example: tokens_total
aggregation
​string · enum · required

The aggregation type to use for the meter.

Enum values:
SUM
COUNT
UNIQUE_COUNT
AVG
MIN
MAX
LATEST
Example: SUM
eventType
​string · minLength: 1 · required

The event type to aggregate.

Example: prompt
description
​string · maxLength: 1024

Optional description of the resource. Maximum 1024 characters.

​object | null

Additional metadata for the resource.

Example: {"externalId":"019142cc-a016-796a-8113-1a942fecd26d"}
name
​string · minLength: 1 · maxLength: 256

Human-readable name for the resource. Between 1 and 256 characters. Defaults to the slug if not specified.

eventFrom
​string · date-time

The date since the meter should include events. Useful to skip old events. If not specified, all historical events are included.

Example: 2023-01-01T01:01:01.001Z
valueProperty
​string · minLength: 1

JSONPath expression to extract the value from the ingested event's data property.

The ingested value for SUM, AVG, MIN, and MAX aggregations is a number or a string that can be parsed to a number.

For UNIQUE_COUNT aggregation, the ingested value must be a string. For COUNT aggregation the valueProperty is ignored.

Example: $.tokens
​object

Named JSONPath expressions to extract the group by values from the event data.

Keys must be unique and consist only alphanumeric and underscore characters.

Example: {"type":"$.type"}

Create meter › Responses

The request has succeeded and a new resource has been created as a result.

A meter is a configuration that defines how to match and aggregate events.
id
​string · readOnly · pattern: ^[0-7][0-9A-HJKMNP-T… · required

A unique identifier for the resource.

Example: 01G65Z755AFWAKHE12NY0CQ9FH
createdAt
​string · date-time · readOnly · required

Timestamp of when the resource was created.

Example: 2024-01-01T01:01:01.001Z
updatedAt
​string · date-time · readOnly · required

Timestamp of when the resource was last updated.

Example: 2024-01-01T01:01:01.001Z
slug
​string · minLength: 1 · maxLength: 64 · pattern: ^[a-z0-9]+(?:_[a-z0-… · required

A unique, human-readable identifier for the meter. Must consist only alphanumeric and underscore characters.

Example: tokens_total
aggregation
​string · enum · required

The aggregation type to use for the meter.

Enum values:
SUM
COUNT
UNIQUE_COUNT
AVG
MIN
MAX
LATEST
Example: SUM
eventType
​string · minLength: 1 · required

The event type to aggregate.

Example: prompt
description
​string · maxLength: 1024

Optional description of the resource. Maximum 1024 characters.

​object | null

Additional metadata for the resource.

Example: {"externalId":"019142cc-a016-796a-8113-1a942fecd26d"}
deletedAt
​string · date-time · readOnly

Timestamp of when the resource was permanently deleted.

Example: 2024-01-01T01:01:01.001Z
name
​string · minLength: 1 · maxLength: 256

Human-readable name for the resource. Between 1 and 256 characters. Defaults to the slug if not specified.

eventFrom
​string · date-time

The date since the meter should include events. Useful to skip old events. If not specified, all historical events are included.

Example: 2023-01-01T01:01:01.001Z
valueProperty
​string · minLength: 1

JSONPath expression to extract the value from the ingested event's data property.

The ingested value for SUM, AVG, MIN, and MAX aggregations is a number or a string that can be parsed to a number.

For UNIQUE_COUNT aggregation, the ingested value must be a string. For COUNT aggregation the valueProperty is ignored.

Example: $.tokens
​object

Named JSONPath expressions to extract the group by values from the event data.

Keys must be unique and consist only alphanumeric and underscore characters.

Example: {"type":"$.type"}

Get meter

GET
https://dev.zuplo.com
/v3/metering/{bucketId}/meters/{meterIdOrSlug}

⚠️ Preview: The Metering APIs are in preview and subject to change.

Get a meter by ID or slug.

Get meter › path Parameters

bucketId
​string · required

The id of the bucket. Zuplo automatically creates buckets for your project. You can find it in your Zuplo Portal under the Settings tab for your project.

meterIdOrSlug
​string · minLength: 1 · maxLength: 64 · pattern: ^[a-z0-9]+(?:_[a-z0-… · required

Get meter › Responses

The request has succeeded.

A meter is a configuration that defines how to match and aggregate events.
id
​string · readOnly · pattern: ^[0-7][0-9A-HJKMNP-T… · required

A unique identifier for the resource.

Example: 01G65Z755AFWAKHE12NY0CQ9FH
createdAt
​string · date-time · readOnly · required

Timestamp of when the resource was created.

Example: 2024-01-01T01:01:01.001Z
updatedAt
​string · date-time · readOnly · required

Timestamp of when the resource was last updated.

Example: 2024-01-01T01:01:01.001Z
slug
​string · minLength: 1 · maxLength: 64 · pattern: ^[a-z0-9]+(?:_[a-z0-… · required

A unique, human-readable identifier for the meter. Must consist only alphanumeric and underscore characters.

Example: tokens_total
aggregation
​string · enum · required

The aggregation type to use for the meter.

Enum values:
SUM
COUNT
UNIQUE_COUNT
AVG
MIN
MAX
LATEST
Example: SUM
eventType
​string · minLength: 1 · required

The event type to aggregate.

Example: prompt
description
​string · maxLength: 1024

Optional description of the resource. Maximum 1024 characters.

​object | null

Additional metadata for the resource.

Example: {"externalId":"019142cc-a016-796a-8113-1a942fecd26d"}
deletedAt
​string · date-time · readOnly

Timestamp of when the resource was permanently deleted.

Example: 2024-01-01T01:01:01.001Z
name
​string · minLength: 1 · maxLength: 256

Human-readable name for the resource. Between 1 and 256 characters. Defaults to the slug if not specified.

eventFrom
​string · date-time

The date since the meter should include events. Useful to skip old events. If not specified, all historical events are included.

Example: 2023-01-01T01:01:01.001Z
valueProperty
​string · minLength: 1

JSONPath expression to extract the value from the ingested event's data property.

The ingested value for SUM, AVG, MIN, and MAX aggregations is a number or a string that can be parsed to a number.

For UNIQUE_COUNT aggregation, the ingested value must be a string. For COUNT aggregation the valueProperty is ignored.

Example: $.tokens
​object

Named JSONPath expressions to extract the group by values from the event data.

Keys must be unique and consist only alphanumeric and underscore characters.

Example: {"type":"$.type"}

Update meter

PUT
https://dev.zuplo.com
/v3/metering/{bucketId}/meters/{meterIdOrSlug}

⚠️ Preview: The Metering APIs are in preview and subject to change.

Update a meter.

Update meter › path Parameters

bucketId
​string · required

The id of the bucket. Zuplo automatically creates buckets for your project. You can find it in your Zuplo Portal under the Settings tab for your project.

meterIdOrSlug
​string · minLength: 1 · maxLength: 64 · pattern: ^[a-z0-9]+(?:_[a-z0-… · required

Update meter › Request Body

A meter update model. Only the properties that can be updated are included. For example, the slug and aggregation cannot be updated.
description
​string · maxLength: 1024

Optional description of the resource. Maximum 1024 characters.

​object | null

Additional metadata for the resource.

Example: {"externalId":"019142cc-a016-796a-8113-1a942fecd26d"}
name
​string · minLength: 1 · maxLength: 256

Human-readable name for the resource. Between 1 and 256 characters. Defaults to the slug if not specified.

​object

Named JSONPath expressions to extract the group by values from the event data.

Keys must be unique and consist only alphanumeric and underscore characters.

Example: {"type":"$.type"}

Update meter › Responses

The request has succeeded.

A meter is a configuration that defines how to match and aggregate events.
id
​string · readOnly · pattern: ^[0-7][0-9A-HJKMNP-T… · required

A unique identifier for the resource.

Example: 01G65Z755AFWAKHE12NY0CQ9FH
createdAt
​string · date-time · readOnly · required

Timestamp of when the resource was created.

Example: 2024-01-01T01:01:01.001Z
updatedAt
​string · date-time · readOnly · required

Timestamp of when the resource was last updated.

Example: 2024-01-01T01:01:01.001Z
slug
​string · minLength: 1 · maxLength: 64 · pattern: ^[a-z0-9]+(?:_[a-z0-… · required

A unique, human-readable identifier for the meter. Must consist only alphanumeric and underscore characters.

Example: tokens_total
aggregation
​string · enum · required

The aggregation type to use for the meter.

Enum values:
SUM
COUNT
UNIQUE_COUNT
AVG
MIN
MAX
LATEST
Example: SUM
eventType
​string · minLength: 1 · required

The event type to aggregate.

Example: prompt
description
​string · maxLength: 1024

Optional description of the resource. Maximum 1024 characters.

​object | null

Additional metadata for the resource.

Example: {"externalId":"019142cc-a016-796a-8113-1a942fecd26d"}
deletedAt
​string · date-time · readOnly

Timestamp of when the resource was permanently deleted.

Example: 2024-01-01T01:01:01.001Z
name
​string · minLength: 1 · maxLength: 256

Human-readable name for the resource. Between 1 and 256 characters. Defaults to the slug if not specified.

eventFrom
​string · date-time

The date since the meter should include events. Useful to skip old events. If not specified, all historical events are included.

Example: 2023-01-01T01:01:01.001Z
valueProperty
​string · minLength: 1

JSONPath expression to extract the value from the ingested event's data property.

The ingested value for SUM, AVG, MIN, and MAX aggregations is a number or a string that can be parsed to a number.

For UNIQUE_COUNT aggregation, the ingested value must be a string. For COUNT aggregation the valueProperty is ignored.

Example: $.tokens
​object

Named JSONPath expressions to extract the group by values from the event data.

Keys must be unique and consist only alphanumeric and underscore characters.

Example: {"type":"$.type"}

Delete meter

DELETE
https://dev.zuplo.com
/v3/metering/{bucketId}/meters/{meterIdOrSlug}

⚠️ Preview: The Metering APIs are in preview and subject to change.

Delete a meter.

Delete meter › path Parameters

bucketId
​string · required

The id of the bucket. Zuplo automatically creates buckets for your project. You can find it in your Zuplo Portal under the Settings tab for your project.

meterIdOrSlug
​string · minLength: 1 · maxLength: 64 · pattern: ^[a-z0-9]+(?:_[a-z0-… · required

Delete meter › Responses

There is no content to send for this request, but the headers may be useful.

No data returned

List meter group by values

GET
https://dev.zuplo.com
/v3/metering/{bucketId}/meters/{meterIdOrSlug}/group-by/{groupByKey}/values

⚠️ Preview: The Metering APIs are in preview and subject to change.

List meter group by values.

List meter group by values › path Parameters

bucketId
​string · required

The id of the bucket. Zuplo automatically creates buckets for your project. You can find it in your Zuplo Portal under the Settings tab for your project.

meterIdOrSlug
​string · minLength: 1 · maxLength: 64 · pattern: ^[a-z0-9]+(?:_[a-z0-… · required
groupByKey
​string · required

List meter group by values › query Parameters

from
​string · date-time · style: form

Start date-time in RFC 3339 format.

Inclusive. Defaults to 24 hours ago.

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

Example: 2023-01-01T01:01:01.001Z
to
​string · date-time · style: form

End date-time in RFC 3339 format.

Inclusive.

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

Example: 2023-01-01T01:01:01.001Z

List meter group by values › Responses

The request has succeeded.

​string[]

Query meter

GET
https://dev.zuplo.com
/v3/metering/{bucketId}/meters/{meterIdOrSlug}/query

⚠️ Preview: The Metering APIs are in preview and subject to change.

Query meter for usage.

Query meter › path Parameters

bucketId
​string · required

The id of the bucket. Zuplo automatically creates buckets for your project. You can find it in your Zuplo Portal under the Settings tab for your project.

meterIdOrSlug
​string · minLength: 1 · maxLength: 64 · pattern: ^[a-z0-9]+(?:_[a-z0-… · required

Query meter › query Parameters

clientId
​string · minLength: 1 · maxLength: 36 · style: form

Client ID Useful to track progress of a query.

from
​string · date-time · style: form

Start date-time in RFC 3339 format.

Inclusive.

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

Example: 2023-01-01T01:01:01.001Z
to
​string · date-time · style: form

End date-time in RFC 3339 format.

Inclusive.

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

Example: 2023-01-01T01:01:01.001Z
windowSize
​WindowSize · enum · style: form

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

Aggregation window size.

Enum values:
MINUTE
HOUR
DAY
MONTH
windowTimeZone
​string · style: form

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

Default: UTC
subject
​string[] · style: form

Filtering by multiple subjects.

For example: ?subject=subject-1&subject=subject-2

filterCustomerId
​string[] · maxItems: 100 · style: form

Filtering by multiple customers.

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

filterSubscription
​string[] · maxItems: 100 · style: form

Filtering by multiple subscriptions.

For example: ?filterSubscription=subscription-1&filterSubscription=subscription-2

​object · style: deepObject

Simple filter for group bys with exact match.

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

advancedMeterGroupByFilters
​string

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

groupBy
​string[] · style: form

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

Query meter › Responses

The request has succeeded.

The result of a meter query.
​MeterQueryRow[] · required

The usage data. If no data is available, an empty array is returned.

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.

Example: 2023-01-01T01:01:01.001Z
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.

Example: 2023-01-01T01:01:01.001Z
windowSize
​string · enum

The window size that the usage is aggregated. If not specified, the usage is aggregated over the entire period.

Enum values:
MINUTE
HOUR
DAY
MONTH

Query meter

POST
https://dev.zuplo.com
/v3/metering/{bucketId}/meters/{meterIdOrSlug}/query

⚠️ Preview: The Metering APIs are in preview and subject to change.

Query meter › path Parameters

bucketId
​string · required

The id of the bucket. Zuplo automatically creates buckets for your project. You can find it in your Zuplo Portal under the Settings tab for your project.

meterIdOrSlug
​string · minLength: 1 · maxLength: 64 · pattern: ^[a-z0-9]+(?:_[a-z0-… · required

Query meter › Request Body

A meter query request.
clientId
​string · minLength: 1 · maxLength: 36

Client ID Useful to track progress of a query.

Example: f74e58ed-94ce-4041-ae06-cf45420451a3
from
​string · date-time

Start date-time in RFC 3339 format.

Inclusive.

Example: 2023-01-01T01:01:01.001Z
to
​string · date-time

End date-time in RFC 3339 format.

Inclusive.

Example: 2023-01-01T01:01:01.001Z
windowSize
​string · enum

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

Enum values:
MINUTE
HOUR
DAY
MONTH
Example: DAY
windowTimeZone
​string

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.

Example: UTC
Default: UTC
subject
​string[] · maxItems: 100

Filtering by multiple subjects.

Example: {"0":"subject-1","1":"subject-2"}
filterCustomerId
​string[] · maxItems: 100

Filtering by multiple customers.

Example: {"0":"id-1","1":"id-2"}
filterSubscription
​string[] · maxItems: 100

Filtering by multiple subscriptions.

Example: {"0":"subscription-1","1":"subscription-2"}
​object

Simple filter for group bys with exact match.

Example: {"model":["gpt-4-turbo","gpt-4o"],"type":["prompt"]}
​object

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

Example: {"model":{"$in":["gpt-4","gpt-4o"]},"type":{"$eq":"input"}}
groupBy
​string[] · maxItems: 100

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

Example: {"0":"model","1":"type"}

Query meter › Responses

The request has succeeded.

The result of a meter query.
​MeterQueryRow[] · required

The usage data. If no data is available, an empty array is returned.

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.

Example: 2023-01-01T01:01:01.001Z
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.

Example: 2023-01-01T01:01:01.001Z
windowSize
​string · enum

The window size that the usage is aggregated. If not specified, the usage is aggregated over the entire period.

Enum values:
MINUTE
HOUR
DAY
MONTH