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

> Retrieves all messages in a specific chat

## Path Parameters

<ParamField path="chatId" type="string" required>
  Chat ID to retrieve messages from
</ParamField>

## Response

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

<ResponseField name="messages" type="array">
  Array of message objects in the chat
</ResponseField>

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

<RequestExample>
  ```bash cURL theme={null}
  curl --request GET \
    --url https://api.yourdomain.com/api/chats/chat_123abc/messages \
    --header 'Authorization: Bearer <token>'
  ```

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

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

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

  url = "https://api.yourdomain.com/api/chats/chat_123abc/messages"
  headers = {"Authorization": "Bearer <token>"}

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

<ResponseExample>
  ```json 200 - Success theme={null}
  {
    "success": true,
    "messages": [
      {
        "id": "msg_456def",
        "chatId": "chat_123abc",
        "role": "user",
        "parts": [
          {
            "type": "text",
            "text": "Hello, how can you help me today?"
          }
        ],
        "attachments": [],
        "createdAt": "2024-01-17T10:30:00Z"
      },
      {
        "id": "msg_789ghi",
        "chatId": "chat_123abc",
        "role": "assistant",
        "parts": [
          {
            "type": "text",
            "text": "I'd be happy to help! What would you like to know?"
          }
        ],
        "attachments": [],
        "createdAt": "2024-01-17T10:30:15Z"
      }
    ],
    "message": "Messages fetched successfully"
  }
  ```

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

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