Billable metrics
Update a billable metric
This endpoint updates an existing billable metric representing a pricing component of your application.
PUT
/api/v1/billable_metrics/{code}
Bearer*
{
"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": "boolean",
"weighted_interval": "seconds"
}
}
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",
"value": ["us-east-1", "us-east-2", "eu-west-1"]
}
}
}'
Authorizations
Authorizationheaderrequired
string
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Path Parameters
coderequired
string
Code of the existing billable metric.
Body
application/json
billable_metricrequired
object
Response
200 - application/json
billable_metricrequired
object
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",
"value": ["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": "boolean",
"weighted_interval": "seconds"
}
}