Skip to main content
POST
Chat history
Auth: TokenAccount or TokenInstanceRate-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 with count 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 only number 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 with number 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
Each item in messages[] carries the resolved sender identity, senderJid (phone number when known), senderLid and senderName. Media fields (mediaUrl, mediaMimeType, mediaSize, mediaDuration) appear only on media messages. The root chat_name carries the group name or the contact name.
Sender identity and chat_name are read from the instance’s local data, the same data that powers real-time events, without querying external servers. For group members the instance has never seen, or when the instance is disconnected, senderName may come empty and senderJid may stay in the @lid format. Numbers hidden by WhatsApp keep the @lid value in senderJid.

Path parameters

string
required
Instance name.

Headers

Request body

string
required
Phone number, private JID (...@s.whatsapp.net or ...@lid), group JID (...@g.us), or newsletter.
int
default:"50"
Maximum number of messages to return. No internal upper limit.
string
ISO 8601 / RFC3339. Messages starting from this date (inclusive).
string
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 received in the previous call.
  • hasMore=true does not guarantee 100% that more messages exist, it is just a heuristic based on the requested count.

Error responses

Error 400

Find message

Retrieve a specific message from history.

Media as base64

Download a media item referenced in history.