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",
      "group": {
        "key": "provider",
        "values": ["us-east-1", "us-east-2", "eu-west-1"]
      }
    }
  }'
{
  "billable_metric": {
    "active_subscriptions_count": 4,
    "aggregation_type": "sum_agg",
    "code": "storage",
    "created_at": "2022-09-14T16:35:31Z",
    "description": "GB of storage used in my application",
    "draft_invoices_count": 10,
    "field_name": "gb",
    "group": {
      "key": "region",
      "values": [
        "us-east-1",
        "us-east-2",
        "eu-west-1"
      ]
    },
    "lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
    "name": "Storage",
    "plans_count": 4,
    "recurring": true,
    "weighted_interval": "seconds"
  }
}

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