Skip to main content
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": []
}

Documentation Index

Fetch the complete documentation index at: https://docs.promptlayer.com/llms.txt

Use this file to discover all available pages before exploring further.

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

  • version and label select the base version to patch; omit both to patch from the latest version.
  • Chat template fields such as messages, tools, and functions can be patched by index with an object or fully replaced with an array.
  • Completion template content follows the same patch-or-replace behavior.
  • model_parameters are shallow-merged; existing keys not mentioned in the request are preserved.
  • release_labels are created or moved to the newly created version.

Authorizations

X-API-KEY
string
header
required

Path Parameters

identifier
string
required

The prompt template name or ID.

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.

version
integer | null

The base version number to patch from. Mutually exclusive with label. If neither is provided, the latest version is used.

Required range: x > 0
label
string | null

The release label identifying the base version to patch from (e.g. 'prod', 'staging'). Mutually exclusive with version.

messages

Index-based patch. Keys are string indices (e.g. "0", "1"), values are the replacement message objects.

tools

Patch for tools. Object for index-based patching, array for full replacement, null to remove. Chat templates only.

functions

Patch for functions. Object for index-based patching, array for full replacement, null to remove. Chat templates only.

function_call

Replace the function_call setting. Set to null to remove. Chat templates only.

tool_choice

Replace the tool_choice setting. Set to null to remove. Chat templates only.

content

Patch for completion template content. Object for index-based patching, array for full replacement. Completion templates only.

model_parameters
Model Parameters · object

Parameters to shallow-merge into existing model parameters. Existing keys not provided are preserved.

response_format
Response Format · object

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 | null

A message describing the changes in this version.

release_labels
string[] | null

Release labels to create or move to the newly created version.

Response

New version created successfully

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
prompt_template
Completion Template · object
required
external_ids
ExternalId · object[]
required

External ID mappings attached to the prompt template.

release_labels
string[] | null
metadata
Metadata · object

Metadata associated with the prompt blueprint. Supports additional custom fields beyond the model field.

commit_message
string | null