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

# Update Chat

> Updates a specific chat for the authenticated user

## Path Parameters

<ParamField path="id" type="string" required>
  Chat ID to update
</ParamField>

## Body Parameters

<ParamField body="name" type="string" required>
  Updated chat name
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  Indicates if the chat was updated successfully
</ResponseField>

<ResponseField name="message" type="string">
  Success or error message
</ResponseField>

<ResponseField name="chat" type="object">
  The updated chat object
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl --request PATCH \
    --url https://api.yourdomain.com/api/chats/chat_123abc \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '{
      "name": "Updated Chat Name"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.yourdomain.com/api/chats/chat_123abc', {
    method: 'PATCH',
    headers: {
      'Authorization': 'Bearer <token>',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      name: "Updated Chat Name"
    })
  });

  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.yourdomain.com/api/chats/chat_123abc"
  headers = {
      "Authorization": "Bearer <token>",
      "Content-Type": "application/json"
  }
  payload = {"name": "Updated Chat Name"}

  response = requests.patch(url, headers=headers, json=payload)
  data = response.json()
  ```
</RequestExample>

<ResponseExample>
  ```json 200 - Success theme={null}
  {
    "success": true,
    "message": "Chat updated successfully",
    "chat": {
      "id": "chat_123abc",
      "name": "Updated Chat Name",
      "createdAt": "2024-01-15T10:30:00Z",
      "updatedAt": "2024-01-17T11:45:00Z"
    }
  }
  ```

  ```json 401 - Unauthorized theme={null}
  {
    "success": false,
    "message": "Unauthorized"
  }
  ```

  ```json 404 - Not Found theme={null}
  {
    "success": false,
    "message": "Chat not found"
  }
  ```
</ResponseExample>
