Documentation Index Fetch the complete documentation index at: https://mintlify.com/jihvijhojhviihogyuvi/whatsapp-api/llms.txt
Use this file to discover all available pages before exploring further.
The messages endpoints retrieve the most recent messages from a one-to-one WhatsApp chat identified by phone number. There are two ways to call the same underlying function: a GET variant that accepts query parameters (convenient for browser testing and curl), and a POST variant that accepts a JSON body (better suited for programmatic clients that already build JSON payloads). Both variants return an identical response shape.
GET Variant
Use query parameters to specify the target chat and the number of messages to fetch.
Endpoint
GET /api/messages?phone_number=15551234567&limit=10
Query Parameters
The phone number of the contact whose chat you want to read. Must include the country code. Non-digit characters are stripped automatically, and the result must be 8–15 digits.
Maximum number of messages to return. Must be between 1 and 100. Messages are returned in chronological order (oldest first within the returned window).
Example Request
curl "http://127.0.0.1:8790/api/messages?phone_number=15551234567&limit=5"
POST Variant
Use a JSON request body — functionally identical to the GET variant.
Endpoint
Body Parameters
The phone number of the contact whose chat you want to read. Must include the country code. Non-digit characters are stripped automatically.
Maximum number of messages to return. Must be between 1 and 100.
Example Request
curl -X POST http://127.0.0.1:8790/api/messages \
-H "Content-Type: application/json" \
-d '{
"phone_number": "15551234567",
"limit": 5
}'
Response Fields
true on a successful response.
A chat summary object for the conversation identified by phone_number. Has the same shape as the chat objects in GET /api/chats. Serialized WhatsApp chat ID (e.g. "15551234567@c.us").
Display name of the chat.
true if this is a group chat.
true if the chat is read-only.
Number of unread messages.
Unix timestamp of the most recent message.
true if the chat is archived.
true if the chat is pinned.
true if notifications are muted.
Summary of the most recent message. null if no messages exist.
Number of message objects returned in the messages array.
An array of message summary objects from the chat, ordered chronologically (oldest first). Show Message object fields
Serialized WhatsApp message ID. null if the ID could not be extracted.
WhatsApp ID of the message sender (e.g. "15551234567@c.us"). null for some system messages.
WhatsApp ID of the recipient or group. null if unavailable.
In group chats, the WhatsApp ID of the individual who sent the message. null for direct chats.
true if the message was sent by the authenticated account.
The WhatsApp message type. Common values: "chat" (text), "image", "audio", "video", "document", "sticker". null for unrecognized types.
The text content of the message. For media messages this may be the caption. Empty string ("") if there is no text content.
Unix timestamp (seconds) of when the message was sent. null if unavailable.
true if the message contains a media attachment (image, audio, video, document, etc.).
Example Response
{
"ok" : true ,
"chat" : {
"id" : "15551234567@c.us" ,
"name" : "Alice" ,
"is_group" : false ,
"is_read_only" : false ,
"unread_count" : 0 ,
"timestamp" : 1717250585 ,
"archived" : false ,
"pinned" : false ,
"muted" : false ,
"last_message" : {
"id" : "true_15551234567@c.us_3EB0C767D97B2C123456" ,
"from" : "15551234567@c.us" ,
"to" : "me@c.us" ,
"author" : null ,
"from_me" : false ,
"type" : "chat" ,
"body" : "Are you free tomorrow?" ,
"timestamp" : 1717250585 ,
"has_media" : false
}
},
"count" : 3 ,
"messages" : [
{
"id" : "true_me@c.us_AA11BB22CC33DD44EE55" ,
"from" : "me@c.us" ,
"to" : "15551234567@c.us" ,
"author" : null ,
"from_me" : true ,
"type" : "chat" ,
"body" : "Hey Alice, just checking in!" ,
"timestamp" : 1717249200 ,
"has_media" : false
},
{
"id" : "true_15551234567@c.us_FF66GG77HH88II99JJ00" ,
"from" : "15551234567@c.us" ,
"to" : "me@c.us" ,
"author" : null ,
"from_me" : false ,
"type" : "image" ,
"body" : "Check out this photo" ,
"timestamp" : 1717250100 ,
"has_media" : true
},
{
"id" : "true_15551234567@c.us_3EB0C767D97B2C123456" ,
"from" : "15551234567@c.us" ,
"to" : "me@c.us" ,
"author" : null ,
"from_me" : false ,
"type" : "chat" ,
"body" : "Are you free tomorrow?" ,
"timestamp" : 1717250585 ,
"has_media" : false
}
]
}