Skip to main content

Create or Update Prompt

Endpoint: PUT /api/prompts/{name}

Creates a new prompt or updates the latest version of an existing one. If the prompt does not exist yet, it is created and the caller is granted full access. If it already exists, the caller must have UPDATE permission.

Path parameters

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

Query parameters

ParameterDescriptionTypeRequired/ Optional
versionVersion number to create or update. If omitted, it defaults to 1 for new prompts or the latest version for existing ones.integerOptional.
descriptionA description for the prompt.stringRequired.
modelsThe AI model to associate with this prompt, in the format integrationName:modelName. Repeat this parameter to associate multiple models. The specified integration must exist and the caller must have access to it.stringOptional.

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

  • Create: If no prompt with the given name exists, a new one is created and full access is granted to the calling user.
  • Update: If the prompt exists, the template text and description are updated while preserving the original createdBy and createTime metadata.
  • Version targeting: If version is supplied, that specific version is targeted. Otherwise the latest version is used.
  • Model association: Each value in models must reference an existing integration in the format integrationName:modelName. The caller must have access to each integration.
tip

This is the recommended endpoint for day-to-day prompt management. Use POST /api/prompts/{name} when you need explicit control over version numbering or auto-incrementing.

Examples

Create a prompt

Request

curl -X 'PUT' \
'https://<YOUR-SERVER-URL>/api/prompts/population-prompt?description=A%20population%20prompt' \
-H 'accept: */*' \
-H 'X-Authorization: <TOKEN>' \
-H 'Content-Type: application/json' \
-d 'What is the population of China in 1994?'

Response

Returns 200 OK, indicating that the prompt has been created successfully.