today
Draft billable metrics in the API
You can now create billable metrics as drafts through the API, edit them, and publish them when they're ready. Previously, draft metrics were only available in the dashboard.
- Create a draft by passing
status: "draft"toPOST /v1/metrics. Metrics are still created asactiveby default. - Update a draft's
sqlanditem_idwithPUT /v1/metrics/{metric_id}. New SQL must use the same parameters as the existing SQL. - Publish a draft with the new
POST /v1/metrics/{metric_id}/publishendpoint. Published metrics can't return to draft. - The
billable_metric.editedwebhook now includesstatus,item_idandsqlinprevious_attributes. Archive and unarchive events also include the previousstatus.
Note that a metric's SQL and parameter defaults can no longer be changed once a price uses the metric, in the dashboard or the API.
Learn more about billable metrics in our docs.