Skip to main content
GET
/
api
/
chats
/
{chatId}
/
messages
curl --request GET \
  --url https://api.yourdomain.com/api/chats/chat_123abc/messages \
  --header 'Authorization: Bearer <token>'
{
  "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"
}

Path Parameters

chatId
string
required
Chat ID to retrieve messages from

Response

success
boolean
Indicates if the request was successful
messages
array
Array of message objects in the chat
message
string
Response message
curl --request GET \
  --url https://api.yourdomain.com/api/chats/chat_123abc/messages \
  --header 'Authorization: Bearer <token>'
{
  "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"
}