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

# Create a new version for a metric

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

Create a new version for the given metric.

#### Permissions:
This endpoint requires the following permissions:
* `Metric:ModifyMetric` for the metric to create a new version for.

## Path parameters

- `organization` string, required
- `metric_id` string, required — The ID of the metric to create a new version for.

## Query parameters

- `version` integer, nullable — The version number of the new metric version. If specified, this endpoint throws an error if the next version of the metric in the database doesn't equal to the value of this parameter.

## 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

- SrcAppEndpointsMetricCreateMetricVersionRequest
  - `description` string, required
  - `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.

- SrcAppEndpointsMetricCreateMetricVersionResponse
  - `version` integer, required — Numerical version ID for the version just created. For the first version of a metric, this field will be 1.

## Other responses

- `400` — The metric value type cannot be changed between versions.
- `401` — Invalid authorization credentials.
- `403` — Missing required permissions.
- `404` — Specified organization or metric is not found.
- `409` — The next version of the metric in the database doesn't match the specified version.
- `422` — Invalid request path parameter, request body, or request query parameter failed validation.
- `429` — The user has exceeded the rate limit of 60 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)
