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

# Send a message with Meta's request and response

> Send a message with Meta's request and response



## OpenAPI

````yaml openapi.json POST /v{graphVersion}/{phoneNumberId}/messages
openapi: 3.1.0
info:
  title: Watahub API
  version: 0.2.0
  description: >-
    Tenant API of Watahub, the multi-tenant WhatsApp Cloud API gateway.
    Authenticate every request with your API key as `Authorization: Bearer
    <key>` or `X-API-Key: <key>`.


    - Shapes the gateway owns are closed: no other field appears.

    - Records that come from Meta are open: documented fields are listed and any
    other field Meta adds is passed through.

    - The `/vN.N` proxy passes Meta's body and status through untouched; the
    version in the path is accepted and ignored.
servers:
  - url: https://cloud.watahub.dev
security:
  - bearerApiKey: []
  - headerApiKey: []
tags:
  - name: Messages
  - name: Media
  - name: Templates
  - name: Graph-compatible proxy
    description: >-
      Drop-in for Meta's Graph API on three routes. Meta's response is returned
      as is.
  - name: Phones
    description: Phones
  - name: Conversations
    description: Conversations
  - name: Connect
    description: Connect
  - name: Customers
    description: Customers
  - name: Webhooks
    description: Webhooks
  - name: Logs
    description: Logs
  - name: Health
    description: Health
  - name: Message templates
    description: >-
      Templates cached by the gateway per WABA; synced from Meta and required by
      broadcasts.
  - name: Broadcasts
    description: >-
      Send one approved template to up to 500 recipients; sending is queued and
      drained in the background.
paths:
  /v{graphVersion}/{phoneNumberId}/messages:
    post:
      tags:
        - Graph-compatible proxy
      summary: Send a message with Meta's request and response
      description: >-
        The body goes to Meta's `/messages` unchanged and Meta's answer comes
        back unchanged.
      operationId: postVgraphVersionPhoneNumberIdMessages
      parameters:
        - $ref: '#/components/parameters/GraphVersion'
        - name: phoneNumberId
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/GraphId'
      responses:
        '200':
          description: Meta's answer.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GraphSendResult'
        4XX:
          $ref: '#/components/responses/GraphClientError'
        5XX:
          $ref: '#/components/responses/GraphSendServerError'
components:
  parameters:
    GraphVersion:
      name: graphVersion
      in: path
      required: true
      description: >-
        Any `N.N`. Ignored: Graph is called with the gateway's
        `META_API_VERSION`.
      schema:
        type: string
        pattern: ^\d+\.\d+$
  schemas:
    GraphId:
      type: string
      pattern: ^\d+$
      description: Numeric Meta Graph ID.
    GraphSendResult:
      type: object
      description: Meta's answer to a send.
      additionalProperties: true
      required:
        - messaging_product
        - contacts
        - messages
      properties:
        messaging_product:
          const: whatsapp
        contacts:
          type: array
          items:
            type: object
            additionalProperties: true
            properties:
              input:
                type: string
              wa_id:
                type: string
        messages:
          type: array
          items:
            type: object
            additionalProperties: true
            required:
              - id
            properties:
              id:
                type: string
                description: The wamid.
              message_status:
                type: string
                description: Such as `accepted`, `held_for_quality_assessment` or `paused`.
    GatewayError:
      type: object
      description: >-
        An error the gateway or the core answers itself. `error` is a stable
        English message for developers.
      additionalProperties: false
      required:
        - error
      properties:
        error:
          type: string
        fields:
          type: array
          items:
            type: string
          description: 'With 400 `Invalid fields`: the paths of the rejected fields.'
        requestId:
          type: string
          description: 'With 500 `Operation unavailable`: the ID to quote to support.'
    GraphError:
      type: object
      description: Meta's error body, unchanged.
      additionalProperties: true
      required:
        - error
      properties:
        error:
          type: object
          additionalProperties: true
          required:
            - message
            - code
          properties:
            message:
              type: string
            type:
              type: string
            code:
              type: integer
            error_subcode:
              type: integer
            error_user_title:
              type: string
            error_user_msg:
              type: string
            error_data:
              type: object
              additionalProperties: true
            fbtrace_id:
              type: string
    MetaError:
      type: object
      description: >-
        Meta failed a `/v1` call. With Meta's error: `code`, its `subcode`,
        `type` on sends, and the core's classification. When Meta could not be
        reached or answered something unusable, only `message`, plus the
        `unknown_outcome` classification on sends.
      additionalProperties: false
      required:
        - error
      properties:
        error:
          type: object
          additionalProperties: false
          required:
            - message
          properties:
            message:
              type: string
            code:
              type: integer
              description: Meta's error code; Meta's HTTP status when Meta gave none.
            subcode:
              type: integer
              description: Meta's `error_subcode`.
            type:
              type: string
              description: Meta's error type. Only on message sends.
            category:
              type: string
              enum:
                - auth
                - billing
                - rate_limit
                - meta_server
                - unknown
                - unknown_outcome
            retryable:
              type: boolean
            action:
              type: string
              description: What to do next, in English.
  responses:
    GraphClientError:
      description: >-
        Rejected by the gateway (`GatewayError`) or by Meta (`GraphError`,
        Meta's body and status).
      content:
        application/json:
          schema:
            anyOf:
              - $ref: '#/components/schemas/GatewayError'
              - $ref: '#/components/schemas/GraphError'
    GraphSendServerError:
      description: >-
        As `GraphServerError`. The message may have been sent: confirm it with
        the status webhook before retrying.
      headers:
        X-Watahub-Outcome:
          description: '`unknown` when Meta answered the send with a 5XX.'
          schema:
            type: string
            enum:
              - unknown
      content:
        application/json:
          schema:
            anyOf:
              - $ref: '#/components/schemas/GatewayError'
              - $ref: '#/components/schemas/MetaError'
              - $ref: '#/components/schemas/GraphError'
  securitySchemes:
    bearerApiKey:
      type: http
      scheme: bearer
      description: Tenant API key.
    headerApiKey:
      type: apiKey
      in: header
      name: X-API-Key
      description: Tenant API key.

````

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