curl --request PATCH \
--url https://api.promptlayer.com/rest/prompt-templates/{identifier} \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"messages": {
"0": {
"role": "system",
"content": [
{
"type": "text",
"text": "You are a helpful assistant."
}
]
}
},
"commit_message": "Updated system message"
}
'{
"id": 17,
"prompt_name": "support-response",
"prompt_version_id": 109,
"version_number": 5,
"tags": [],
"release_labels": [
"staging"
],
"prompt_template": {
"type": "chat",
"messages": [
{
"role": "system",
"content": [
{
"type": "text",
"text": "You are a helpful assistant."
}
]
}
]
},
"metadata": null,
"commit_message": "Updated system message",
"external_ids": []
}{
"success": false,
"message": "<string>",
"error": "<string>"
}{
"success": false,
"message": "<string>",
"error": "<string>"
}{
"success": false,
"message": "<string>",
"error": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Prompt Templates
Patch Prompt Template Version
PATCH
/
rest
/
prompt-templates
/
{identifier}
curl --request PATCH \
--url https://api.promptlayer.com/rest/prompt-templates/{identifier} \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"messages": {
"0": {
"role": "system",
"content": [
{
"type": "text",
"text": "You are a helpful assistant."
}
]
}
},
"commit_message": "Updated system message"
}
'{
"id": 17,
"prompt_name": "support-response",
"prompt_version_id": 109,
"version_number": 5,
"tags": [],
"release_labels": [
"staging"
],
"prompt_template": {
"type": "chat",
"messages": [
{
"role": "system",
"content": [
{
"type": "text",
"text": "You are a helpful assistant."
}
]
}
]
},
"metadata": null,
"commit_message": "Updated system message",
"external_ids": []
}{
"success": false,
"message": "<string>",
"error": "<string>"
}{
"success": false,
"message": "<string>",
"error": "<string>"
}{
"success": false,
"message": "<string>",
"error": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Partially update a prompt template by creating a new version from an existing base version. Use this endpoint to change selected prompt fields, model parameters, release labels, or version metadata without resending the full template.
Behavior Notes
versionandlabelselect the base version to patch; omit both to patch from the latest version.- Chat template fields such as
messages,tools, andfunctionscan be patched by index with an object or fully replaced with an array. - Completion template
contentfollows the same patch-or-replace behavior. model_parametersare shallow-merged; existing keys not mentioned in the request are preserved.release_labelsare created or moved to the newly created version.
Related
Body
application/json
Request body for partially updating a prompt template by creating a new version from the latest, a specific version, or a release label.
Response
New version created successfully
Was this page helpful?

