Partially update a prompt template by creating a new version with merged changes. This endpoint fetches a base version (latest by default), applies your patches, validates the result, and creates a new version.
PATCH /rest/prompt-templates/{identifier}
"prod", "staging").{"0": {...}}), values are replacement message objects. Only the specified indices are updated; others are preserved.null to remove all tools.null to remove all functions.null to remove.null to remove.temperature, max_tokens). Existing keys not mentioned here are preserved.response_format in model parameters. Cannot be used simultaneously with response_format inside model_parameters. Set to null to remove.| Field | Merge Behavior |
|---|---|
messages | Object: index-based patch (update specific indices, preserve others). Array: full replacement. |
tools | Same as messages. null removes all tools. |
functions | Same as messages. null removes all functions. |
function_call | Full replacement. null removes. |
tool_choice | Full replacement. null removes. |
content | Same as messages (completion templates only). |
model_parameters | Shallow merge with existing parameters. |
response_format | Full replacement. null removes. |
release_labels | Creates or moves labels to the new version. |
| Status Code | Error |
|---|---|
| 400 | Validation error, conflicting response_format, out-of-bounds index, wrong template type, version and label both specified |
| 401 | Missing or invalid API key |
| 404 | Prompt template not found, version not found, label not found |
The prompt template name or ID.
The base version number to patch from. Mutually exclusive with label. If neither is provided, the latest version is used.
x > 0The release label identifying the base version to patch from (e.g. 'prod', 'staging'). Mutually exclusive with version.
Index-based patch. Keys are string indices (e.g. "0", "1"), values are the replacement message objects.
Patch for tools. Object for index-based patching, array for full replacement, null to remove. Chat templates only.
Patch for functions. Object for index-based patching, array for full replacement, null to remove. Chat templates only.
Replace the function_call setting. Set to null to remove. Chat templates only.
Replace the tool_choice setting. Set to null to remove. Chat templates only.
Patch for completion template content. Object for index-based patching, array for full replacement. Completion templates only.
Parameters to shallow-merge into the existing model parameters (e.g. temperature, max_tokens). Existing keys not specified here are preserved.
Convenience field to set response_format in model parameters. Cannot be used simultaneously with response_format inside model_parameters. Set to null to remove.
A message describing the changes in this version.
Release labels to create or move to the newly created version (e.g. ['staging', 'production']).
New version created successfully
The ID of the prompt template.
The name of the prompt template.
The ID of the created prompt version.
The version number of the prompt template.