Skip to main content
POST
Create a billable metric

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
aggregation_type
enum<string>
required
Available options:
COUNT,
LATEST,
MAX,
MIN,
MEAN,
SUM,
COUNT_DISTINCT
code
string
required
name
string
required
product_family_id
string<MeteroidId>
required
Example:

"pf_7n42DGM5Tflk9n8mt7Fhc7"

aggregation_key
string | null
description
string | null
filters
object[] | null

Pre-aggregation property filters. Optional and backward-compatible; omit for none.

product_id
string<MeteroidId> | null
Example:

"prd_7n42DGM5Tflk9n8mt7Fhc7"

segmentation_matrix
object
unit_conversion
object | null

Converts the aggregated usage into the unit prices are set in, e.g. tokens priced per 1M. The usage is divided by factor, then rounded. Rounding applies to each priced group's total for the billing period: each group of a segmented or grouped metric, and each matrix cell, is rounded on its own, never each event.

unit_plural
string | null

What several units of the metric are called, e.g. tokens. Set together with unit_singular. Trimmed; at most 32 characters.

Example:

"tokens"

unit_singular
string | null

What one unit of the metric is called, e.g. token, used to label quantities and prices ("$12.00 per 1M tokens"). Set both unit_singular and unit_plural, or neither. Trimmed; at most 32 characters.

Example:

"token"

usage_group_key
string | null

Response

Metric created

aggregation_type
enum<string>
required
Available options:
COUNT,
LATEST,
MAX,
MIN,
MEAN,
SUM,
COUNT_DISTINCT
code
string
required
created_at
string<date-time>
required
id
string<MeteroidId>
required
Example:

"bm_7n42DGM5Tflk9n8mt7Fhc7"

name
string
required
product_family_id
string<MeteroidId>
required
Example:

"pf_7n42DGM5Tflk9n8mt7Fhc7"

aggregation_key
string | null
archived_at
string<date-time> | null
description
string | null
filters
object[]
product_id
string<MeteroidId> | null
Example:

"prd_7n42DGM5Tflk9n8mt7Fhc7"

segmentation_matrix
object
unit_conversion
object | null

Converts the aggregated usage into the unit prices are set in, e.g. tokens priced per 1M. The usage is divided by factor, then rounded. Rounding applies to each priced group's total for the billing period: each group of a segmented or grouped metric, and each matrix cell, is rounded on its own, never each event.

unit_plural
string | null

What several units of the metric are called, e.g. tokens.

unit_singular
string | null

What one unit of the metric is called, e.g. token. Set together with unit_plural.

usage_group_key
string | null