Skip to main content
Opik Documentation

Search documentation

Type to search this documentation.

Retrieve prompt version

POST/v1/private/prompts/versions/retrieveRetrieve prompt version

Retrieve prompt version. When project_name is supplied the lookup is scoped to that project: a prompt belonging to a different project is never matched, and an unknown project name returns 404. Legacy prompts with no project are still resolved as a deprecated fallback, signalled by the X-Opik-Deprecation response header.

Request body

application/json
objectPromptVersionRetrieve_Detail
commitstring
environmentstring

If provided, resolves to the version mapped to this environment for the prompt; mutually exclusive with commit and version_number

maxLength 150 · minLength 0 · pattern ^[A-Za-z0-9_-]+$

namestringrequired

minLength 1

project_namestring

If provided, scopes the search to the specified project; prompts belonging to other projects are never matched, and an unknown project name returns 404. Legacy prompts that are not scoped to any project are still matched as a deprecated fallback, signalled by the X-Opik-Deprecation response header.

pattern (?s)^\s*(\S.*\S|\S)\s*$

version_numberstring

If provided, resolves to the version with this sequential number (e.g. v3); mutually exclusive with commit and environment

maxLength 10 · minLength 0 · pattern v\d+

Example request
{
  "commit": "string",
  "environment": "string",
  "name": "string",
  "project_name": "string",
  "version_number": "string"
}

Responses

200OKapplication/json

Headers

X-Opik-Deprecation

Present only when the prompt was resolved through the deprecated workspace-wide fallback, i.e. it has no project. Absent for project-scoped prompts.

objectPromptVersion_Detail
change_descriptionstring
commitstring

version short unique identifier, generated if absent. it must be 8 characters long

pattern ^[a-zA-Z0-9]{8}$

created_atstring · date-time
created_bystring
environmentstring

Deprecated: use 'environments' instead

maxLength 150 · minLength 0 · pattern ^[A-Za-z0-9_-]+$

environmentsarray of string

maxItems 100 · minItems 0 · uniqueItems true

Show child attributes

maxItems 100 · minItems 0 · uniqueItems true

idstring · uuid

version unique identifier, generated if absent

metadataobject
prompt_idstring · uuid
tagsarray of string

uniqueItems true

Show child attributes

uniqueItems true

templatestringrequired

minLength 1

template_structurestring

one of "text", "chat"

typestring

one of "mustache", "jinja2", "python"

variablesarray of string

uniqueItems true

Show child attributes

uniqueItems true

version_numberstring

sequential version number in the format v<N>; null for masks

version_typestring

version type discriminator; defaults to prompt_version

one of "prompt_version", "mask"

Example response
{
  "change_description": "string",
  "commit": "string",
  "created_at": "2026-06-09T00:00:00Z",
  "created_by": "string",
  "environment": "string",
  "environments": [
    "string"
  ],
  "id": "00000000-0000-0000-0000-000000000000",
  "metadata": {},
  "prompt_id": "00000000-0000-0000-0000-000000000000",
  "tags": [
    "string"
  ],
  "template": "string",
  "template_structure": "chat",
  "type": "jinja2",
  "variables": [
    "string"
  ],
  "version_number": "string",
  "version_type": "mask"
}
400Bad Requestapplication/json
objectErrorMessage_Detail
errorsarray of string
Show child attributes
Example response
{
  "errors": [
    "string"
  ]
}
404Not Foundapplication/json
objectErrorMessage_Detail
errorsarray of string
Show child attributes
Example response
{
  "errors": [
    "string"
  ]
}
422Unprocessable Contentapplication/json
objectErrorMessage_Detail
errorsarray of string
Show child attributes
Example response
{
  "errors": [
    "string"
  ]
}
Documentation menu