> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/open-webui/open-webui/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Prompt

> Update a prompt and create a new version in history

Updates a prompt's content and metadata. If content changes, a new version is automatically created in the prompt's history. The user must be the prompt owner, have write access, or be an admin.

## Path Parameters

<ParamField path="id" type="string" required>
  The unique prompt ID to update
</ParamField>

## Request Body

<ParamField body="command" type="string" required>
  Command trigger for the prompt. Can be changed if the new command is not already in use.
</ParamField>

<ParamField body="name" type="string" required>
  Display name for the prompt
</ParamField>

<ParamField body="content" type="string" required>
  The prompt template content
</ParamField>

<ParamField body="data" type="object" optional>
  Additional data to associate with the prompt
</ParamField>

<ParamField body="meta" type="object" optional>
  Metadata for the prompt
</ParamField>

<ParamField body="tags" type="array" optional>
  Array of tag strings for categorizing the prompt
</ParamField>

<ParamField body="access_grants" type="array" optional>
  Array of access grant objects. If provided, access grants will be updated.
</ParamField>

<ParamField body="commit_message" type="string" optional>
  Message describing this version update (for version history)
</ParamField>

<ParamField body="is_production" type="boolean" default={true}>
  Whether to set the new version as the production version. If false, creates a version but keeps the current production version active.
</ParamField>

## Response

<ResponseField name="id" type="string" required>
  Unique identifier for the prompt
</ResponseField>

<ResponseField name="command" type="string" required>
  Command trigger for the prompt
</ResponseField>

<ResponseField name="user_id" type="string" required>
  ID of the user who originally created the prompt
</ResponseField>

<ResponseField name="name" type="string" required>
  Display name for the prompt
</ResponseField>

<ResponseField name="content" type="string" required>
  The prompt template content
</ResponseField>

<ResponseField name="data" type="object" optional>
  Additional data associated with the prompt
</ResponseField>

<ResponseField name="meta" type="object" optional>
  Metadata for the prompt
</ResponseField>

<ResponseField name="tags" type="array" optional>
  Array of tag strings
</ResponseField>

<ResponseField name="is_active" type="boolean" required>
  Whether the prompt is currently active
</ResponseField>

<ResponseField name="version_id" type="string" optional>
  ID of the active history entry. Updated to new version if `is_production` is true.
</ResponseField>

<ResponseField name="created_at" type="integer" required>
  Unix timestamp (epoch seconds) when prompt was created
</ResponseField>

<ResponseField name="updated_at" type="integer" required>
  Unix timestamp (epoch seconds) when prompt was last updated
</ResponseField>

<ResponseField name="access_grants" type="array" default={[]}>
  Array of access grant objects
</ResponseField>

## Version History

When content changes (name, command, content, tags, or access\_grants), a new version is automatically created:

* The version includes a snapshot of the prompt state
* A commit message can be provided to describe the changes
* The version is linked to the user making the update
* By default, the new version becomes the production version
* Set `is_production: false` to create a draft version

## Error Responses

* **400 Bad Request**: Command is already in use by another prompt
* **401 Unauthorized**: User lacks write access to this prompt
* **404 Not Found**: Prompt does not exist

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://your-domain.com/api/prompts/id/550e8400-e29b-41d4-a716-446655440000/update" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "command": "summarize",
      "name": "Advanced Text Summarizer",
      "content": "Please provide a detailed summary of the following text: {{input}}",
      "tags": ["productivity", "writing", "advanced"],
      "commit_message": "Enhanced summarization prompt with more detail",
      "is_production": true
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "command": "summarize",
    "user_id": "user-123",
    "name": "Advanced Text Summarizer",
    "content": "Please provide a detailed summary of the following text: {{input}}",
    "data": {},
    "meta": {},
    "tags": ["productivity", "writing", "advanced"],
    "is_active": true,
    "version_id": "ver-456",
    "created_at": 1709164800,
    "updated_at": 1709251200,
    "access_grants": []
  }
  ```
</ResponseExample>
