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

Request

  • Base URL: https://waapi.app/api/v1
  • URL: https://waapi.app/api/v1/instances/{id}/client/action/fetch-messages
  • Auth: HTTP bearer

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

Request reached the instance. data.status reports whether the action was carried out; on error data carries message and explanation. Payload: Successfully retrieved messages.

status'success' | 'error'

Whether the request reached the instance. success here does not mean the action was carried out — that is reported by data.status, which is the authoritative one. A malformed input arrives as status: success with data.status: error.

Example response

{
  "status": "success",
  "data": {
    "status": "success",
    "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"
        }
      }
    ]
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.