---
title: "Update a metric definition"
method: PUT
path: "/v1/metric/definitions/{idOrSlug}"
tags: ["Metric"]
---

# Update a metric definition

`PUT /v1/metric/definitions/{idOrSlug}`

Update the editable subset of a custom metric definition, addressed by its UUID or its stable `slug`. Only the supplied fields are changed; omitted fields are left unchanged. Every update creates a new immutable version; the response carries the advanced `versionId`. System metrics and immutable fields (scope, outputType, calcType, …) are rejected. Which fields are editable depends on the metric (e.g. derived metrics only allow `name`).

## Path parameters

- `idOrSlug` string, required

## Request body

- UpdateMetricDefinitionInput — Editable subset of a metric definition. Every update creates a new immutable version. Immutable fields (slug, scope, outputType, calcType, …) are rejected with a 400.
  - `name` string — New name (only for metrics whose name is editable)
  - `llmPrompt` string — New LLM prompt (only for LLM_JUDGE metrics whose prompt is editable)
  - `scaleMin` integer — New scale minimum (SCALE output only)
  - `scaleMax` integer — New scale maximum (SCALE output only)
  - `scaleLabels` object[] — Replacement set of scale-range labels (SCALE output only)
    - `rangeMin` number, required — Minimum value for this label range
    - `rangeMax` number, required — Maximum value for this label range
    - `label` string, required — Label for this range
    - `description` string — Description of what this range means
    - `displayOrder` integer, required — Display order of this label
    - `colorHex` string — Hex color code for this label (e.g. "#FF0000")
  - `booleanTrueLabel` string — New label for the true case (BOOLEAN output only)
  - `booleanFalseLabel` string — New label for the false case (BOOLEAN output only)
  - `classificationOptions` object[] — Replacement set of classification options (CLASSIFICATION output only)
    - `label` string, required
    - `description` string, required
    - `displayOrder` integer, required
  - `maxClassifications` integer — New maximum number of classifications (CLASSIFICATION output only)
  - `toolDefinitionIds` string[] — Replacement set of scoped tool-definition ids (only for metrics whose tool scoping is editable)
  - `supportedContexts` string[] — Replacement set of supported contexts. Omit to leave unchanged.
  - `formula` string — New formula expression (FORMULA only). Pass `sources` alongside if the referenced metrics change.
  - `sources` object[] — Replacement formula sources, required when `formula` changes the referenced metrics (FORMULA only).
    - `sourceMetricDefinitionId` string, uuid, required — ID of a metric referenced in the formula
    - `sourceVariantId` string, uuid — Variant of the source metric to use
  - `changeReason` string — Optional free-text audit note recorded on the new version.
  - `slug` unknown
  - `metricId` unknown
  - `source` unknown
  - `organizationId` unknown
  - `projectId` unknown
  - `outputType` unknown
  - `scope` unknown
  - `participantRole` unknown
  - `calcType` unknown
  - `supportsMultipleVariants` unknown
  - `analysisPackageId` unknown

## Response `200`

The updated metric definition (with `versionId` advanced to the new version)

