{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/whatsmcp-com/json-schema/whatsmcp-com-list-messages-output-schema.json",
  "title": "ListMessagesOutput",
  "x-generated": "2026-11-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/whatsmcp-com-openapi.json#/components/schemas/ListMessagesOutput",
  "additionalProperties": false,
  "properties": {
    "account_notices": {
      "description": "present when a number this read covers is not working: new messages are not arriving on it; says why and what to do",
      "items": {
        "$ref": "#/$defs/AccountNotice"
      },
      "type": [
        "array",
        "null"
      ]
    },
    "has_more": {
      "description": "true when the page was full and more may be waiting",
      "type": "boolean"
    },
    "hint": {
      "description": "present when the read found nothing new: wait before polling again",
      "type": "string"
    },
    "messages": {
      "description": "messages in order, oldest first",
      "items": {
        "$ref": "#/$defs/MessageView"
      },
      "type": [
        "array",
        "null"
      ]
    },
    "next_cursor": {
      "description": "pass this as after_cursor next time to get only newer messages",
      "format": "int64",
      "type": "integer"
    },
    "refusal": {
      "$ref": "#/$defs/Refusal",
      "description": "present only when the request was declined; next_cursor is then your after_cursor, unchanged"
    }
  },
  "required": [
    "messages",
    "next_cursor",
    "has_more"
  ],
  "type": "object",
  "$defs": {
    "AccountCandidate": {
      "additionalProperties": false,
      "properties": {
        "account_id": {
          "description": "the id to retry with as account_id",
          "type": "string"
        },
        "name": {
          "description": "the account's WhatsApp display name",
          "type": "string"
        },
        "phone": {
          "description": "the account's phone number, E.164",
          "type": "string"
        },
        "status": {
          "description": "whether the number works right now — live, connecting, or why not, as wa_list_accounts reports it",
          "type": "string"
        }
      },
      "required": [
        "account_id"
      ],
      "type": "object"
    },
    "AccountNotice": {
      "additionalProperties": false,
      "properties": {
        "account_id": {
          "description": "the account this notice is about",
          "type": "string"
        },
        "message": {
          "description": "what is wrong and what to do; tell the user",
          "type": "string"
        },
        "since": {
          "description": "when it stopped working, RFC3339, when known",
          "type": "string"
        },
        "status": {
          "description": "why it is not live: starting, not_running, whatsapp_down (telegram_down for a Telegram account), suspended, pairing, unlinked or locked",
          "type": "string"
        },
        "status_reason": {
          "description": "the detail, e.g. no_egress, no_plan, stopped",
          "type": "string"
        }
      },
      "required": [
        "account_id",
        "status",
        "message"
      ],
      "type": "object"
    },
    "AttachmentView": {
      "additionalProperties": false,
      "properties": {
        "available": {
          "description": "true when the file should be fetchable with wa_get_media(account_id, message_id) — a live received or sent attachment; false for imported history, which is not kept",
          "type": "boolean"
        },
        "file_name": {
          "description": "documents only: the file name the sender gave it",
          "type": "string"
        },
        "media_url": {
          "description": "a time-limited (1h) signed URL to GET the attachment's bytes, present only when the read passed include_media_urls and the attachment is available; an expired link is refused — read again for a fresh one",
          "type": "string"
        },
        "mime": {
          "description": "the attachment's mime type as the sender declared it, e.g. image/jpeg or application/pdf; empty for a message stored before this was recorded",
          "type": "string"
        },
        "size": {
          "description": "the attachment's size in bytes as the sender declared it; 0 when unknown",
          "format": "int64",
          "type": "integer"
        }
      },
      "required": [
        "available"
      ],
      "type": "object"
    },
    "MessageView": {
      "additionalProperties": false,
      "properties": {
        "account_id": {
          "description": "which of your accounts this message belongs to",
          "type": "string"
        },
        "account_name": {
          "description": "the WhatsApp display name of that account",
          "type": "string"
        },
        "account_phone": {
          "description": "the phone number of your account this message was sent from or received on, E.164",
          "type": "string"
        },
        "at": {
          "description": "when the message was sent, RFC3339",
          "type": "string"
        },
        "attachment": {
          "$ref": "#/$defs/AttachmentView",
          "description": "present on an image, video, audio, document or sticker message: the file's mime type, size and name; fetch the bytes with wa_get_media, or pass include_media_urls on the read to get a direct media_url"
        },
        "chat": {
          "description": "the conversation JID; pass it to wa_send_message's 'to' to reply here — a group is …@g.us, a channel …@newsletter; on a Telegram account a Telegram id: <id>@telegram for a user, -<id>@telegram for a basic group, -100<id>@telegram for a channel or supergroup",
          "type": "string"
        },
        "chat_kind": {
          "description": "dm, group, channel or broadcast; a Telegram supergroup reads as channel",
          "type": "string"
        },
        "cursor": {
          "description": "pass the highest cursor you have seen back as after_cursor to continue",
          "format": "int64",
          "type": "integer"
        },
        "direction": {
          "description": "inbound (received) or outbound (sent by you)",
          "type": "string"
        },
        "imported": {
          "description": "true for a message loaded as history (pairing sync or wa_load_history) rather than received live",
          "type": "boolean"
        },
        "kind": {
          "description": "what the message is: text, image, video, audio, document, sticker, reaction, location, live_location, contact, poll, poll_vote, video_note, album, event, comment, pin, group_invite, template or call_permission; other is a type this server does not classify. text carries a body, and so do image/video/document captions, template text and a call_permission request or answer; an image, video, audio, document or sticker attachment can be fetched with wa_get_media; a reaction carries its emoji as text and names its target message in reacted_to_message_id, while a reply carries quoted_message_id for the message it quotes",
          "type": "string"
        },
        "message_id": {
          "description": "WhatsApp's id for this message",
          "type": "string"
        },
        "peer": {
          "description": "the other party's phone number (for a group/channel this is the individual SENDER; use chat to reply); on a Telegram account the other party's Telegram id, <id>@telegram",
          "type": "string"
        },
        "quoted_message_id": {
          "description": "present on a reply: the message_id of the message this one quotes; pass it to wa_get_message to read what was quoted",
          "type": "string"
        },
        "quoted_sender": {
          "description": "who wrote the quoted message: a phone number when known, otherwise a JID",
          "type": "string"
        },
        "reacted_to_message_id": {
          "description": "present on a kind=reaction message: the message_id this reaction is about; the emoji itself is in text",
          "type": "string"
        },
        "received_at": {
          "description": "when this server received and stored the message, RFC3339; later than at for a message delivered late or loaded as history",
          "type": "string"
        },
        "send_error": {
          "description": "set on an outbound message that failed to send",
          "type": "string"
        },
        "sender_name": {
          "description": "who wrote the message, by name: for inbound the sender's name as saved in this account's contacts, or else the name they chose for themselves; for outbound this account's own WhatsApp name. Empty when no name is known",
          "type": "string"
        },
        "sent_by": {
          "$ref": "#/$defs/SentByView",
          "description": "present on an outbound message an AI agent or an app sent through WhatsMCP: who asked for the send"
        },
        "status": {
          "description": "delivery status of an outbound message from the provider's receipts: sent, delivered, read or failed; empty when no receipt has arrived (or for inbound). Only Business (Cloud API) numbers report this today",
          "type": "string"
        },
        "text": {
          "description": "the message body; for a kind=reaction message this is the emoji",
          "type": "string"
        },
        "undecryptable": {
          "description": "true for an inbound message this account could not decrypt: its text is unavailable. The sender's app may resend it, after which a later read returns the decrypted message",
          "type": "boolean"
        }
      },
      "required": [
        "cursor",
        "account_id",
        "direction",
        "peer",
        "text",
        "kind",
        "at",
        "message_id"
      ],
      "type": "object"
    },
    "Refusal": {
      "additionalProperties": false,
      "properties": {
        "account_status": {
          "description": "when the number is not working: its status — starting, not_running, whatsapp_down (telegram_down for a Telegram account), suspended, pairing, unlinked or locked",
          "type": "string"
        },
        "account_status_reason": {
          "description": "the detail of account_status, e.g. no_egress, stopped, no_plan",
          "type": "string"
        },
        "candidates": {
          "description": "on an account_ambiguous refusal: the accounts to choose from — retry with one of these as account_id",
          "items": {
            "$ref": "#/$defs/AccountCandidate"
          },
          "type": [
            "array",
            "null"
          ]
        },
        "message": {
          "description": "a human-readable explanation",
          "type": "string"
        },
        "reason": {
          "description": "why the call was declined",
          "type": "string"
        },
        "refused": {
          "description": "true when the call was declined rather than performed",
          "type": "boolean"
        },
        "retry_after_seconds": {
          "description": "seconds to wait before retrying; absent or 0 means retrying will not help",
          "format": "int64",
          "type": "integer"
        },
        "since": {
          "description": "when the number stopped working, RFC3339, when known",
          "type": "string"
        }
      },
      "required": [
        "refused",
        "reason",
        "message"
      ],
      "type": "object"
    },
    "SentByView": {
      "additionalProperties": false,
      "properties": {
        "id": {
          "description": "the agent's, the API key's or the OAuth app's id",
          "type": "string"
        },
        "kind": {
          "description": "agent (a hosted AI agent), api_key (an app on one of your API keys) or oauth_app (an app you connected over OAuth, such as Claude)",
          "type": "string"
        },
        "name": {
          "description": "its name as it was when the message was sent",
          "type": "string"
        },
        "version": {
          "description": "an agent only: the number of the agent's version that wrote it",
          "format": "int64",
          "type": "integer"
        },
        "via": {
          "description": "an app only: mcp or rest, the API it sent through",
          "type": "string"
        }
      },
      "required": [
        "kind",
        "id"
      ],
      "type": "object"
    }
  }
}