PUT
/
billable_metrics
/
{code}
LAGO_URL="https://api.getlago.com"
API_KEY="__YOUR_API_KEY__"

curl --location --request PUT "$LAGO_URL/api/v1/billable_metrics/:code" \
  --header "Authorization: Bearer $API_KEY" \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "billable_metric": {
      "name": "Storage",
      "code": "storage",
      "description": "GB of storage used in my application",
      "aggregation_type": "sum_agg",
      "recurring": false,
      "field_name": "gb",
      "weighted_interval": "seconds",
      "filters": [
        {
          "key": "provider",
          "values": ["us-east-1", "us-east-2", "eu-west-1"]
        }
      ]
    }
  }'
{
  "billable_metric": {
    "lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
    "name": "Storage",
    "code": "storage",
    "description": "GB of storage used in my application",
    "recurring": true,
    "created_at": "2022-09-14T16:35:31Z",
    "field_name": "gb",
    "aggregation_type": "sum_agg",
    "weighted_interval": "seconds",
    "group": {
      "key": "region",
      "values": [
        "us-east-1",
        "us-east-2",
        "eu-west-1"
      ]
    },
    "filters": [
      {
        "key": "region",
        "values": [
          "us-east-1"
        ]
      }
    ],
    "active_subscriptions_count": 4,
    "draft_invoices_count": 10,
    "plans_count": 4
  }
}

Authorizations

Authorization
string
headerrequired

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

Path Parameters

code
string
required

Code of the existing billable metric.

Body

application/json
billable_metric
object
required

Response

200 - application/json
billable_metric
object
required