Skip to main content
POST
Create a billable metric

Authorizations

Authorization
string
header
required

Tenant API key obtained from POST /auth/register or POST /v1/developer/keys.

Body

application/json
name
string
required
code
string
required

Doubles as the usage event dimension; immutable after create.

Maximum string length: 50
aggregation_type
enum<string>
required
Available options:
count,
sum,
max,
unique,
latest,
percentile,
custom,
weighted_sum
field_name
string

Required for unique (property name) and percentile (1-99); forbidden otherwise.

expression
string

Required for the custom aggregation, forbidden otherwise. A sandboxed per-event formula reading quantity and properties (e.g. quantity * properties.multiplier); results are summed.

Response

The created metric

data
object

A tenant-defined meter over usage events; code equals the event dimension it aggregates and is unique per tenant.