> ## 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 Chat

> Update an existing chat's data

Updates a chat by merging the provided chat data with the existing chat. Only fields included in the request will be updated.

## Path Parameters

<ParamField path="id" type="string" required>
  The unique identifier of the chat to update
</ParamField>

## Request Body

<ParamField body="chat" type="object" required>
  Chat data object to merge with existing chat. Any fields provided will update the corresponding fields in the existing chat.

  <Expandable title="Chat Object">
    <ParamField body="title" type="string">
      Update the chat title
    </ParamField>

    <ParamField body="history" type="object">
      Update message history

      <Expandable title="History Object">
        <ParamField body="messages" type="object">
          Map of message IDs to message objects. Messages provided here will be merged with existing messages.
        </ParamField>

        <ParamField body="currentId" type="string">
          Update the current message ID
        </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="folder_id" type="string" optional>
  Update the folder assignment
</ParamField>

## Response

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

<ResponseField name="user_id" type="string" required>
  ID of the user who owns the chat
</ResponseField>

<ResponseField name="title" type="string" required>
  Updated chat title
</ResponseField>

<ResponseField name="chat" type="object" required>
  Complete updated chat data object
</ResponseField>

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

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

<ResponseField name="share_id" type="string" optional>
  ID for sharing the chat
</ResponseField>

<ResponseField name="archived" type="boolean" required>
  Whether the chat is archived
</ResponseField>

<ResponseField name="pinned" type="boolean" required>
  Whether the chat is pinned
</ResponseField>

<ResponseField name="meta" type="object" default={{}}>
  Metadata object
</ResponseField>

<ResponseField name="folder_id" type="string" optional>
  ID of the folder containing this chat
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://your-domain.com/api/chats/550e8400-e29b-41d4-a716-446655440000" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "chat": {
        "title": "Updated Chat Title",
        "history": {
          "messages": {
            "msg-3": {
              "id": "msg-3",
              "role": "user",
              "content": "Can you help me with coding?",
              "timestamp": 1709338000
            }
          },
          "currentId": "msg-3"
        }
      }
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "user_id": "user-123",
    "title": "Updated Chat Title",
    "chat": {
      "title": "Updated Chat Title",
      "history": {
        "messages": {
          "msg-1": {
            "id": "msg-1",
            "role": "user",
            "content": "Hello, how can you help me?",
            "timestamp": 1709164800
          },
          "msg-2": {
            "id": "msg-2",
            "role": "assistant",
            "content": "I'm here to help! What do you need?",
            "model": "gpt-4",
            "timestamp": 1709164805
          },
          "msg-3": {
            "id": "msg-3",
            "role": "user",
            "content": "Can you help me with coding?",
            "timestamp": 1709338000
          }
        },
        "currentId": "msg-3"
      }
    },
    "created_at": 1709164800,
    "updated_at": 1709338000,
    "share_id": null,
    "archived": false,
    "pinned": false,
    "meta": {
      "tags": ["work", "ai_help"]
    },
    "folder_id": null
  }
  ```
</ResponseExample>
