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
| Name | Required | Description |
|---|---|---|
chat_id | Yes | The ID of the chat session |
Query Parameters
| Name | Required | Default | Description |
|---|---|---|---|
limit | No | 10 | Number of messages to return |
offset | No | 0 | Number of messages to skip |
Headers
| Name | Required | Description |
|---|---|---|
X-API-Key | Yes | Your 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 Code | Description |
|---|---|
| 401 Unauthorized | Invalid or missing API Key |
| 404 Not Found | chat_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'