---
title: "fetch messages from a chat"
method: POST
path: "/instances/{id}/client/action/fetch-messages"
tags: ["message"]
---

# fetch messages from a chat

`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

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

## Path parameters

- `id` integer, required

## Request body

- object
  - `chatId` string, required: Chat ID <countrycode_short><usernumber>@c.us or @g.us for groups
  - `limit` integer: Maximum number of messages to return
  - `offset` integer: Offset to start fetching messages from
  - `fromMe` boolean: Filter messages by sender (true = sent by me, false = received, null = both)
  - `includeMedia` boolean: Include media content as base64 encoded strings. Warning: Can significantly increase response size

## Response `200`

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

- object
  - `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`.
  - `data` union: The action's outcome. `status: success` carries the payload; `status: error` is an `actionError`.
    - object
      - `status` 'success', required: Whether the instance carried the action out — the authoritative field. In this branch it is always `success`; when the instance refused the action the whole `data` object is an `actionError` with `status: error`, `message` and `explanation`.
      - `instanceId` union
        - integer
        - string
      - `data` object[]
        - `message` object
          - `id` object
            - `fromMe` boolean
            - `remote` string
            - `id` string
            - `_serialized` string
          - `body` string
          - `type` 'chat' | 'image' | 'video' | 'document' | 'audio' | 'poll_creation'
          - `timestamp` integer
          - `from` string
          - `to` string
          - `hasMedia` boolean
          - `ack` integer: Message acknowledgment status
        - `media` string, nullable: Base64 encoded media content if includeMedia=true
    - ActionError: Shape of `data` when the instance refused the action. HTTP status is still 200 and the outer `status` is still `success`.
      - `status` 'error', required
      - `message` string
      - `explanation` string
      - `instanceId` union
        - integer
        - string

## Other responses

- `401`: Unauthorized — invalid or missing bearer token
- `403`: Forbidden — insufficient permissions or account blocked
- `404`: Not found — instance does not exist or does not belong to you
- `409`: Conflict — instance is not ready
- `422`: Validation error — invalid or missing request parameters
- `429`: Too many requests — rate limit exceeded

---

[API](https://skmtc.dev/waapi/apis/waapi-api-2.md) · [All operations](https://skmtc.dev/waapi/apis/waapi-api-2/llms.txt) · [OpenAPI document](https://skmtc.dev/waapi/apis/waapi-api-2/revisions/490302f75576?raw)
