---
title: "Create a prompt version"
method: POST
path: "/api/prompts/{prompt_id}/versions/"
tags: ["Prompts"]
---

# Create a prompt version

`POST /api/prompts/{prompt_id}/versions/`

## Request

- Base URL: `https://api.respan.ai`
- URL: `https://api.respan.ai/api/prompts/{prompt_id}/versions/`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer

Use `{{variable_name}}` syntax in messages to define template variables. The new version becomes the prompt's current draft, and every earlier version becomes read-only. To deploy it, commit it, then use Deploy a prompt version.

## Path parameters

- `prompt_id` string, required

## Request body

- object
  - `description` string: Version description.
  - `messages` object[], required: Non-empty message array. Each message requires `role`; `content` may be omitted, an empty string, `null`, or an empty array.
    - `role` string, required
    - `content` union
      - string, nullable
      - unknown[]
        - unknown
  - `thinking` object, nullable: Optional provider-specific reasoning configuration.
  - `model` string: Primary model for this version.
  - `stream` boolean: Whether to stream responses.
  - `temperature` number: Sampling temperature (0-2).
  - `max_tokens` integer: Maximum tokens to generate.
  - `top_p` number: Nucleus sampling parameter.
  - `frequency_penalty` number: Frequency penalty (-2 to 2).
  - `presence_penalty` number: Presence penalty (-2 to 2).
  - `reasoning_effort` string, nullable
  - `verbosity` string, nullable
  - `seed` integer, nullable
  - `variables` object: Template variables and their default values.
  - `fallback_models` string[]: Fallback models if the primary model fails.
  - `load_balance_models` object[]: Weighted load-balancing model configuration.
  - `tools` object[]: Tools available to the model.
  - `tool_choice` union
    - string, nullable
    - object
  - `response_format` object, nullable: Structured output / response format configuration.
  - `json_schema` object, nullable: JSON schema used for structured outputs when configured.
  - `is_enforcing_response_format` boolean: Whether to strictly enforce the response format.

## Response `201`

Prompt version created successfully.

- object
  - `id` string
  - `prompt_version_id` string
  - `version` integer
  - `description` string, nullable
  - `messages` object[]
  - `thinking` object, nullable
  - `model` string
  - `stream` boolean
  - `temperature` number, nullable
  - `max_tokens` integer, nullable
  - `top_p` number, nullable
  - `frequency_penalty` number, nullable
  - `presence_penalty` number, nullable
  - `reasoning_effort` string, nullable
  - `verbosity` string, nullable
  - `seed` integer, nullable
  - `variables` object
  - `fallback_models` string[], nullable
  - `load_balance_models` object[], nullable
  - `tools` object[], nullable
  - `tool_choice` union
    - string, nullable
    - object
  - `response_format` object, nullable
  - `json_schema` object, nullable
  - `is_enforcing_response_format` boolean
  - `readonly` boolean
  - `edited_by` object
    - `id` integer
    - `email` string
    - `first_name` string
    - `last_name` string
  - `created_at` string, date-time
  - `updated_at` string, date-time

## Other responses

- `400`: Validation failed.
- `403`: The API key is missing, invalid or expired.
- `404`: Prompt not found

## Changes

- **2026-10-21** `c30bcb383ee8`: 33 breaking, 20 info
  - request body became required
  - the `messages` request property's minItems was increased to `1`
  - removed `#/components/schemas/ApiPromptsPromptIdVersionsPostRequestBodyContentApplicationJsonSchemaJsonSchema, subschema #2` from the `json_schema` request property `oneOf` list
  - removed `#/components/schemas/ApiPromptsPromptIdVersionsPostRequestBodyContentApplicationJsonSchemaResponseFormat, subschema #2` from the `response_format` request property `oneOf` list
  - …49 more
- **2026-10-02** `b830b79cfd52`: 4 warning, 3 info
  - removed the request property `deploy`
  - removed the optional property `error` from the response with the `400` status
  - removed the optional property `error` from the response with the `404` status
  - removed the optional property `is_deployed` from the response with the `201` status
  - …3 more
- **2026-09-17** `6fa8242da8c2`: 1 warning, 1 info
  - deleted the `header` request parameter `Authorization`
  - the endpoint scheme security `RespanApiKey` was added to the API
- **2026-09-12** `22b868ef3f22`: 1 info
  - api operation id `create-prompt-version` removed and replaced with `prompts_createPromptVersion`
- …earlier changes not shown

[Operation history](https://skmtc.dev/keywordsai/apis/respan-api/changes/api/prompts/:prompt_id/versions/post.md)

---

[API](https://skmtc.dev/keywordsai/apis/respan-api.md) - [All operations](https://skmtc.dev/keywordsai/apis/respan-api/llms.txt) - [OpenAPI document](https://skmtc.dev/keywordsai/apis/respan-api/revisions/900841387635?raw)
