Skip to content

Messages

List messages

Returns one page of messages from a conversation. Pages go back in time (the first page holds the newest messages), but the messages inside a page are ordered oldest to newest, ready to render as a chat.

GET/api/conversations/{id}/messages
  • Bearer API key
  • Scope: read, write or admin
  • or app session
  • Workspace: X-Tenant-ID (optional with a key)

Path parameters

  • iduuidrequired

    Conversation id.

    Example
    6a1f3c52-8e0b-4d7a-b1f2-93c4d5e6f708

Headers

  • Authorizationstringrequired

    Your API key as Bearer <key>. The word Bearer and the space are case-sensitive. Browser clients signed in to the app use the session cookie instead.

    Constraints
    Keys start with pk_live_ and are 47 characters long (56 for keys created before 10 October 2026).
    Example
    Bearer pk_live_…
  • X-Tenant-IDuuidoptional

    Workspace id. Optional with an API key (a key always acts in its own workspace); if you send it, it must match the key’s workspace. Required with a session cookie. You can pass ?tenant=<id> instead.

    Example
    8d0f6c2e-3b1a-4c55-9a7e-2f4b6d1e9c30

Query parameters

  • limitintegeroptional

    Messages per page.

    Constraints
    1–100. 0 or less is replaced by 50; values above 100 are capped at 100.
    Default
    50
    Example
    50
  • offsetintegeroptional

    Number of newer messages to skip. Ignored when before is set.

    Constraints
    At most 10000; a larger value returns 400. Use before to page further back.
    Default
    0
  • beforetimestampoptional

    Only return messages older than this time. Accepts RFC 3339 (2026-10-02T14:31:07Z) or Unix seconds. Pass the timestamp of the oldest message you have to load the previous page.

    Constraints
    Anything else returns 400 with invalid before timestamp.

Response

200 OKapplication/json

  • itemsarray<Message>

    Messages in this page, oldest first.

    Show child attributesHide child attributes23
    • iduuid

      Message id in whatsappx.si.

    • whatsapp_message_idstring

      Message id assigned by WhatsApp.

    • conversation_iduuid

      Conversation the message belongs to.

    • sender_jidstring

      WhatsApp id (JID) of the sender. For your own messages, the connected number.

    • sender_namestring

      Sender display name, when WhatsApp provides one (may be empty). AI Assistant for messages the AI assistant sent.

    • contentstring

      Message text. Images and documents carry their caption here. Types without downloadable media (for example location) use a placeholder such as [location message].

    • message_typestring

      text, image or document. Stickers arrive as image; video and audio (including voice notes) as document. Other Cloud API types (for example location) keep the name Meta sends and have no downloadable media.

    • media_urlstringmay be absent

      Path of the stored media file, for example /api/media/<workspace>/<file>. Prefix it with https://whatsappx.si and send your API key to download it (see Download a message’s file). Present for QR-linked and Cloud API inbound files (up to 25 MiB) and for files you send.

    • mime_typestringmay be absent

      MIME type of the media file.

    • file_namestringmay be absent

      Original file name of a document.

    • file_sizeintegermay be absent

      Media size in bytes.

    • timestamptimestamp

      When the message was sent on WhatsApp (RFC 3339).

    • from_meboolean

      true for messages sent from the connected number (by your team, the API or an automation).

    • statusenum

      received for incoming messages. Outgoing ones start as sent, then become delivered (two grey ticks: the contact’s phone got it) and read (blue ticks: they opened it; for a voice note, played it). Status only moves forward. Contacts who turned off read receipts never reach read; in a group the first member’s receipt counts.

    • delivered_attimestampnullable

      When an outgoing message was first delivered to the contact’s phone (RFC 3339). null for incoming messages and until delivered.

    • read_attimestampnullable

      When an outgoing message was first read (blue ticks). null for incoming messages, until read, and when the contact has read receipts turned off.

    • edited_attimestampnullable

      When the text was last edited: through the API or the app, or by its sender on WhatsApp. null if never edited.

    • deleted_attimestampnullable

      When the message was deleted for everyone. Its content and media fields are then empty. null if not deleted.

    • created_attimestamp

      When whatsappx.si stored the message (RFC 3339).

    • sent_by_user_iduuidmay be absent

      User id of the teammate who sent the message from the app (or whose scheduled message it was). Left out for incoming messages, messages sent from the phone or by an automation, and older messages.

    • sent_by_namestringmay be absent

      Name of that teammate. Left out with sent_by_user_id.

    • sent_via_api_key_iduuidmay be absent

      Id of the API key the message was sent with. Left out for messages not sent through the API.

    • sent_via_api_key_namestringmay be absent

      Name of that API key. Left out with sent_via_api_key_id.

  • totalinteger

    Number of messages matched (all messages, or those older than before).

  • limitinteger

    The page size used.

  • offsetinteger

    The offset used (0 when before is set).

  • has_moreboolean

    Whether older messages exist. With before, it is true when the page is full.

Status codes

  • 200OK. One page of messages.
  • 400Bad request. invalid conversation id or invalid before timestamp.
  • 401Unauthorized. The API key is unknown, revoked or expired (invalid or expired API key), the key was blocked because it may have been leaked (code: "api_key_blocked"), or there is no key and no signed-in session (unauthorized).
  • 402Payment required. Only when subscriptions are enforced and the workspace has no active subscription. The body includes code: "payment_required".
  • 403Forbidden. The X-Tenant-ID header or tenant query does not match the API key’s workspace (API key belongs to a different workspace), a signed-in user is not a member of the workspace (forbidden), or the key is limited to other IP addresses (this API key is not allowed from your IP address, with code: "ip_not_allowed").
  • 404Not found. The conversation does not exist in this workspace, belongs to the inactive connection, or (for agents signed in to the app) is not assigned to you.
  • 500Server error. The messages could not be loaded.

Can I read history while WhatsApp is disconnected?

Yes. The stored messages are returned while the number is disconnected or reconnecting. The X-WhatsApp-Connected response header (true or false) says whether sending works right now; while it is false, sending answers 409.

How do I page through history?

  1. Call the endpoint without before to get the newest page.
  2. While has_more is true, call it again with before set to the timestamp of the first (oldest) item you received.

before is safer than offset while new messages keep arriving, because offsets shift when a message is added.

How do I download media?

Images and documents received on a number linked by QR code or through the Cloud API (up to 25 MiB) are downloaded and stored when the message arrives, and so are the files you send. Stickers are stored as images; video and audio (including voice notes) as documents. Their media_url is a path such as /api/media/<workspace>/<file>; request https://whatsappx.si + media_url with your API key (Authorization: Bearer …, a read key is enough) to download the file. The key must belong to the same workspace; without it you get 401, and another workspace's file answers 404. Images (JPEG, PNG, GIF, WebP), audio and video are returned with their own Content-Type. Every other file (PDFs, office documents, anything else) is returned as application/octet-stream with Content-Disposition: attachment and the original file name, which is also the message's file_name. See Download a message's file. Profile pictures use /api/avatars/<workspace>/<file> the same way. To send files, see Send files.

Who sent a message?

Messages sent through whatsappx.si name their sender: sent_by_user_id and sent_by_name for a teammate in the app, sent_via_api_key_id and sent_via_api_key_name for an API key. The fields are left out for incoming messages, messages sent from the phone or by an automation, and older messages. Messages the AI assistant sent have the sender_name AI Assistant.