---
title: "Patch Prompt Template Version"
method: PATCH
path: "/rest/prompt-templates/{identifier}"
tags: ["rest", "prompt-templates"]
---

# Patch Prompt Template Version

`PATCH /rest/prompt-templates/{identifier}`

## Path parameters

- `identifier` string, required — The prompt template name or ID.

## Request body

- PatchPromptTemplateVersion — Request body for partially updating a prompt template by creating a new version from the latest, a specific version, or a release label.
  - `version` integer, nullable — The base version number to patch from. Mutually exclusive with `label`. If neither is provided, the latest version is used.
  - `label` string, nullable — The release label identifying the base version to patch from (e.g. 'prod', 'staging'). Mutually exclusive with `version`.
  - `messages` union — Patch for chat template messages. Object keys are message indexes for index-based patching; arrays replace all messages.
    - object — Index-based patch. Keys are string indices (e.g. "0", "1"), values are the replacement message objects.
    - unknown[] — Full replacement. Replaces all messages.
      - unknown
  - `tools` union — Patch for tools. Object for index-based patching, array for full replacement, null to remove. Chat templates only.
    - object
    - unknown[]
      - unknown
  - `functions` union — Patch for functions. Object for index-based patching, array for full replacement, null to remove. Chat templates only.
    - object
    - unknown[]
      - unknown
  - `function_call` union — Replace the function_call setting. Set to null to remove. Chat templates only.
    - string
    - object
  - `tool_choice` union — Replace the tool_choice setting. Set to null to remove. Chat templates only.
    - string
    - object
  - `content` union — Patch for completion template content. Object for index-based patching, array for full replacement. Completion templates only.
    - object
    - unknown[]
      - unknown
  - `model_parameters` object, nullable — Parameters to shallow-merge into existing model parameters. Existing keys not provided are preserved.
  - `response_format` object, nullable — Convenience field to set response_format in model parameters. Cannot be used simultaneously with response_format inside model_parameters. Set to null to remove.
  - `commit_message` string, nullable — A message describing the changes in this version.
  - `release_labels` string[], nullable — Release labels to create or move to the newly created version.

## Response `201`

New version created successfully

