Skip to main content
POST
Create a meter

Authorizations

Authorization
string
header
required

Your account's secret key: Authorization: Bearer sk_test_… or sk_live_…. Server-side only.

Headers

Idempotency-Key
string

A unique key per operation (a UUID works). Retrying with the same key returns the original response.

Path Parameters

productID
string
required

Product ID.

Pattern: ^prod_[0-9A-Za-z]{22}$
Example:

"prod_1d4YogBuw00jAySh5mbUpk"

Body

application/json
name
string
required

The key you will send in track() (for example, tokens). Cannot be changed later.

displayName
string
required

Name shown on invoices and in the dashboard.

unit
enum<string>
required

token, request or unit.

Available options:
token,
request,
unit
aggregation
enum<string>
default:sum

sum (default), count, unique_count, max or last.

Available options:
sum,
count
valueProperty
string | null

Event field carrying the numeric value. Required unless aggregation: "count".

Response

Meter created.

A meter: defines how usage events add up to a billable quantity.

id
string<uuid>
required
productId
string
required
Pattern: ^prod_[0-9A-Za-z]{22}$
Example:

"prod_1d4YogBuw00jAySh5mbUpk"

name
string
required

The key you send in track(). Cannot change after creation.

displayName
string
required

Name shown on invoices and in the dashboard.

unit
enum<string>
required

token, request or unit.

Available options:
token,
request,
unit
aggregation
enum<string>
required

How events aggregate: sum, count, unique_count, max or last.

Available options:
sum,
count,
unique_count,
max,
last
status
string
required
valueProperty
string | null

Event field carrying the numeric value. Unused with count.