Skip to main content

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

ParameterDescriptionTypeRequired/ Optional
nameThe name of the prompt to create or update.stringRequired.

Query parameters

ParameterDescriptionTypeRequired/ Optional
descriptionA description for the prompt.stringRequired.
modelsThe 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.stringOptional.
versionExplicit version number to save. Ignored if autoIncrement=true.integerOptional.
autoIncrementWhen true, automatically sets the version to the current latest version + 1. If no versions exist yet, defaults to version 1.booleanOptional.

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 uses latestVersion + 1 (or 1 if no versions exist yet).
    • If version is provided, it uses that explicit version number.
    • Otherwise, it defaults to version 1 (overwrites existing version 1 without preserving metadata).
  • 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 have UPDATE permission.
  • Model association: Each value in models must reference an existing integration in the format integrationName: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.