Get Messages
Fetches messages for a specific chat with pagination.
Note: This endpoint automatically triggers a read receipt on the last message.
Path Parameters
- Type: stringFormat: uuidchat
Id required
Query Parameters
- Type: integersize
Integer numbers.
- Type: stringFormat: uuidlast
Message Message ID for cursor-based pagination
Headers
- Type: stringAuthorizationrequired
JWT Bearer token. Format:
Bearer <JWT>
Responses
- application/json
- 400
User not in chat or chat doesn't exist.
- application/json
Request Example for get/api/messages/getMessages/{chatId}
curl 'https://demo.api.whispchat.com/api/messages/getMessages/123e4567-e89b-12d3-a456-426614174000?size=50&lastMessage=' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9...' \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
"messages": [
{
"chatId": "123e4567-e89b-12d3-a456-426614174000",
"timeStamp": "2026-05-29T11:57:30.579Z",
"messageId": "123e4567-e89b-12d3-a456-426614174000",
"senderId": "123e4567-e89b-12d3-a456-426614174000",
"content": "string",
"edited": true,
"editedAt": "2026-05-29T11:57:30.579Z",
"replyTo": {
"chatId": "123e4567-e89b-12d3-a456-426614174000",
"timeStamp": "2026-05-29T11:57:30.579Z",
"messageId": "123e4567-e89b-12d3-a456-426614174000",
"senderId": "123e4567-e89b-12d3-a456-426614174000",
"content": "string",
"edited": true,
"editedAt": "2026-05-29T11:57:30.579Z"
},
"reactions": [
{
"reactionId": "123e4567-e89b-12d3-a456-426614174000",
"chatId": "123e4567-e89b-12d3-a456-426614174000",
"messageId": "123e4567-e89b-12d3-a456-426614174000",
"senderId": "123e4567-e89b-12d3-a456-426614174000",
"reaction": "string",
"createdAt": "2026-05-29T11:57:30.579Z"
}
]
}
]
}