---
title: "Add Metric From Library"
method: POST
path: "/api/v1/custom-metrics/library/{template_key}/add"
tags: ["custom-metrics"]
---

# Add Metric From Library

`POST /api/v1/custom-metrics/library/{template_key}/add`

Clone a curated Library template into the tenant's metrics.

Idempotent: if the tenant already has an ACTIVE metric cloned from this
template, return it unchanged (with its active revision) rather than creating
a duplicate. Otherwise create a new metric + revision 1 from the template.

## Path parameters

- `template_key` string, required

## Response `201`

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` — Library template not found
- `422` — Validation Error

## Changes

- **2026-09-03** `d65b8fefae34` — 2 info
  - added the optional property `detail/items/ctx` to the response with the `422` status
  - added the optional property `detail/items/input` to the response with the `422` status

[Change history](https://skmtc.dev/getanana/apis/cleon-api/changes/api/v1/custom-metrics/library/:template_key/add/post.md)

---

[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/a9141b6e4e7e/schema)