- CreatePromptTemplateResponse
  - `id` integer, required — The ID of the prompt template.
  - `prompt_name` string, required — The name of the prompt template.
  - `prompt_version_id` integer, required — The ID of the created prompt version.
  - `version_number` integer, required — The version number of the prompt template.
  - `tags` string[], required
  - `release_labels` string[], nullable
  - `prompt_template` union, required
    - CompletionPrompt
      - `content` union[], required
        - union
          - TextContent
            - `type` 'text'
            - `text` string, required
            - `id` string, nullable
            - `annotations` union[], nullable — Citations and references within the text (web citations, file citations, map citations, container file citations).
              - …
            - `thought_signature` string, nullable
          - ThinkingContent
            - `signature` string, nullable
            - `type` 'thinking'
            - `thinking` string, required
            - `id` string, nullable
          - CodeContent — Code content block (e.g. from code execution tools).
            - `type` 'code'
            - `code` string, required
            - `id` string, nullable
            - `container_id` string, nullable
          - ImageContent
            - `type` 'image_url'
            - `image_url` ImageURL, required
              - …
            - `image_variable` string, nullable
          - MediaContent
            - `type` 'media'
            - `media` Media, required
              - …
          - MediaVariable
            - `type` 'media_variable'
            - `name` string, required — Name of the media variable
          - OutputMediaContent — LLM-generated media output (e.g. from image generation tools).
            - `type` 'output_media'
            - `id` string, nullable
            - `url` string, required
            - `mime_type` string
            - `media_type` 'image' | 'video' | 'audio'
            - `provider_metadata` object, nullable
          - ServerToolUseContent — Server-side tool use block (e.g. web search, code execution).
            - `type` 'server_tool_use'
            - `id` string, required
            - `name` string, required
            - `input` object
          - WebSearchToolResultContent — Results from a web search tool invocation.
            - `type` 'web_search_tool_result'
            - `tool_use_id` string, required
            - `content` WebSearchResult[]
              - …
          - CodeExecutionResultContent — Result from a code execution tool.
            - `type` 'code_execution_result'
            - `output` string, required
            - `outcome` string
          - McpListToolsContent — MCP list tools response block.
            - `type` 'mcp_list_tools'
            - `id` string, nullable
            - `server_label` string
            - `tools` object[]
              - …
            - `error` union
              - …
          - McpCallContent — MCP tool call block.
            - `type` 'mcp_call'
            - `id` string, nullable
            - `name` string
            - `server_label` string
            - `arguments` string
            - `output` string, nullable
            - `error` union
              - …
            - `approval_request_id` string, nullable
          - McpApprovalRequestContent — MCP tool approval request block.
            - `type` 'mcp_approval_request'
            - `id` string, nullable
            - `name` string
            - `arguments` string
            - `server_label` string
          - McpApprovalResponseContent — MCP tool approval response block.
            - `type` 'mcp_approval_response'
            - `approval_request_id` string, required
            - `approve` boolean, required
          - BashCodeExecutionToolResultContent — Result from bash code execution tool.
            - `type` 'bash_code_execution_tool_result'
            - `tool_use_id` string, required
            - `content` object
          - TextEditorCodeExecutionToolResultContent — Result from text editor code execution tool.
            - `type` 'text_editor_code_execution_tool_result'
            - `tool_use_id` string, required
            - `content` object
          - ShellCallContent — Shell tool call block.
            - `type` 'shell_call'
            - `id` string, nullable
            - `call_id` string, nullable
            - `action` object
            - `status` string, nullable
          - ShellCallOutputContent — Shell tool output block.
            - `type` 'shell_call_output'
            - `id` string, nullable
            - `call_id` string, nullable
            - `output` object[]
              - …
            - `status` string, nullable
          - ApplyPatchCallContent — Apply patch tool call block.
            - `type` 'apply_patch_call'
            - `id` string, nullable
            - `call_id` string, nullable
            - `operation` object
            - `status` string, nullable
          - ApplyPatchCallOutputContent — Apply patch tool output block.
            - `type` 'apply_patch_call_output'
            - `id` string, nullable
            - `call_id` string, nullable
            - `output` string, nullable
            - `status` string, nullable
      - `input_variables` string[]
      - `template_format` 'f-string' | 'jinja2'
      - `type` 'completion'
    - ChatPrompt
      - `messages` union[], required
        - union
          - SystemMessage
            - `input_variables` string[]
            - `template_format` 'f-string' | 'jinja2'
            - `content` union[], required
              - …
            - `role` 'system'
            - `name` string, nullable
          - UserMessage
            - `input_variables` string[]
            - `template_format` 'f-string' | 'jinja2'
            - `content` union[], required
              - …
            - `role` 'user'
            - `name` string, nullable
          - AssistantMessage
            - `input_variables` string[]
            - `template_format` 'f-string' | 'jinja2'
            - `content` union[], nullable
              - …
            - `role` 'assistant'
            - `function_call` FunctionCall
              - …
            - `name` string, nullable
            - `tool_calls` ToolCall[], nullable
              - …
          - FunctionMessage
            - `input_variables` string[]
            - `template_format` 'f-string' | 'jinja2'
            - `content` union[], nullable
              - …
            - `role` 'function'
            - `name` string, required
          - ToolMessage
            - `input_variables` string[]
            - `template_format` 'f-string' | 'jinja2'
            - `content` union[], required
              - …
            - `role` 'tool'
            - `tool_call_id` string, required
            - `name` string, nullable
          - PlaceholderMessage
            - `input_variables` string[]
            - `template_format` 'f-string' | 'jinja2'
            - `content` union[], nullable
              - …
            - `raw_request_display_role` string
            - `role` 'placeholder'
            - `name` string, required
          - DeveloperMessage
            - `input_variables` string[]
            - `template_format` 'f-string' | 'jinja2'
            - `content` union[], required
              - …
            - `role` 'developer'
            - `name` string, nullable
      - `functions` Function[], nullable
        - `name` string, required
        - `description` string
        - `strict` boolean — Whether to enable strict schema validation for the function parameters.
        - `parameters` object
      - `tools` Tool[], nullable
        - union
          - FunctionTool — A custom function tool definition.
            - `type` 'function'
            - `function` Function, required
              - …
          - BuiltInTool — A provider-native built-in tool (e.g. web search, code interpreter, bash).
            - `id` string, required
            - `name` string, required
            - `description` string, required
            - `provider` string, required
            - `type` 'web_search' | 'file_search' | 'code_interpreter' | 'image_generation' | 'google_maps' | 'url_context' | 'mcp' | 'bash' | 'shell' | 'apply_patch' | 'text_editor', required
            - `config` object, required — Provider-specific tool configuration. Structure varies by provider and tool type.
      - `function_call` union
        - string
        - MessageFunctionCall
          - `name` string, required
      - `tool_choice` union
        - string
        - ChatToolChoice
          - `type` 'function'
          - `function` MessageFunctionCall, required
            - `name` string, required
      - `type` 'chat'
      - `input_variables` string[]
  - `metadata` Metadata — Metadata associated with the prompt blueprint. Supports additional custom fields beyond the model field.
    - `model` Model
      - `provider` string, required — The LLM provider (e.g. openai, anthropic, google, openai.azure, vertexai, mistral, cohere, amazon.bedrock, huggingface).
      - `model_config_display_name` string, nullable — Optional display name for the model configuration.
      - `base_model` string, nullable — The base model name (e.g. for fine-tuned models).
      - `name` string, required — The model name (e.g. gpt-4o, claude-sonnet-4-20250514).
      - `parameters` object — Model parameters (e.g. temperature, max_tokens, top_p).
      - `display_params` object — Display-friendly parameter values shown in the UI.
      - `api_type` string, nullable — The API type (e.g. chat.completions, responses, images). Used to select the correct API endpoint for the provider.
  - `commit_message` string, nullable
  - `external_ids` ExternalId[], required — External ID mappings attached to the prompt template.
    - `source` string, required — The external system or namespace that owns the ID.
    - `external_id` string, required — The identifier for this entity in the external system.

## Other responses

- `400` — Validation error (e.g. conflicting fields, out-of-bounds index, wrong template type)
- `401` — Unauthorized - missing or invalid API key.
- `404` — Not found - requested resource does not exist or is not accessible.
- `422` — Validation error - request parameters or body are invalid.

---

[API](https://skmtc.dev/promptlayer/apis/promptlayer-api.md) · [All operations](https://skmtc.dev/promptlayer/apis/promptlayer-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/promptlayer/promptlayer-api/revisions/a23093a0a506/schema)
