> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trellis.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Chat

> Update a chat's title

Rename an existing chat conversation.

<ParamField header="Authorization" type="string" required>
  Bearer token obtained from the authenticate endpoint.
</ParamField>

<ParamField path="chat_id" type="string" required>
  Unique identifier of the chat to update.
</ParamField>

<ParamField body="title" type="string" required>
  New title for the chat.
</ParamField>

## Response

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

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

<ResponseField name="preview" type="string">
  Preview of the first message.
</ResponseField>

<ResponseField name="timestamp" type="string" required>
  ISO 8601 timestamp of the most recent activity.
</ResponseField>

<RequestExample>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl -X PUT https://api.trellis.sh/v1/chats/chat_abc123 \
    -H "Authorization: Bearer YOUR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{"title": "Q4 2025 Revenue Deep Dive"}'
  ```

  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import requests

  response = requests.put(
      "https://api.trellis.sh/v1/chats/chat_abc123",
      headers={
          "Authorization": "Bearer YOUR_TOKEN",
          "Content-Type": "application/json"
      },
      json={"title": "Q4 2025 Revenue Deep Dive"}
  )
  updated_chat = response.json()
  ```

  ```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  const response = await fetch("https://api.trellis.sh/v1/chats/chat_abc123", {
    method: "PUT",
    headers: {
      Authorization: "Bearer YOUR_TOKEN",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ title: "Q4 2025 Revenue Deep Dive" }),
  });
  const updatedChat = await response.json();
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={"theme":{"light":"github-light","dark":"github-dark"}}
  {
    "id": "chat_abc123",
    "title": "Q4 2025 Revenue Deep Dive",
    "preview": "Show me the monthly revenue trends...",
    "timestamp": "2025-01-11T14:30:00Z"
  }
  ```

  ```json 404 theme={"theme":{"light":"github-light","dark":"github-dark"}}
  {
    "detail": "Chat not found"
  }
  ```
</ResponseExample>
