---
title: "Retrieve prompt versions by ids"
method: POST
path: "/v1/private/prompts/versions/retrieve-by-ids"
tags: ["Prompts"]
---

# Retrieve prompt versions by ids

`POST /v1/private/prompts/versions/retrieve-by-ids`

## Request

- Base URL: `http://localhost:5173/api`
- URL: `http://localhost:5173/api/v1/private/prompts/versions/retrieve-by-ids`
- Auth: none declared

Retrieve a batch of prompt versions by their ids. Typically used by the UI to resolve mask overlays.

## Request body

- PromptVersionIdsRequestDetail
  - `ids` string[], required

## Response `200`

OK

- PromptVersionDetail[]
  - `id` string, uuid: version unique identifier, generated if absent
  - `prompt_id` string, uuid
  - `commit` string: version short unique identifier, generated if absent. it must be 8 characters long
  - `version_number` string: sequential version number in the format v<N>; null for masks
  - `template` string, required
  - `metadata` JsonNodeDetail
  - `type` 'mustache' | 'jinja2' | 'python'
  - `version_type` 'prompt_version' | 'mask': version type discriminator; defaults to prompt_version
  - `environment` string: Deprecated: use 'environments' instead
  - `environments` string[]
  - `change_description` string
  - `tags` string[]
  - `variables` string[]
  - `template_structure` 'text' | 'chat'
  - `created_at` string, date-time
  - `created_by` string

## Other responses

- `400`: Bad Request

## Changes

- **2026-05-28** `f59fc1819c0c`: 1 info
  - added the optional property `items/environment` to the response with the `200` status
- **2026-05-27** `3953a50a6a0e`: 1 warning, 1 info
  - removed the optional property `items/environment` from the response with the `200` status
  - added the optional property `items/environments` to the response with the `200` status
- **2026-05-20** `a98bd55ddc1e`: 1 info
  - added the optional property `items/version_number` to the response with the `200` status
- **2026-05-19** `415a5d0ad31f`: 1 info
  - added the optional property `items/environment` to the response with the `200` status
- **2026-05-19** `f93aac27fb6e`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/comet-ml/apis/opik-rest-api/changes/v1/private/prompts/versions/retrieve-by-ids/post.md)

---

[API](https://skmtc.dev/comet-ml/apis/opik-rest-api.md) - [All operations](https://skmtc.dev/comet-ml/apis/opik-rest-api/llms.txt) - [OpenAPI document](https://skmtc.dev/comet-ml/apis/opik-rest-api/revisions/0067fada8962?raw)
