Skip to main content
lago_id
string<uuid>
required

Unique identifier of the billable metric created by Lago.

Example:

"1a901a90-1a90-1a90-1a90-1a901a901a90"

name
string
required

Name of the billable metric.

Example:

"Storage"

code
string
required

Unique code used to identify the billable metric associated with the API request. This code associates each event with the correct metric.

Example:

"storage"

recurring
boolean
required

Defines if the billable metric is persisted billing period over billing period.

  • If set to true: the accumulated number of units calculated from the previous billing period is persisted to the next billing period.
  • If set to false: the accumulated number of units is reset to 0 at the end of the billing period.
  • If not defined in the request, default value is false.
Example:

false

created_at
string<date-time>
required

Creation date of the billable metric.

Example:

"2022-09-14T16:35:31Z"

aggregation_type
enum<string>
required

Aggregation method used to compute usage for this billable metric.

Available options:
count_agg,
sum_agg,
max_agg,
unique_count_agg,
weighted_sum_agg,
latest_agg
Example:

"sum_agg"

filters
object[]
required
description
string | null

Internal description of the billable metric.

Example:

"GB of storage used in my application"

rounding_function
enum<string> | null

Refers to the numeric value or mathematical expression that will be rounded based on the calculated number of billing units. Possible values are round, ceil and floor.

Available options:
ceil,
floor,
round,
null
Example:

"round"

rounding_precision
integer | null

Specifies the number of decimal places to which the rounding_function will be rounded. It can be a positive or negative value.

Example:

2

expression
string | null

Expression used to calculate the event units. The expression is evaluated for each event and the result is then used to calculate the total aggregated units.

Example:

"round((event.properties.ended_at - event.properties.started_at) * event.properties.units)"

field_name
string | null

Property of the billable metric used for aggregating usage data. This field is not required for count_agg.

Example:

"gb"

weighted_interval
enum<string> | null

Parameter exclusively utilized in conjunction with the weighted_sum_agg aggregation type. It serves to adjust the aggregation result by assigning weights and proration to the result based on time intervals.

Available options:
seconds,
null
Example:

"seconds"