- object
  - `data` union, required — The updated metric definition. The variant is selected by `calculationType`.
    - LlmJudgeMetricResponse
      - `id` string, uuid, required — Unique identifier for the metric definition
      - `slug` string, required — Stable metric slug (e.g. "call_reason", "customer_satisfaction")
      - `metricId` string, required — Alias of `slug` retained for backwards compatibility. Same value as `slug`.
      - `variantId` string, uuid, required — The resolved variant this response reflects (org-scoped Default if the org has customized it, otherwise the system Default). Pass this as sourceVariantId when building a derived metric off this one to pin the exact config.
      - `versionId` string, uuid, required — The variant's current version. Immutable snapshot of the config — editing the metric produces a new versionId. Use it to detect config changes.
      - `name` string, required — Name of the metric
      - `description` string, required — Description of what the metric measures
      - `type` 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET', required — Type of value this metric produces
      - `scope` 'GLOBAL' | 'PER_PARTICIPANT', required — Whether metric is global or per-participant
      - `supportedContexts` string[], required — Which levels this metric can produce values at
      - `unit` object — Unit information if applicable
        - `name` string, required — Name of the unit
        - `symbol` string, nullable, required — Symbol for the unit
      - `calculationType` 'LLM_JUDGE', required — Metric evaluated by an LLM against a prompt.
    - FormulaMetricResponse
      - `id` string, uuid, required — Unique identifier for the metric definition
      - `slug` string, required — Stable metric slug (e.g. "call_reason", "customer_satisfaction")
      - `metricId` string, required — Alias of `slug` retained for backwards compatibility. Same value as `slug`.
      - `variantId` string, uuid, required — The resolved variant this response reflects (org-scoped Default if the org has customized it, otherwise the system Default). Pass this as sourceVariantId when building a derived metric off this one to pin the exact config.
      - `versionId` string, uuid, required — The variant's current version. Immutable snapshot of the config — editing the metric produces a new versionId. Use it to detect config changes.
      - `name` string, required — Name of the metric
      - `description` string, required — Description of what the metric measures
      - `type` 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET', required — Type of value this metric produces
      - `scope` 'GLOBAL' | 'PER_PARTICIPANT', required — Whether metric is global or per-participant
      - `supportedContexts` string[], required — Which levels this metric can produce values at
      - `unit` object — Unit information if applicable
        - `name` string, required — Name of the unit
        - `symbol` string, nullable, required — Symbol for the unit
      - `calculationType` 'FORMULA', required — Metric computed by evaluating an expression over other metrics.
      - `formula` FormulaMetricDetails, required
        - `expression` string, required
        - `sources` object[], required
          - `sourceMetricDefinitionId` string, uuid, required
          - `sourceVariantId` string, uuid, nullable, required
    - PatternMetricResponse
      - `id` string, uuid, required — Unique identifier for the metric definition
      - `slug` string, required — Stable metric slug (e.g. "call_reason", "customer_satisfaction")
      - `metricId` string, required — Alias of `slug` retained for backwards compatibility. Same value as `slug`.
      - `variantId` string, uuid, required — The resolved variant this response reflects (org-scoped Default if the org has customized it, otherwise the system Default). Pass this as sourceVariantId when building a derived metric off this one to pin the exact config.
      - `versionId` string, uuid, required — The variant's current version. Immutable snapshot of the config — editing the metric produces a new versionId. Use it to detect config changes.
      - `name` string, required — Name of the metric
      - `description` string, required — Description of what the metric measures
      - `type` 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET', required — Type of value this metric produces
      - `scope` 'GLOBAL' | 'PER_PARTICIPANT', required — Whether metric is global or per-participant
      - `supportedContexts` string[], required — Which levels this metric can produce values at
      - `unit` object — Unit information if applicable
        - `name` string, required — Name of the unit
        - `symbol` string, nullable, required — Symbol for the unit
      - `calculationType` 'PATTERN', required — Metric detecting a trigger condition followed by an outcome within a window.
      - `pattern` PatternMetricDetails, required
        - `operation` 'PATTERN_EXISTS' | 'PATTERN_COUNT' | 'OUTCOME_AGGREGATE', required
        - `windowMode` string, nullable, required
        - `triggerCombinator` 'AND' | 'OR', nullable, required
        - `triggers` object[], required
          - `sourceMetricDefinitionId` string, uuid, required
          - `operator` 'GREATER_THAN' | 'GREATER_THAN_OR_EQUALS' | 'LESS_THAN' | 'LESS_THAN_OR_EQUALS' | 'EQUALS' | 'NOT_EQUALS', required
          - `thresholdValue` string, required
          - `sourceParticipantRole` 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER', nullable, required
          - `sourceVariantId` string, uuid, nullable, required
        - `outcome` object, nullable, required
          - `sourceMetricDefinitionId` string, uuid, required
          - `operator` 'GREATER_THAN' | 'GREATER_THAN_OR_EQUALS' | 'LESS_THAN' | 'LESS_THAN_OR_EQUALS' | 'EQUALS' | 'NOT_EQUALS', required
          - `thresholdValue` string, required
          - `sourceParticipantRole` 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER', nullable, required
          - `sourceVariantId` string, uuid, nullable, required
          - `windowBefore` integer, nullable, required
          - `windowAfter` integer, nullable, required
    - ThresholdMetricResponse
      - `id` string, uuid, required — Unique identifier for the metric definition
      - `slug` string, required — Stable metric slug (e.g. "call_reason", "customer_satisfaction")
      - `metricId` string, required — Alias of `slug` retained for backwards compatibility. Same value as `slug`.
      - `variantId` string, uuid, required — The resolved variant this response reflects (org-scoped Default if the org has customized it, otherwise the system Default). Pass this as sourceVariantId when building a derived metric off this one to pin the exact config.
      - `versionId` string, uuid, required — The variant's current version. Immutable snapshot of the config — editing the metric produces a new versionId. Use it to detect config changes.
      - `name` string, required — Name of the metric
      - `description` string, required — Description of what the metric measures
      - `type` 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET', required — Type of value this metric produces
      - `scope` 'GLOBAL' | 'PER_PARTICIPANT', required — Whether metric is global or per-participant
      - `supportedContexts` string[], required — Which levels this metric can produce values at
      - `unit` object — Unit information if applicable
        - `name` string, required — Name of the unit
        - `symbol` string, nullable, required — Symbol for the unit
      - `calculationType` 'THRESHOLD', required — Boolean metric derived by comparing a source metric against a threshold.
      - `threshold` ThresholdMetricDetails
        - `sourceMetricDefinitionId` string, uuid, required
        - `operator` 'GREATER_THAN' | 'GREATER_THAN_OR_EQUALS' | 'LESS_THAN' | 'LESS_THAN_OR_EQUALS' | 'EQUALS' | 'NOT_EQUALS', required
        - `thresholdValue` string, required
        - `aggregationMode` 'EACH' | 'COUNT' | 'AVERAGE' | 'MIN' | 'MAX' | 'MEDIAN' | 'P95' | 'P99' | 'SUM', required
        - `countThreshold` integer, nullable, required
        - `sourceParticipantRole` 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER', nullable, required
        - `sourceVariantId` string, uuid, nullable, required

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `403` — Forbidden
- `404` — Not Found
- `429` — Too Many Requests
- `500` — Internal Server Error

## Changes

- **2026-08-17** `887b091b3d81` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/roarkhq/apis/roark-analytics-api/changes/v1/metric/definitions/:idOrSlug/put.md)

---

[API](https://skmtc.dev/roarkhq/apis/roark-analytics-api.md) · [All operations](https://skmtc.dev/roarkhq/apis/roark-analytics-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/roarkhq/roark-analytics-api/revisions/1d61b68e9429/schema)
