v1

latestOpenAPI 3.1.02026-07-1413113265.9 KB
message

fetch messages from a chat

Retrieve messages from a specific chat with optional filtering and media inclusion

post/instances/{id}/client/action/fetch-messages

Path parameters

idinteger required

Instance ID

Request body

chatIdstring required

Chat ID <countrycode_short><usernumber>@c.us or @g.us for groups

limitinteger

Maximum number of messages to return

offsetinteger

Offset to start fetching messages from

fromMeboolean

Filter messages by sender (true = sent by me, false = received, null = both)

includeMediaboolean

Include media content as base64 encoded strings. Warning: Can significantly increase response size

Example request

{
  "chatId": "50664083362@c.us",
  "limit": 10,
  "offset": 10
}

Response

Successfully retrieved messages

status'success' | 'error'
instanceIdstring

Example response

{
  "status": "success",
  "instanceId": "1",
  "data": [
    {
      "message": {
        "id": {
          "remote": "1234567890@c.us",
          "id": "ABCD1234EFGH5678IJKL",
          "_serialized": "false_1234567890@c.us_ABCD1234EFGH5678IJKL"
        },
        "body": "Hello world",
        "type": "chat",
        "timestamp": 1738861768,
        "from": "1234567890@c.us",
        "to": "0987654321@c.us"
      }
    }
  ]
}