Create a metric
Creates one thing you count. Call it from your server with a secret token. Secret and trusted tokens may call it; a limited token may not (403).
AuthorizationBearer <token>A secret, trusted or limited token. See Authentication.
A metric.
application/json- body
metric_id?stringOptional. Defaults to a new id.
name*stringRequired.
event_key?stringThe metric_key your app sends. 1 to 64 of a-z 0-9 _ . -, unique in the account and mode, and it never changes. Defaults to name, which fails for most names (for example "AI tokens"), so send it.
unit_label*stringRequired.
aggregation*stringRequired.
"sum""gauge"allowed_properties?array<string>Up to 20 property names.
status?stringDefaults to active.
"active""archived"billing_region?stringBilling region. Defaults to us.
"us""uk""eu"Success.
application/json- response
One thing you count and bill for. See https://docs.comecero.com/docs/usage-billing/metrics-and-aggregations
object?stringAlways metric.
metric_id?stringYour id, or met_ plus 32 characters.
name?stringShown on invoice lines.
event_key?stringThe metric_key usage events use. 1 to 64 of a-z 0-9 _ . -. Unique in the account and mode. Never changes.
unit_label?stringFor example token. Shown on invoice lines.
aggregation?stringsum adds up quantities. gauge keeps the highest reading of each hour and bills the highest hour.
"sum""gauge"allowed_properties?array<string>Up to 20 property names (1 to 64 of A-Z a-z 0-9 _) events may carry.
status?stringThe usage meter refuses events for archived metrics.
"active""archived"version?integerGoes up on every change.
synced_version?integerThe version the usage meter has.
aggregation_locked?booleantrue once the usage meter has the metric. aggregation can't change after that.
billing_region?stringBilling region. Defaults to us.
"us""uk""eu"test?booleanTest or live.
account_id?stringThe account.
date_created?stringWhen it was created.
date-timedate_modified?stringWhen it last changed.
date-timecurl -X POST 'https://api.comecero.com/api/v1/usage/metrics' \ -H 'Content-Type: application/json' \ -d '{ "metric_id": "met_ai_tokens", "name": "AI tokens", "event_key": "ai_tokens", "unit_label": "token", "aggregation": "sum", "allowed_properties": [ "model" ]}'{ "object": "metric", "metric_id": "met_ai_tokens", "name": "AI tokens", "event_key": "ai_tokens", "unit_label": "token", "aggregation": "sum", "allowed_properties": [ "model" ], "status": "active", "version": 1, "synced_version": 1, "aggregation_locked": true, "billing_region": "us", "test": false, "account_id": "AB1234", "date_created": "2026-11-01T09:00:00Z", "date_modified": "2026-11-01T09:00:00Z"}