ZuploZuplo
LoginStart for Free
  • Documentation
  • API Reference
Information
Analytics
    Get recent requests for a given deployment in the last 24 hoursgetGet statistics on requests by status code for a given deploymentget
API Keys - Buckets
    Lists bucketsgetCreates a bucketpostGets a bucketgetDeletes a bucketdeleteUpdates a bucketpatch
API Keys - Consumers
    Lists consumersgetCreates a consumerpostGets a consumergetDeletes a consumerdeleteUpdates a consumerpatchRoll consumer keyspost
API Keys - Keys
    Lists keysgetCreates an API keypostCreates multiple API keyspostGets an API keygetDeletes an API keydeleteUpdates an API keypatch
API Keys - Managers
    Lists managersgetCreates a managerpostDeletes a managerdelete
Audit Logs
    Query audit logsget
Build Logs
    Get build logsget
Client mTLS CA Certificates
    List Client mTLS CA CertificatesgetCreate Client mTLS CA CertificatepostDelete Client mTLS CA CertificatedeleteUpdate Client mTLS CA Certificatepatch
Custom Domains
    Get Custom DomainsgetCreate Custom DomainpostDelete a Custom DomaindeleteUpdate a Custom Domainpatch
Deployments
    Gets a deployment statusgetLists deploymentsgetUpload deployment sourcepostGet a deploymentgetDeletes a deploymentdeleteRe-deploy a deploymentpost
Environments
    Query environmentsgetGet an environmentget
MCP Servers
    API MCP ServerpostDocs MCP Serverpost
Metering - Features
    List featuresgetCreate featurepostGet featuregetDelete featuredelete
Metering - Meters
    List metersgetCreate meterpostGet metergetUpdate meterputDelete meterdeleteList meter group by valuesgetQuery metergetQuery meterpost
Metering - Plans
    List plansgetCreate a planpostGet plangetUpdate a planputDelete plandeleteArchive plan versionpostPublish planpost
Projects
    Create projectpost
Runtime Logs
    List request logsgetGet request log detailget
Tunnel Services
    Gets a provisioning statusgetGets a service configurationgetConfigures tunnel servicesput
Tunnels
    Lists tunnelsgetCreates a tunnelpostGets a tunnelgetDeletes a tunneldeleteRotates the tokenpostGets a teardown statusget
Variables
    Creates a variablepostUpdates a variablepatch
Other endpoints
    OpenAPI SpecificationgetLists accountsgetLists projectsgetWho Am Iget
Schemas
powered by Zudoku
Zuplo Developer API
Zuplo Developer API

Metering - Meters


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.

