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

# List Chats

> Retrieves all chats for the authenticated user with pagination

## Query Parameters

<ParamField query="limit" type="number" default={20}>
  Number of results per page
</ParamField>

<ParamField query="offset" type="number" default={0}>
  Pagination offset
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  Indicates if the request was successful
</ResponseField>

<ResponseField name="chats" type="array">
  Array of chat objects
</ResponseField>

<ResponseField name="nextOffset" type="number">
  Offset for the next page of results
</ResponseField>

<ResponseField name="hasMore" type="boolean">
  Indicates if there are more results available
</ResponseField>

<ResponseField name="total" type="number">
  Total number of chats
</ResponseField>

<ResponseField name="message" type="string">
  Response message
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl --request GET \
    --url 'https://api.yourdomain.com/api/chats?limit=20&offset=0' \
    --header 'Authorization: Bearer <token>'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.yourdomain.com/api/chats?limit=20&offset=0', {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer <token>'
    }
  });

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

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

  url = "https://api.yourdomain.com/api/chats"
  headers = {"Authorization": "Bearer <token>"}
  params = {"limit": 20, "offset": 0}

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

<ResponseExample>
  ```json 200 - Success theme={null}
  {
    "success": true,
    "chats": [
      {
        "id": "chat_123abc",
        "name": "Project Discussion",
        "createdAt": "2024-01-15T10:30:00Z",
        "updatedAt": "2024-01-15T14:20:00Z"
      }
    ],
    "nextOffset": 20,
    "hasMore": false,
    "total": 15,
    "message": "Chats retrieved successfully"
  }
  ```

  ```json 401 - Unauthorized theme={null}
  {
    "success": false,
    "chats": [],
    "hasMore": false,
    "total": 0
  }
  ```
</ResponseExample>
