billable_metrics

Update a billable metric

Changed on

This endpoint updates an existing billable metric representing a pricing component of your application.

Once the billable metric is used by a plan charge, only name, description and filters are applied. The other fields are ignored.

put/billable_metrics/{code}

Request

Request body

Example request

{
  "billable_metric": {
    "name": "Storage",
    "code": "storage",
    "description": "GB of storage used in my application",
    "expression": "round((event.properties.ended_at - event.properties.started_at) * event.properties.units)",
    "rounding_function": "round",
    "rounding_precision": 2,
    "field_name": "gb",
    "aggregation_type": "sum_agg",
    "weighted_interval": "seconds",
    "filters": [
      {
        "key": "region",
        "values": [
          "us-east-1"
        ]
      }
    ]
  }
}

Response

Billable metric updated

Example response

{
  "billable_metric": {
    "lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
    "name": "Storage",
    "code": "storage",
    "description": "GB of storage used in my application",
    "rounding_function": "round",
    "rounding_precision": 2,
    "created_at": "2022-09-14T16:35:31Z",
    "expression": "round((event.properties.ended_at - event.properties.started_at) * event.properties.units)",
    "field_name": "gb",
    "aggregation_type": "sum_agg",
    "weighted_interval": "seconds",
    "filters": [
      {
        "key": "region",
        "values": [
          "us-east-1"
        ]
      }
    ]
  }
}

Changes

    • info

      the response property / became required for the status

    • info

      the response property / became required for the status

    • info

      the response property / became required for the status

    • info

      the response property / became required for the status

    • info

      the response property / became required for the status

    • info

      the response property / became required for the status

    • breaking

      the response property / became nullable for the status

    • info

      the response property / became required for the status