​Meter[]
A meter is a configuration that defines how to match and aggregate events.
Meter
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/v3/metering/{bucketId}/meters
curl https://dev.zuplo.com/v3/metering/:bucketId/meters
Example Responses
[ { "id": "01G65Z755AFWAKHE12NY0CQ9FH", "slug": "tokens_total", "name": "Tokens Total", "description": "AI Token Usage", "aggregation": "SUM", "eventType": "prompt", "valueProperty": "$.tokens", "groupBy": { "model": "$.model", "type": "$.type" }, "createdAt": "2024-01-01T01:01:01.001Z", "updatedAt": "2024-01-01T01:01:01.001Z" } ]
json
application/json

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.
MeterCreate
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.
Meter
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"}
POST/v3/metering/{bucketId}/meters
curl https://dev.zuplo.com/v3/metering/:bucketId/meters \ --request POST \ --header 'Content-Type: application/json' \ --data '{ "slug": "tokens_total", "name": "Tokens Total", "description": "AI Token Usage", "aggregation": "SUM", "eventType": "prompt", "valueProperty": "$.tokens", "groupBy": { "model": "$.model", "type": "$.type" } }'
Example Request Body
{ "slug": "tokens_total", "name": "Tokens Total", "description": "AI Token Usage", "aggregation": "SUM", "eventType": "prompt", "valueProperty": "$.tokens", "groupBy": { "model": "$.model", "type": "$.type" } }
json
Example Responses
{ "id": "01G65Z755AFWAKHE12NY0CQ9FH", "slug": "tokens_total", "name": "Tokens Total", "description": "AI Token Usage", "aggregation": "SUM", "eventType": "prompt", "valueProperty": "$.tokens", "groupBy": { "model": "$.model", "type": "$.type" }, "createdAt": "2024-01-01T01:01:01.001Z", "updatedAt": "2024-01-01T01:01:01.001Z" }
json
application/json

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.
Meter
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/v3/metering/{bucketId}/meters/{meterIdOrSlug}
curl https://dev.zuplo.com/v3/metering/:bucketId/meters/:meterIdOrSlug
Example Responses
{ "id": "01G65Z755AFWAKHE12NY0CQ9FH", "slug": "tokens_total", "name": "Tokens Total", "description": "AI Token Usage", "aggregation": "SUM", "eventType": "prompt", "valueProperty": "$.tokens", "groupBy": { "model": "$.model", "type": "$.type" }, "createdAt": "2024-01-01T01:01:01.001Z", "updatedAt": "2024-01-01T01:01:01.001Z" }
json
application/json

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.
MeterUpdate
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.
Meter
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"}
PUT/v3/metering/{bucketId}/meters/{meterIdOrSlug}
curl https://dev.zuplo.com/v3/metering/:bucketId/meters/:meterIdOrSlug \ --request PUT \ --header 'Content-Type: application/json' \ --data '{ "name": "Tokens Total", "description": "AI Token Usage", "groupBy": { "model": "$.model", "type": "$.type" } }'
Example Request Body
{ "name": "Tokens Total", "description": "AI Token Usage", "groupBy": { "model": "$.model", "type": "$.type" } }
json
Example Responses
{ "id": "01G65Z755AFWAKHE12NY0CQ9FH", "slug": "tokens_total", "name": "Tokens Total", "description": "AI Token Usage", "aggregation": "SUM", "eventType": "prompt", "valueProperty": "$.tokens", "groupBy": { "model": "$.model", "type": "$.type" }, "createdAt": "2024-01-01T01:01:01.001Z", "updatedAt": "2024-01-01T01:01:01.001Z" }
json
application/json

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
DELETE/v3/metering/{bucketId}/meters/{meterIdOrSlug}
curl https://dev.zuplo.com/v3/metering/:bucketId/meters/:meterIdOrSlug \ --request DELETE
Example Responses
No example specified for this content type

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[]
GET/v3/metering/{bucketId}/meters/{meterIdOrSlug}/group-by/{groupByKey}/values
curl https://dev.zuplo.com/v3/metering/:bucketId/meters/:meterIdOrSlug/group-by/:groupByKey/values
Example Responses
[ "string" ]
json
application/json

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.
MeterQueryResult
​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
GET/v3/metering/{bucketId}/meters/{meterIdOrSlug}/query
curl https://dev.zuplo.com/v3/metering/:bucketId/meters/:meterIdOrSlug/query
Example Responses
{ "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" } } ] }
json

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.
MeterQueryRequest
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.
MeterQueryResult
​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
POST/v3/metering/{bucketId}/meters/{meterIdOrSlug}/query
curl https://dev.zuplo.com/v3/metering/:bucketId/meters/:meterIdOrSlug/query \ --request POST \ --header 'Content-Type: application/json' \ --data '{ "clientId": "f74e58ed-94ce-4041-ae06-cf45420451a3", "from": "2023-01-01T01:01:01.001Z", "to": "2023-01-01T01:01:01.001Z", "windowSize": "DAY", "windowTimeZone": "UTC", "subject": { "0": "subject-1", "1": "subject-2" }, "filterCustomerId": { "0": "id-1", "1": "id-2" }, "filterSubscription": { "0": "subscription-1", "1": "subscription-2" }, "filterGroupBy": { "model": [ "gpt-4-turbo", "gpt-4o" ], "type": [ "prompt" ] }, "advancedMeterGroupByFilters": { "model": { "$in": [ "gpt-4", "gpt-4o" ] }, "type": { "$eq": "input" } }, "groupBy": { "0": "model", "1": "type" } }'
Example Request Body
{ "clientId": "f74e58ed-94ce-4041-ae06-cf45420451a3", "from": "2023-01-01T01:01:01.001Z", "to": "2023-01-01T01:01:01.001Z", "windowSize": "DAY", "windowTimeZone": "UTC", "subject": { "0": "subject-1", "1": "subject-2" }, "filterCustomerId": { "0": "id-1", "1": "id-2" }, "filterSubscription": { "0": "subscription-1", "1": "subscription-2" }, "filterGroupBy": { "model": [ "gpt-4-turbo", "gpt-4o" ], "type": [ "prompt" ] }, "advancedMeterGroupByFilters": { "model": { "$in": [ "gpt-4", "gpt-4o" ] }, "type": { "$eq": "input" } }, "groupBy": { "0": "model", "1": "type" } }
json
Example Responses
{ "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" } } ] }
json
application/json

Metering - FeaturesMetering - Plans