---
title: "Update Custom Metric"
method: PUT
path: "/api/v1/custom-metrics/{metric_id}"
tags: ["custom-metrics"]
---

# Update Custom Metric

`PUT /api/v1/custom-metrics/{metric_id}`

Edit a custom metric.

A new revision is created ONLY when a revision-defining field
(``prompt``/``model``/``config``/``allow_na``) actually changes — that
correctly hides results produced under the old config. Metric-level metadata
(name/description/category/tags/linked agents/``applies_to_*``) is applied to
the metric row in place and never spawns a revision: every historical
``MetricResult`` joins on ``active_revision_id``, so a cosmetic edit that
repointed it would silently orphan (zero) the metric's entire history across
the logs page, widgets, drill and export. Never mutates existing revisions.

## Path parameters

- `metric_id` string, uuid, required

## Request body

- CustomMetricUpdate — Request body for PUT /custom-metrics/{id}. Creates a new revision.
  - `name` string, nullable
  - `description` string, nullable
  - `category` string, nullable
  - `tags` string[], nullable
  - `linked_agent_ids` string[], nullable
  - `applies_to_voice` boolean, nullable
  - `applies_to_text` boolean, nullable
  - `applies_to_email` boolean, nullable
  - `applies_to_booking` boolean, nullable
  - `prompt` string, nullable
  - `model` string, nullable
  - `config` object, nullable
  - `allow_na` boolean, nullable
  - `proof` string, nullable

## Response `200`

Successful Response

- CustomMetricWithRevisionResponse — Response for create/edit: the metric + its active revision.
  - `metric` CustomMetricRead, required
    - `id` string, uuid, required
    - `name` string, required
    - `description` string, nullable, required
    - `category` string, nullable, required
    - `source_template_key` string, nullable, required
    - `compute_type` 'model' | 'formula', required
    - `response_type` 'pass_fail' | 'yes_no' | 'numeric_score' | 'categorical' | 'text' | 'json', required
    - `status` 'active' | 'archived', required
    - `tags` string[], required
    - `active_revision_id` string, uuid, nullable, required
    - `linked_agent_ids` string[], required
    - `applies_to_voice` boolean, required
    - `applies_to_text` boolean, required
    - `applies_to_email` boolean, required
    - `applies_to_booking` boolean, required
    - `created_at` string, date-time, required
    - `updated_at` string, date-time, required
    - `is_booking_intent_definition` boolean, required — True when this metric is the tenant's Booking Intent classifier. Derived from the tag so the frontend never hardcodes the magic string. Set/cleared only via the dedicated designation endpoint.
  - `revision` CustomMetricRevisionRead, required
    - `id` string, uuid, required
    - `custom_metric_id` string, uuid, required
    - `revision_number` integer, required
    - `prompt` string, nullable, required
    - `model` string, nullable, required
    - `config` object, required
    - `allow_na` boolean, required
    - `created_by_user_id` string, uuid, nullable, required
    - `created_at` string, date-time, required
    - `updated_at` string, date-time, required

## Other responses

- `401` — Authentication required
- `404` — Custom metric not found
- `409` — Concurrent edit conflict
- `422` — Formula expression has not been previewed

---

[API](https://skmtc.dev/getanana/apis/cleon-api.md) · [All operations](https://skmtc.dev/getanana/apis/cleon-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/getanana/cleon-api/revisions/38166468bfc5/schema)
