> ## Documentation Index
> Fetch the complete documentation index at: https://docs.escrybe.com.br/llms.txt
> Use this file to discover all available pages before exploring further.

# List or fetch WhatsApp messages



## OpenAPI

````yaml /openapi/escrybe.en.yaml get /api/whatsapp/v1/get
openapi: 3.1.0
info:
  title: Escrybe API
  version: 1.0.0
  description: >
    REST API for the Escrybe platform — send physical letters, registered
    letters, telegrams and e-Carta through Brazilian Correios, dispatch legally
    registered e-mails, and send WhatsApp messages with certified timestamps.


    ## Authentication

    Every account has a personal **`securityToken`** (find it in the panel under
    *Account → API*). Three products use it differently:


    | Product | Scheme | How | |---------|--------|-----| | Letters / Telegram /
    e-Carta, Registered E-mail, Receipts | API token | Send `userSecurityToken`
    as a query/body parameter, or `securityToken` as a header | | WhatsApp |
    HTTP Basic | `Authorization: Basic base64(email:securityToken)` |


    > The letter and e-mail **read** routes (`get`, `balance`, `download`, >
    `delete`) take the token as the first URL **path** segment — e.g. >
    `/api/v2/get/{securityToken}/{job_id}`.


    ## Response envelopes

    Most endpoints reply with the standard envelope `{"status": <http code>,
    "status_message": "...", "data": ...}` — this covers Letters/Telegram,
    Registered E-mail, and the WhatsApp message and sender endpoints. The
    WhatsApp **template** endpoints (and template sync) use `{"code": <http
    code>, "status": "success|error", "message": "...", "data": ...,
    "request_id": "..."}`; the logo endpoint uses the same shape without
    `request_id`. See the schema of each endpoint.


    A request that is accepted returns an HTTP `200` with a success payload;
    validation problems return `400`, bad credentials `401`, and forbidden
    access `403`. Unsupported HTTP methods return `405`, repeated failed
    authentication attempts return `429`, and the letter and e-mail endpoints
    return `503` during maintenance windows.
  contact:
    name: Escrybe Support
    url: https://escrybe.com.br
servers:
  - url: https://app.escrybe.com.br
    description: Production
  - url: https://homolog.escrybe.com.br
    description: Staging
security:
  - securityTokenQuery: []
tags:
  - name: Letters & Telegram
    description: Create and manage letter, telegram and e-Carta orders (Correios).
  - name: Account & Favorites
    description: Account balance, saved contacts and sender logo.
  - name: Registered E-mail
    description: Send and track legally registered e-mails.
  - name: WhatsApp Messages
    description: Send WhatsApp messages and download certified-timestamp attestations.
  - name: WhatsApp Senders
    description: Manage WhatsApp Business numbers (senders).
  - name: WhatsApp Templates
    description: Create, sync and manage WhatsApp message templates.
  - name: Receipts
    description: Download legal receipts for any order.
paths:
  /api/whatsapp/v1/get:
    get:
      tags:
        - WhatsApp Messages
      summary: List or fetch WhatsApp messages
      operationId: listWhatsappMessages
      parameters:
        - name: message_id
          in: query
          schema:
            type: integer
          description: When set, returns a single detailed message instead of the list.
        - name: status
          in: query
          schema:
            type: string
          description: Filter the outbox by status (e.g. pending, sent).
        - name: limit
          in: query
          schema:
            type: integer
            default: 50
            maximum: 100
        - name: offset
          in: query
          schema:
            type: integer
            default: 0
      responses:
        '200':
          description: Messages
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/WaMessagesEnvelope'
                  - properties:
                      data:
                        oneOf:
                          - type: object
                            title: List mode
                            properties:
                              messages:
                                type: array
                                items:
                                  $ref: '#/components/schemas/WhatsappMessage'
                              pagination:
                                type: object
                                properties:
                                  total:
                                    type: integer
                                  limit:
                                    type: integer
                                  offset:
                                    type: integer
                                  has_more:
                                    type: boolean
                          - type: object
                            title: Single message mode (message_id set)
                            properties:
                              success:
                                type: boolean
                              message:
                                $ref: '#/components/schemas/WhatsappMessage'
        '400':
          $ref: '#/components/responses/WaMsgBadRequest'
        '401':
          $ref: '#/components/responses/WaMsgUnauthorized'
        '403':
          $ref: '#/components/responses/WaMsgForbidden'
        '404':
          $ref: '#/components/responses/WaMsgNotFound'
      security:
        - basicAuth: []
