---
title: "Create a metric"
method: POST
path: "/v1/{organization}/metric/"
tags: ["Metric"]
---

# Create a metric

`POST /v1/{organization}/metric/`

Create a metric.

#### Permissions
* `Metric:CreateMetric` for the metric to create.

## Path parameters

- `organization` string, required

## Headers

- `x-mongo-cluster-name` string, nullable — The Mongo cluster name to perform this request in. This is usually not needed unless the organization does not exist yet in the Amigo organization infra config database.
- `Sec-WebSocket-Protocol` string[]

## Request body

- SrcAppEndpointsMetricCreateMetricRequest
  - `name` string, required
  - `applied_to_services` string[], required — The services that the metric is applied to.
  - `additional_notes` string, required
  - `tags` object, required — The tags of the metric.
  - `initial_version_metric_value` InitialMetricVersion, required
    - `description` string, required — The description of the metric. This tells the LLM what the metric is and how the metric result should be generated.
    - `metric_value` union, required
      - NumericalMetricValue
        - `type` 'numerical', required
        - `lower_bound` number, required
        - `upper_bound` number, required
      - CategoricalMetricValueInput
        - `type` 'categorical', required
        - `categories` AmigoLibPydanticBaseModelStrippedNonemptyString1[], required
      - BooleanMetricValue
        - `type` 'boolean', required

## Response `201`

Succeeded

- SrcAppEndpointsMetricCreateMetricResponse
  - `id` string, required — The ID of the created metric.

## Other responses

- `401` — Invalid authorization credentials.
- `403` — Missing required permissions.
- `404` — Specified organization is not found.
- `409` — A metric with this name already exists
- `422` — Invalid request path parameter or request body failed validation.
- `429` — The user has exceeded the rate limit of 100 requests per minute for this endpoint.
- `503` — The service is going through temporary maintenance.

---

[API](https://skmtc.net/amigo/apis/amigo-api.md) · [All operations](https://skmtc.net/amigo/apis/amigo-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/amigo/amigo-api/revisions/f0f28319e448/schema)
