Skip to main content
Opik Documentation

Search documentation

Type to search this documentation.

Create prompt version

POST/v1/private/prompts/versionsCreate prompt version

Create prompt version

Request body

application/json
objectCreatePromptVersion_Detail
namestringrequired

minLength 1

project_idstring · uuid

Project ID. Takes precedence over project_name when both are provided.

project_namestring

If provided, scopes the prompt to the specified project. Ignored when project_id is provided.

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

template_structurestring

Template structure for the prompt: 'text' or 'chat'. Note: This field is only used when creating a new prompt. If a prompt with the given name already exists, this field is ignored and the existing prompt's template structure is used. Template structure is immutable after prompt creation.

one of "text", "chat" · default "text"

versionobjectrequired
Show child attributes
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 request
{
  "name": "string",
  "project_id": "00000000-0000-0000-0000-000000000000",
  "project_name": "string",
  "template_structure": "text",
  "version": {
    "change_description": "string",
    "commit": "string",
    "environment": "string",
    "environments": [
      "string"
    ],
    "id": "00000000-0000-0000-0000-000000000000",
    "metadata": {},
    "tags": [
      "string"
    ],
    "template": "string",
    "type": "jinja2",
    "version_type": "mask"
  }
}

Responses

200OKapplication/json
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"
  ]
}
409Conflictapplication/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