Chat
Chat history
Request the stored messages of a chat with optional date filters
POST
Chat history
Auth:
TokenAccount or TokenInstance • Rate-limit: Global (100/min) • Idempotent: yes
Description
Returns the stored messages of a specific chat, ordered from newest to oldest. You can control the amount withcount and filter by a date window with from/to.
There is no pagination cursor. To paginate, adjust the
from and to filters. The hasMore field is a heuristic: it is true when the number of returned messages == count (likely there are more).Examples
Last 50
Minimal form: pass onlynumber and use the default count of 50 messages, returning the most recent ones in the chat ordered from newest to oldest.
With a date window
Retrieves up to 200 messages sent between April 20 and April 28, 2026 (from/to in ISO 8601). Useful to extract history for a specific interval or to paginate using to as a cursor.
Group
Same logic, but withnumber pointing to a group JID (@g.us) and count of 100. Each item in messages[] carries senderJid filled with the message author within the group.
Success response
messages carries the messages in reverse chronological order (newest first). count indicates how many items came in this page and hasMore is true when you reached exactly the requested count, signaling that there may be more messages, paginate by using the from/to from the last returned message. chat_jid is the resolved JID of the requested chat.
200 OK
Path parameters
Instance name.
Headers
| Name | Required | Example | Description |
|---|---|---|---|
Content-Type | yes | application/json | , |
token | yes (or Authorization) | a1b2c3d4-... | TokenAccount or TokenInstance. |
Request body
Phone number, private JID (
...@s.whatsapp.net or ...@lid), group JID (...@g.us), or newsletter.Maximum number of messages to return. No internal upper limit.
ISO 8601 / RFC3339. Messages starting from this date (inclusive).
ISO 8601 / RFC3339. Messages up to this date (inclusive).
Notes and gotchas
- Works even when the instance is disconnected, reads directly from the ingestion database.
- To paginate safely, set
to = timestamp of the oldest message already receivedin the previous call. hasMore=truedoes not guarantee 100% that more messages exist, it is just a heuristic based on the requested count.
Error responses
| HTTP | error.message | When it happens |
|---|---|---|
| 400 | Instance name is required | , |
| 400 | Invalid request body: <...> | Malformed JSON. |
| 400 | Number is required | , |
| 400 | invalid 'from' date format. Use ISO 8601 format (e.g., '2026-02-16T18:32:39Z') | , |
| 400 | invalid 'to' date format. Use ISO 8601 format (e.g., '2026-02-16T18:32:39Z') | , |
| 401 | Invalid token | , |
| 404 | Instance not found | , |
Error 400
Related
Find message
Retrieve a specific message from history.
Media as base64
Download a media item referenced in history.