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

# Send message

> Sends any message type. Use the "type" field to specify: text, image, file, voice, video, poll, location, contact.



## OpenAPI

````yaml /api-reference/openapi.selfhost.json post /api/{session}/messages/send
openapi: 3.0.0
info:
  contact: {}
  description: >-
    Self-hosted Polymorfa REST, tenant-account, and instance-administration API.
    Use the generated operations for exact request and response schemas. SaaS
    Console-only routes are not included.
  title: Polymorfa API
  version: '1.0'
servers:
  - url: https://your-instance.example.com
    description: Your self-hosted instance
security:
  - ApiKey: []
tags:
  - description: >-
      Manage WhatsApp Channels (newsletters): create, follow/unfollow,
      mute/unmute, and retrieve channel information.
    name: channels
  - description: >-
      Register webhook endpoints to receive real-time events (messages, status
      changes, group updates, etc.). Configure event filtering, retry policies,
      HMAC signature verification, and custom headers.
    name: webhooks
  - description: >-
      Resolve WhatsApp Linked Device IDs (LIDs) to phone numbers (PNJIDs) and
      vice versa.
    name: lids
  - description: Server version and status information. No authentication required.
    name: info
  - description: >-
      Send messages (text, image, video, audio, document, location, contact,
      poll), mark messages as read, send typing indicators, and react to
      messages with emoji.
    name: messages
  - description: >-
      Manage chat-level operations: edit sent messages, delete messages, and
      archive/unarchive conversations.
    name: chats
  - description: >-
      Read and write online/offline presence status. Subscribe to presence
      updates for specific contacts to receive real-time typing and online
      notifications via webhooks.
    name: presence
  - description: >-
      Create, update, and delete WhatsApp Business labels. Assign labels to
      chats for organization and filtering.
    name: labels
  - description: >-
      Full group management: create groups, update subject/description/picture,
      manage participants (add, remove, promote, demote), handle invite links,
      and join groups.
    name: groups
  - description: >-
      Read and update your WhatsApp profile: display name, status text, and
      profile picture.
    name: profile
  - description: >-
      Download and manage media files (images, videos, documents) from received
      messages. Media can be downloaded on-demand or auto-persisted to
      S3-compatible storage.
    name: media
  - description: >-
      Health check and readiness probes for load balancers and orchestrators. No
      authentication required.
    name: health
  - description: Manage your tenant account and API keys (SaaS edition).
    name: account
  - description: >-
      Configure instance settings: rate limits, debug mode, S3 storage, and
      license info (self-hosted edition).
    name: settings
  - description: >-
      Link a WhatsApp account to a session using QR code scanning or phone
      number pairing code. After creating a session, use one of these methods to
      authenticate it with WhatsApp.
    name: pairing
  - description: >-
      Look up contacts, check phone number registration on WhatsApp, retrieve
      profile pictures, and manage your block list.
    name: contacts
  - description: Administrative endpoints for tenant management (SaaS edition).
    name: admin
  - description: Create, list, rotate, and revoke API keys (self-hosted edition).
    name: keys
  - description: >-
      Create, start, stop, and manage WhatsApp sessions. A session represents a
      single WhatsApp account connection. Sessions must be paired via QR code or
      pairing code before they can send or receive messages.
    name: sessions
paths:
  /api/{session}/messages/send:
    post:
      tags:
        - messages
      summary: Send message
      description: >-
        Sends any message type. Use the "type" field to specify: text, image,
        file, voice, video, poll, location, contact.
      operationId: sendMessage
      parameters:
        - description: Session name
          in: path
          name: session
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendMessageRequest'
        description: Message payload
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageResponse'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestError'
          description: Invalid request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedError'
          description: Unauthorized
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerError'
          description: Internal server error
        default:
          content:
            application/json:
              schema:
                properties:
                  docs:
                    description: Link to relevant API documentation
                    type: string
                  error:
                    description: Human-readable error message
                    type: string
                type: object
          description: Error response