components:
  schemas:
    WaMessagesEnvelope:
      type: object
      description: >
        Standard envelope used by the WhatsApp message and sender endpoints
        (same shape as the letters and e-mail envelopes).
      properties:
        status:
          type: integer
          example: 200
        status_message:
          type: string
        data:
          oneOf:
            - type: object
            - type: string
            - type: 'null'
    WhatsappMessage:
      type: object
      description: >
        Message row returned by the get endpoint. `message_status` is the order
        status (0 Processing payment · 1 Queued · 2 Insufficient credits · 5
        Failed/Cancelled); `status` is the delivery-queue (outbox) status.
      properties:
        id:
          type: string
        visual_id:
          type: string
        message_sender_name:
          type: string
          description: Sender name printed on the message.
        sender_document:
          type: string
        recipient_name:
          type: string
        recipient_phone:
          type: string
        recipient_document:
          type: string
        body:
          type: string
        media_url:
          type: string
          nullable: true
        media_url_presigned:
          type: string
          nullable: true
          description: 60-minute presigned URL. Single-message mode only.
        media_filename:
          type: string
          nullable: true
        is_template:
          type: string
        template_id:
          type: string
          nullable: true
        template_name:
          type: string
          nullable: true
        template_lang:
          type: string
          nullable: true
        template_variables:
          type: string
          nullable: true
          description: JSON-encoded map.
        paymentMethod:
          type: string
        value:
          type: string
        message_status:
          type: string
          description: >-
            0 Processing payment · 1 Queued · 2 Insufficient credits · 5
            Failed/Cancelled
        created_at:
          type: string
        team_member_id:
          type: string
          nullable: true
        team_name:
          type: string
          nullable: true
        outbox_id:
          type: string
          nullable: true
        status:
          type: string
          nullable: true
          description: Outbox status (e.g. pending, processing, sent, cancelled, failed).
        attempt_count:
          type: string
          nullable: true
        last_error:
          type: string
          nullable: true
        sent_at:
          type: string
          nullable: true
          description: When WhatsApp accepted the message for delivery.
        delivered_at:
          type: string
          nullable: true
          description: >-
            When the message reached the recipient's device. Null until
            delivered.
        read_at:
          type: string
          nullable: true
          description: >-
            When the recipient opened the message. Null unless read receipts are
            enabled on their account.
        updated_at:
          type: string
          nullable: true
        sender_id:
          type: string
          nullable: true
        sender_name:
          type: string
          nullable: true
          description: WhatsApp Business sender used for dispatch.
        sender_phone:
          type: string
          nullable: true
        header_text:
          type: string
          nullable: true
        body_text:
          type: string
          nullable: true
        footer_text:
          type: string
          nullable: true
        header_format:
          type: string
          nullable: true
        variables_count:
          type: string
          nullable: true
        events:
          type: array
          description: >-
            Status events (accepted, sent, delivered, read) in chronological
            order.
          items:
            type: object
            properties:
              event_type:
                type: string
              created_at:
                type: string
              raw_payload:
                type: string
  responses:
    WaMsgBadRequest:
      description: Invalid request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/WaMessagesEnvelope'
          example:
            status: 400
            status_message: Campos obrigatórios não preenchidos
            data: null
    WaMsgUnauthorized:
      description: Unauthorized — invalid credentials
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/WaMessagesEnvelope'
          example:
            status: 401
            status_message: Unauthorized - invalid credentials
            data: null
    WaMsgForbidden:
      description: Access denied
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/WaMessagesEnvelope'
    WaMsgNotFound:
      description: Not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/WaMessagesEnvelope'
  securitySchemes:
    securityTokenQuery:
      type: apiKey
      in: query
      name: userSecurityToken
      description: >-
        Your account security token, sent as the `userSecurityToken` query or
        form parameter.
    basicAuth:
      type: http
      scheme: basic
      description: >-
        HTTP Basic where username is your account e-mail and password is your
        security token.

````