List stored messages
GET
/v1/whatsapp/sessions/{sessionId}/messagesReturns messages stored for the session, newest first, with filters.
| Name | Type | Description |
|---|---|---|
sessionIdrequired | path | The session id from the sessions endpoints. |
chatId | string | Only messages in this chat. |
from | string | Only messages from this sender. |
limit | integer | Maximum messages to return. Defaults to 50. |
offset | integer | Messages to skip. |
after | string | Cursor for paging: the id of the last message of the previous page. |
inlineMedia | boolean | Set false to leave out inline media data, and fetch it with the media endpoint instead. |
curl "https://api.tuskmail.africa/v1/whatsapp/sessions/$SESSION_ID/messages?chatId=254700000002%40c.us&limit=20" \
-H "X-API-Key: $TUSK_WA_KEY"200 OK
{
"messages": [
{
"id": "msg_1",
"chatId": "[email protected]",
"from": "[email protected]",
"to": "[email protected]",
"body": "Hello",
"type": "chat",
"direction": "incoming",
"timestamp": 1768469400,
"status": "read",
"createdAt": "2026-01-15T09:30:00Z"
}
],
"total": 1
}Fetch a chat's history
GET
/v1/whatsapp/sessions/{sessionId}/messages/{chatId}/historyFetches recent messages of a chat live from WhatsApp.
| Name | Type | Description |
|---|---|---|
sessionIdrequired | path | The session id from the sessions endpoints. |
chatIdrequired | path | The chat id. |
limit | integer | Maximum messages to return. Defaults to 50. |
includeMedia | boolean | Include media as base64. Slower. Defaults to false. |
deep | boolean | Raise the limit ceiling from 100 to 2000 to reach further back. Slower. |
curl "https://api.tuskmail.africa/v1/whatsapp/sessions/$SESSION_ID/messages/[email protected]/history?limit=20" \
-H "X-API-Key: $TUSK_WA_KEY"200 OK
[
{
"id": "3EB0A1B2C3D4E5F60789",
"from": "[email protected]",
"to": "[email protected]",
"chatId": "[email protected]",
"body": "Hello",
"type": "text",
"timestamp": 1768469400,
"fromMe": false,
"isGroup": false,
"kind": "individual"
}
]Download a message's media
GET
/v1/whatsapp/sessions/{sessionId}/messages/{chatId}/{messageId}/mediaDownloads the stored media of a message. The response is the file itself with its content type, not JSON. It returns 404 when no media is stored for the message.
| Name | Type | Description |
|---|---|---|
sessionIdrequired | path | The session id from the sessions endpoints. |
chatIdrequired | path | The chat the message is in. |
messageIdrequired | path | The message id. |
curl "https://api.tuskmail.africa/v1/whatsapp/sessions/$SESSION_ID/messages/[email protected]/3EB0A1B2C3D4E5F60789/media" \
-H "X-API-Key: $TUSK_WA_KEY"200 OK
Binary file