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

# Send a buttons message

> Send a message with 1 to 3 buttons. The response contains the message ID.

Button types can be mixed in one message:
- `reply` (default) — sends a reply back to you. Needs an `id`, unique within the message. Tapping it produces a `message` event of type `button_reply` with the button's `id` and `text`. This is the only button type that produces an event.
- `url` — opens `url` on the recipient's device.
- `copy` — copies `copyCode` to the recipient's clipboard.
- `call` — calls `phoneNumber` from the recipient's device.

Header and footer are text only. Set `aiLabel` to show WhatsApp's "AI" badge on the message; it applies to 1:1 chats only and is ignored in groups.

A `201` response means WhatsApp accepted the message. How it is displayed is up to the recipient's WhatsApp app, and may change as WhatsApp evolves.

Limits mirror the WhatsApp Cloud API: `text` up to 1024 characters, `header` and `footer` up to 60, button `text` up to 20, button `id` up to 256.




## OpenAPI

````yaml /openapi/wsapi-api.yaml post /messages/buttons
openapi: 3.0.3
info:
  title: WSAPI - WhatsApp API
  description: >-
    RESTful HTTP API for WhatsApp via whatsmeow. Supports multi-instance
    connections, connections, webhook event delivery, and HMAC-SHA256 signing.
    Includes self-service instance management endpoints served by the API
    Gateway.
  version: 2.0.0
servers:
  - url: https://api.wsapi.chat
    description: WSAPI API
security:
  - ApiKeyAuth: []
tags:
  - name: Account
    description: >-
      Customer account management — instances, subscriptions, and default
      settings (CustomerApiKey auth)
  - name: Session
    description: WhatsApp session management (login, logout, status)
  - name: Messages
    description: Send and manage WhatsApp messages
  - name: Groups
    description: Group management
  - name: Communities
    description: Community management
  - name: Contacts
    description: Contact lookup and management
  - name: Users
    description: Own account management, user lookup, and profile information
  - name: Media
    description: Media download
  - name: Chats
    description: Chat listing, info, settings, and management
  - name: Calls
    description: Call management
  - name: Newsletters
    description: Newsletter/channel management
  - name: Status
    description: Status/stories posting
paths:
  /messages/buttons:
    post:
      tags:
        - Messages
      summary: Send a buttons message
      description: >
        Send a message with 1 to 3 buttons. The response contains the message
        ID.


        Button types can be mixed in one message:

        - `reply` (default) — sends a reply back to you. Needs an `id`, unique
        within the message. Tapping it produces a `message` event of type
        `button_reply` with the button's `id` and `text`. This is the only
        button type that produces an event.

        - `url` — opens `url` on the recipient's device.

        - `copy` — copies `copyCode` to the recipient's clipboard.

        - `call` — calls `phoneNumber` from the recipient's device.


        Header and footer are text only. Set `aiLabel` to show WhatsApp's "AI"
        badge on the message; it applies to 1:1 chats only and is ignored in
        groups.


        A `201` response means WhatsApp accepted the message. How it is
        displayed is up to the recipient's WhatsApp app, and may change as
        WhatsApp evolves.


        Limits mirror the WhatsApp Cloud API: `text` up to 1024 characters,
        `header` and `footer` up to 60, button `text` up to 20, button `id` up
        to 256.
      operationId: sendButtons
      parameters:
        - $ref: '#/components/parameters/XInstanceId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendButtonsRequest'
            examples:
              replyButtons:
                summary: Reply buttons
                value:
                  to: 1234567890@s.whatsapp.net
                  text: Can we confirm your appointment for tomorrow at 10:00?
                  footer: Reply with a button
                  buttons:
                    - id: confirm
                      text: Confirm
                    - id: reschedule
                      text: Reschedule
                    - id: cancel
                      text: Cancel
              mixedButtons:
                summary: URL, copy and call buttons with the AI label
                value:
                  to: 1234567890@s.whatsapp.net
                  header: Your order has shipped
                  text: >-
                    Order #1042 is on its way. Track it, copy your coupon for
                    next time, or call us.
                  footer: Example Store
                  aiLabel: true
                  buttons:
                    - type: url
                      text: Track order
                      url: https://example.com/track/1042
                    - type: copy
                      text: Copy coupon
                      copyCode: THANKS10
                    - type: call
                      text: Call us
                      phoneNumber: '+1234567890'
      responses:
        '201':
          $ref: '#/components/responses/Created'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '409':
          $ref: '#/components/responses/DeviceNotPaired'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
components:
  parameters:
    XInstanceId:
      name: X-Instance-Id
      in: header
      required: true
      description: The ID of the WhatsApp instance to use
      schema:
        type: string
        default: '{{instanceId}}'
  schemas:
    SendButtonsRequest:
      type: object
      required:
        - to
        - text
        - buttons
      properties:
        to:
          type: string
        text:
          type: string
          maxLength: 1024
          description: Message body
        header:
          type: string
          maxLength: 60
          description: Optional header text shown above the body
        footer:
          type: string
          maxLength: 60
          description: Optional footer text shown below the body
        aiLabel:
          type: boolean
          default: false
          description: >-
            Show WhatsApp's "AI" badge on the message. 1:1 chats only; ignored
            in groups.
        buttons:
          type: array
          minItems: 1
          maxItems: 3
          description: >-
            Buttons to show. Types can be mixed. Reply button ids must be unique
            within the message.
          items:
            $ref: '#/components/schemas/InteractiveButton'
    InteractiveButton:
      type: object
      required:
        - text
      properties:
        type:
          type: string
          enum:
            - reply
            - url
            - copy
            - call
          default: reply
          description: |
            - `reply` — sends a `button_reply` event back to you; requires `id`.
            - `url` — opens `url`; requires `url`.
            - `copy` — copies `copyCode` to the clipboard; requires `copyCode`.
            - `call` — calls `phoneNumber`; requires `phoneNumber`.
        id:
          type: string
          maxLength: 256
          description: >-
            Button id, returned as `buttonReply.id` when tapped. Required for
            `reply` buttons and unique within the message.
        text:
          type: string
          maxLength: 20
          description: Button label
        url:
          type: string
          format: uri
          pattern: ^https?://
          description: URL to open (`http` or `https`). Required for `url` buttons.
        copyCode:
          type: string
          maxLength: 256
          description: Text copied to the clipboard. Required for `copy` buttons.
        phoneNumber:
          type: string
          pattern: ^\+?[1-9]\d{6,14}$
          description: International phone number to call. Required for `call` buttons.
    Error:
      type: object
      description: Standard error response returned by all API endpoints
      required:
        - detail
        - status
      properties:
        detail:
          type: string
          description: Human-readable error message
          example: invalid request body
        status:
          type: integer
          description: HTTP status code
          example: 400
  responses:
    Created:
      description: Resource created
      content:
        application/json:
          schema:
            type: object
            properties:
              id:
                type: string
                description: ID of the created resource
          example:
            id: '01234567890123456'
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            status: 400
            detail: invalid request body
    Unauthorized:
      description: Authentication failed
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            status: 401
            detail: unauthorized
    DeviceNotPaired:
      description: Device is not paired. Complete the pairing process first.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            status: 409
            detail: device not paired
    ServiceUnavailable:
      description: Instance not available (not connected or service is nil)
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            status: 503
            detail: instance not available
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key
      description: >-
        Instance or customer-level API key. Either the instance's own API key or
        the customer's API key is accepted. Must be paired with the
        X-Instance-Id header to identify the target instance.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.