Skip to main content

Get Messages for a Chat

Retrieves a paginated list of messages for a specific chat session. Messages are sorted by timestamp in ascending order (oldest first).

Endpoint

GET /chats/{chat_id}/messages/

Path Parameters

NameRequiredDescription
chat_idYesThe ID of the chat session

Query Parameters

NameRequiredDefaultDescription
limitNo10Number of messages to return
offsetNo0Number of messages to skip

Headers

NameRequiredDescription
X-API-KeyYesYour unique API Key provided by ZeroinAI

Response

Success Response (200 OK)

{
"items": [
{
"chat_id": "generated-unique-chat-id",
"is_user": true,
"content": "Hello, I need help with my subscription.",
"timestamp": "2023-10-28T14:31:58Z"
},
{
"chat_id": "generated-unique-chat-id",
"is_user": false,
"content": "Hello! I can certainly help with your subscription. Could you please provide your account email?",
"timestamp": "2023-10-28T14:32:05Z"
}
],
"total": 2,
"limit": 10,
"offset": 0
}

Error Responses

Status CodeDescription
401 UnauthorizedInvalid or missing API Key
404 Not Foundchat_id not found

Example Request

curl -X GET 'https://api.zeroinai.com/micro-apps/for-api-providers/chat-service/chats/generated-unique-chat-id/messages/?limit=10&offset=0' \
-H 'X-API-Key: YOUR_UNIQUE_API_KEY'