# Create or replace a metric (/api/usage-metrics/replace-usage-metric)

`PUT https://api.comecero.com/api/v1/usage/metrics/{metric_id}`

Saves the whole definition: fields you leave out are cleared (`allowed_properties` becomes empty, `status` becomes `active`). `event_key` never changes, and `aggregation` can not change once the usage meter has the metric (`409`). It answers `201` when it creates the metric: then send `name` and `unit_label` too. Secret and trusted tokens may call it; a limited token may not (`403`).

## Parameters

- `metric_id` (path, required): The metric id.

Request body: the `usage_metric_request` schema.

Responses: 200, 201, 400, 401, 403, 409, 500.

Full schemas: operation `replace_usage_metric` in /openapi.json.