Create or Update Prompt Version
Endpoint: POST /api/prompts/{name}
Creates a new prompt template or saves to a specific version of an existing one. Supports explicit version targeting or automatic version incrementing.
Note
If neither version nor autoIncrement=true is specified, this endpoint always targets version 1, overwriting it. For general-purpose prompt creation and updates, use PUT /api/prompts/{name} instead.
Path parameters
| Parameter | Description | Type | Required/ Optional |
|---|---|---|---|
| name | The name of the prompt to create or update. | string | Required. |
Query parameters
| Parameter | Description | Type | Required/ Optional |
|---|---|---|---|
| description | A description for the prompt. | string | Required. |
| models | The AI model to associate with this prompt, in the format integrationName:modelName. The specified integration must exist and the caller must have access to it. | string | Optional. |
| version | Explicit version number to save. Ignored if autoIncrement=true. | integer | Optional. |
| autoIncrement | When true, automatically sets the version to the current latest version + 1. If no versions exist yet, defaults to version 1. | boolean | Optional. |
Request body
The prompt text is to be supplied as a raw string. Enclosing quotation marks are stripped automatically.
Response
- Returns 200 OK with no response body on success.
- Returns 401 if authentication is required.
- Returns 403 if the caller does not have UPDATE permission on the existing prompt.
- Returns 404 if a specified integration does not exist.
Behavior
- Version resolution follows this priority order:
- If
autoIncrement=true, it useslatestVersion + 1(or 1 if no versions exist yet). - If
versionis provided, it uses that explicit version number. - Otherwise, it defaults to version 1 (overwrites existing version 1 without preserving metadata).
- If
- Create vs. Update: If no version of the prompt exists under
name, a new prompt is created and the caller is granted full access. If any version already exists, the caller must haveUPDATEpermission. - Model association: Each value in
modelsmust reference an existing integration in the formatintegrationName:modelName. The caller must have access to each integration.
Examples
Update a prompt
Request
curl -X 'POST' \
'https://<YOUR-SERVER-URL>/api/prompts/population-prompt?description=Updated%20description&autoIncrement=true' \
-H 'accept: */*' \
-H 'X-Authorization: <TOKEN>' \
-H 'Content-Type: application/json' \
-d 'What is the population of Russia in 1994?'
Response
Returns 200 OK, indicating that the prompt has been updated successfully.