---
title: "Get metric versions"
method: GET
path: "/v1/{organization}/metric/{metric_id}/version"
tags: ["Metric"]
---

# Get metric versions

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

## Request

- Base URL: `https://api.amigo.ai`
- URL: `https://api.amigo.ai/v1/{organization}/metric/{metric_id}/version`
- Auth: HTTP bearer and API key in header `X-ORG-ID` and HTTP basic
- TypeScript: <https://skmtc.dev/amigo/apis/amigo-api/docs/v1/:organization/metric/:metric_id/version/get.ts> (a function with typed inputs; its response is checked against the schema)

Retrieve the versions of a metric.

#### Permissions
This endpoint requires the following permissions:
* `Metric:GetMetric` for the metric whose versions to retrieve.

## Path parameters

- `organization` string, required
- `metric_id` string, required: The ID of the metric to retrieve versions for.

## Query parameters

- `version` string, nullable: The versions of the metric to retrieve. One can specify an exact version to retrieve, which is either the version number or `latest`, which retrieves the latest version. Alternatively, one can specify a range of inclusive lower and upper bound for the version number separated by `-`, and every version within the range would be retrieved.
- `limit` integer: The maximum number of metric versions to return.
- `continuation_token` integer: The continuation token from the previous request used to retrieve the next page of metric versions.
- `sort_by` string[]: The fields to sort the versions by. Supported fields are `version`. Specify a `+` before the field name to indicate ascending sorting and `-` for descending sorting. Multiple fields can be specified to break ties.

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

## Response `200`

Succeeded.

- SrcAppEndpointsMetricGetMetricVersionsResponse
  - `metric_versions` MetricVersionInstance[], required: The list of retrieved metric versions.
    - `metric_id` string, required: The ID of the metric.
    - `version` integer, required: The version number of the metric.
    - `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
      - BooleanMetricValue
        - `type` 'boolean', required
      - NumericalMetricValue
        - `type` 'numerical', required
        - `lower_bound` number, required
        - `upper_bound` number, required
      - CategoricalMetricValueOutput
        - `type` 'categorical', required
        - `categories` string[], required
    - `creator` AmigoLibMongoCollectionsMetricVersionMetricVersionUserInfo, required
      - `org_id` string, required
      - `user_id` string, required
    - `created_at` string, date-time, required: The timestamp of when the metric version was created.
  - `has_more` boolean, required: Whether there are more metric versions that can be retrieved with further pagination.
  - `continuation_token` integer, nullable, required: The continuation token to be used to retrieve the next page of metric versions. This is only included if `has_more` is true.

## Other responses

- `401`: Invalid authorization credentials.
- `403`: Missing required permissions.
- `404`: Specified organization or metric is not found.
- `422`: Invalid request path parameter 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.dev/amigo/apis/amigo-api.md) - [All operations](https://skmtc.dev/amigo/apis/amigo-api/llms.txt) - [OpenAPI document](https://skmtc.dev/amigo/apis/amigo-api/revisions/fd3c06d4bc2c?raw)
