Skip to main content
POST
Go (SDK)

Authorizations

Authorization
string
header
required

You can generate an Organization Access Token from your organization's settings.

Body

application/json
name
string
required

The name of the meter. Will be shown on customer's invoices and usage.

Minimum string length: 3
filter
Filter · object
required

The filter to apply on events that'll be used to calculate the meter.

aggregation
CountAggregation · object
required

The aggregation to apply on the filtered events to calculate the meter.

metadata
Metadata · object

Key-value object allowing you to store additional information.

The key must be a string with a maximum length of 40 characters. The value must be either:

  • A string with a maximum length of 500 characters
  • An integer
  • A floating-point number
  • A boolean

You can store up to 50 key-value pairs.

unit
enum<string>
default:scalar

The unit of the meter.

Available options:
scalar,
token,
custom
custom_label
string | null

The label for the custom unit, e.g. 'request'. Required when unit is 'custom'.

custom_multiplier
integer | null

The multiplier to convert from the base unit to display scale, e.g. 1000 to display per 1000 units. Defaults to 1 when not provided.

Required range: x > 0
organization_id
string<uuid4> | null

The organization ID.

Example:

"1dbfc517-0bbf-4301-9ba8-555ca42b9737"

Response

Meter created.

metadata
object
required
created_at
string<date-time>
required

Creation timestamp of the object.

modified_at
string<date-time> | null
required

Last modification timestamp of the object.

id
string<uuid4>
required

The ID of the object.

name
string
required

The name of the meter. Will be shown on customer's invoices and usage.

unit
enum<string>
required

The unit of the meter.

Available options:
scalar,
token,
custom
filter
Filter · object
required

The filter to apply on events that'll be used to calculate the meter.

aggregation
CountAggregation · object
required

The aggregation to apply on the filtered events to calculate the meter.

organization_id
string<uuid4>
required

The ID of the organization owning the meter.

custom_label
string | null

The label for the custom unit.

custom_multiplier
integer | null

The multiplier to convert from base unit to display scale.

archived_at
string<date-time> | null

Whether the meter is archived and the time it was archived.