components:
  schemas:
    SendMessageRequest:
      properties:
        address:
          description: Human-readable address text (type=location)
          example: San Francisco, CA
          type: string
        base64:
          description: Base64-encoded media bytes (alternative to url)
          type: string
        caption:
          description: Caption text for media messages (image, video, document)
          example: Check this out
          type: string
        chatId:
          description: >-
            Target chat JID (e.g. "5511999@s.whatsapp.net", "120363...@g.us", or
            "status@broadcast")
          example: 1234567890@s.whatsapp.net
          type: string
        filename:
          description: Original filename for document messages
          example: photo.jpg
          type: string
        isForwarded:
          description: Whether the message should be marked as forwarded
          type: boolean
        latitude:
          description: Latitude coordinate in degrees (type=location)
          example: 37.7749
          type: number
        longitude:
          description: Longitude coordinate in degrees (type=location)
          example: -122.4194
          type: number
        mentions:
          description: JIDs to mention/tag in the message text
          items:
            type: string
          type: array
        mimeType:
          description: MIME type of the media (e.g. "image/jpeg", "application/pdf")
          example: image/jpeg
          type: string
        pollMultiSelect:
          description: Whether recipients can select multiple poll options
          type: boolean
        pollOptions:
          description: Array of answer options for the poll
          example:
            - Red
            - Blue
            - Green
          items:
            type: string
          type: array
        pollTitle:
          description: Poll question text (type=poll)
          example: What's your favorite color?
          type: string
        ptt:
          description: Whether the audio is a push-to-talk voice note (type=voice only)
          type: boolean
        quotedMessage:
          $ref: '#/components/schemas/QuotedMessage'
        text:
          description: Text content (type=text)
          example: Hello, world!
          type: string
        type:
          $ref: '#/components/schemas/SendMessageType'
        url:
          description: HTTP(S) URL of media to send (type=image, file, voice, video)
          example: https://example.com/image.jpg
          type: string
        vcard:
          description: vCard-formatted contact data (type=contact)
          type: string
      required:
        - chatId
        - type
      type: object
    MessageResponse:
      properties:
        fromLid:
          description: LID of the target chat
          type: string
        fromPhoneNumber:
          description: Phone number of the target chat (if available)
          type: string
        id:
          description: Message ID assigned by WhatsApp
          type: string
        mediaId:
          description: Media record ID (present when message contained media)
          type: string
        senderLid:
          description: LID of the sender (session account)
          type: string
        senderPhoneNumber:
          description: Phone number of the sender (if available)
          type: string
        status:
          description: 'Delivery status: pending, sent, delivered, read'
          type: string
        timestamp:
          description: When the message was accepted by WhatsApp
          type: string
      type: object
    BadRequestError:
      properties:
        docs:
          description: Link to relevant API documentation
          example: https://docs.polymorfa.com/api/messages/send
          type: string
        error:
          description: Human-readable error message
          example: 'missing required field: chatId'
          type: string
      type: object
    UnauthorizedError:
      properties:
        error:
          description: Human-readable error message
          example: missing or invalid API key
          type: string
      type: object
    InternalServerError:
      properties:
        error:
          description: Human-readable error message
          example: internal server error
          type: string
      type: object
    QuotedMessage:
      properties:
        messageId:
          description: ID of the original message being quoted
          example: ABCDEF1234567890
          type: string
        participant:
          description: JID of the original message sender
          example: 5511999999999@s.whatsapp.net
          type: string
        text:
          description: Preview text of the quoted message
          example: Original message text
          type: string
        type:
          description: Message type of the quoted message (text, image, etc.)
          example: text
          type: string
      required:
        - messageId
        - participant
      type: object
    SendMessageType:
      enum:
        - text
        - image
        - file
        - voice
        - video
        - poll
        - location
        - contact
      type: string
      x-enum-varnames:
        - SendTypeText
        - SendTypeImage
        - SendTypeFile
        - SendTypeVoice
        - SendTypeVideo
        - SendTypePoll
        - SendTypeLocation
        - SendTypeContact
  securitySchemes:
    ApiKey:
      description: Scoped API key created via POST /api/account/keys.
      scheme: bearer
      type: http

````