---
title: "Create a metric policy"
method: POST
path: "/v1/metric/policies"
tags: ["Metric Policy"]
---

# Create a metric policy

`POST /v1/metric/policies`

Creates a new metric policy. Policies define which metrics to collect and under what conditions.

## Request body

- CreateMetricPolicyInput — Input for creating a new metric policy
  - `name` string, required — Name of the metric policy
  - `status` 'ACTIVE' | 'INACTIVE' — Status of the policy (default: ACTIVE)
  - `modality` 'call' | 'chat', required — Modality this policy targets. A policy fires for exactly one modality and can only reference metrics that support that modality.
  - `conditions` object[] — Condition groups. Omit to match all calls.
    - `conditions` object[], required
      - `conditionType` 'AGENT' | 'CALL_SOURCE' | 'CALL_PROPERTY' | 'INTEGRATION', required — Type of condition: AGENT (match by agent ID), CALL_SOURCE (match by source e.g. VAPI, RETELL), CALL_PROPERTY (match by call property key/value)
      - `conditionKey` string, required — Key to match against. For AGENT: the agent ID. For CALL_SOURCE: the source name. For CALL_PROPERTY: the property key.
      - `conditionOperator` 'EQUALS' | 'NOT_EQUALS' | 'CONTAINS' | 'STARTS_WITH' | 'GREATER_THAN' | 'LESS_THAN' | 'GREATER_THAN_OR_EQUALS' | 'LESS_THAN_OR_EQUALS', nullable — Comparison operator. Required for CALL_PROPERTY conditions.
      - `conditionValue` string, nullable — Value to compare against. Required for CALL_PROPERTY conditions.
  - `metrics` object[], required — Metric definitions to collect when this policy matches
    - `id` string, uuid, required

## Response `201`

The created metric policy

- object
  - `data` MetricPolicyResponse, required — A metric policy defining when metrics should be collected
    - `id` string, uuid, required — Unique identifier of the metric policy
    - `name` string, required — Name of the metric policy
    - `type` 'SYSTEM' | 'USER', required — Type of the metric policy (SYSTEM or USER)
    - `status` 'ACTIVE' | 'INACTIVE', required — Status of the metric policy (ACTIVE or INACTIVE)
    - `conditions` object[], nullable, required — Condition groups for this policy. Null means the policy matches all calls.
      - `conditions` object[], required
        - `conditionType` 'AGENT' | 'CALL_SOURCE' | 'CALL_PROPERTY' | 'INTEGRATION', required — Type of condition: AGENT (match by agent ID), CALL_SOURCE (match by source e.g. VAPI, RETELL), CALL_PROPERTY (match by call property key/value)
        - `conditionKey` string, required — Key to match against. For AGENT: the agent ID. For CALL_SOURCE: the source name. For CALL_PROPERTY: the property key.
        - `conditionOperator` 'EQUALS' | 'NOT_EQUALS' | 'CONTAINS' | 'STARTS_WITH' | 'GREATER_THAN' | 'LESS_THAN' | 'GREATER_THAN_OR_EQUALS' | 'LESS_THAN_OR_EQUALS', nullable, required — Comparison operator. Required for CALL_PROPERTY conditions.
        - `conditionValue` string, nullable, required — Value to compare against. Required for CALL_PROPERTY conditions.
    - `metrics` object[], required — Metric definitions associated with this policy
      - `id` string, uuid, required
    - `createdAt` string, required — When the policy was created
    - `updatedAt` string, required — When the policy was last updated

## Other responses

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

---

[API](https://skmtc.net/roarkhq/apis/roark-analytics-api.md) · [All operations](https://skmtc.net/roarkhq/apis/roark-analytics-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/roarkhq/roark-analytics-api/versions/83528d3618ef/schema)
