---
title: "Create a threshold on a metric"
method: POST
path: "/v1/metric/definitions/{idOrSlug}/thresholds"
tags: ["Metric"]
---

# Create a threshold on a metric

`POST /v1/metric/definitions/{idOrSlug}/thresholds`

Create a boolean threshold derived from an existing metric. The source metric is addressed by its UUID or its stable `slug`. The threshold fires when the source metric meets the comparison condition. Scope and supported contexts are inherited from the source metric.

## Path parameters

- `idOrSlug` string, required

## Request body

- CreateThresholdInput — Input for creating a new threshold derived from a source metric.
  - `slug` string — Stable slug for the metric. Auto-generated from name if omitted.
  - `metricId` string — Alias of `slug` accepted for backwards compatibility. Use `slug` for new integrations.
  - `operator` 'GREATER_THAN' | 'GREATER_THAN_OR_EQUALS' | 'LESS_THAN' | 'LESS_THAN_OR_EQUALS' | 'EQUALS' | 'NOT_EQUALS', required — Comparison operator
  - `value` string, required — Value to compare the source metric against (as a string)
  - `aggregationMode` 'EACH' | 'COUNT' | 'AVERAGE' | 'MIN' | 'MAX' | 'MEDIAN' | 'P95' | 'P99' | 'SUM' — How to aggregate the source metric before applying the comparison (default: EACH)
  - `countThreshold` integer — Required when aggregationMode is COUNT. The threshold fires when the count is met.
  - `sourceParticipantRole` 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER' — When the source metric is per-participant, restrict evaluation to this role. Only valid for sources with TURN/SEGMENT contexts.
  - `sourceVariantId` string, uuid — Variant of the source metric to use

## Response `201`

The created threshold (as a metric definition)

- object
  - `data` ThresholdMetricResponse, required
    - `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/thresholds/post.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)
