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

# Create Chat

> Create a new chat conversation

Creates a new chat with the provided chat data and optional folder assignment.

## Request Body

<ParamField body="chat" type="object" required>
  Chat data object containing title and message history

  <Expandable title="Chat Object">
    <ParamField body="title" type="string" default="New Chat">
      Title for the chat
    </ParamField>

    <ParamField body="history" type="object">
      Message history container

      <Expandable title="History Object">
        <ParamField body="messages" type="object">
          Map of message IDs to message objects. Each message should have at minimum:

          * `id`: Message identifier
          * `role`: Either "user" or "assistant"
          * `content`: Message text content
          * `timestamp`: Unix timestamp
        </ParamField>

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

<ParamField body="folder_id" type="string" optional>
  ID of the folder to place the chat in
</ParamField>

## Response

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

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

<ResponseField name="title" type="string" required>
  Chat title
</ResponseField>

<ResponseField name="chat" type="object" required>
  Complete chat data object as provided in the request
</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 (null for new chats)
</ResponseField>

<ResponseField name="archived" type="boolean" required>
  Whether the chat is archived (false for new chats)
</ResponseField>

<ResponseField name="pinned" type="boolean" required>
  Whether the chat is pinned (false for new chats)
</ResponseField>

<ResponseField name="meta" type="object" default={{}}>
  Metadata object (empty for new chats)
</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/new" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "chat": {
        "title": "New AI Conversation",
        "history": {
          "messages": {
            "msg-1": {
              "id": "msg-1",
              "role": "user",
              "content": "Hello!",
              "timestamp": 1709164800
            }
          },
          "currentId": "msg-1"
        }
      },
      "folder_id": null
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "id": "770g0622-g4bd-63f6-c938-668877662222",
    "user_id": "user-123",
    "title": "New AI Conversation",
    "chat": {
      "title": "New AI Conversation",
      "history": {
        "messages": {
          "msg-1": {
            "id": "msg-1",
            "role": "user",
            "content": "Hello!",
            "timestamp": 1709164800
          }
        },
        "currentId": "msg-1"
      }
    },
    "created_at": 1709337600,
    "updated_at": 1709337600,
    "share_id": null,
    "archived": false,
    "pinned": false,
    "meta": {},
    "folder_id": null
  }
  ```
</ResponseExample>
