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

# Create messages

> Sends one WhatsApp message through a connected workspace device. Use it for text, media, location, and supported interactive message types; the request can select a sender or use the workspace default.



## OpenAPI

````yaml /openapi.json post /messages
openapi: 3.1.0
info:
  title: Wachat API
  version: v1
  description: >-
    Wachat REST API. Authenticate with a workspace API key: send it as
    `Authorization: Bearer <key>`. Generate keys in the dashboard under
    Developers / API.
servers:
  - url: https://crm.wachat.net/api/v1
security:
  - http: []
tags:
  - name: Message
    description: >-
      Send a single WhatsApp message — text, media (image / video / document /
      audio) or a location pin — to one number, then read its delivery status or
      your message history. A file can be attached directly as a multipart
      `media` field or referenced by a public URL.
  - name: Template
    description: >-
      Create, list and manage your approved WhatsApp templates, and send a
      template to one number with your own header, body variables and button
      values. Use this for utility / marketing sends that need a pre-approved
      template — including one with a PDF / document header (pass the file's
      public URL as the header, e.g. from the Media endpoint).
  - name: Media
    description: >-
      Upload a file once (multipart / form-data, field name `file`, up to 16 MB)
      and get back a hosted public URL you can reuse across sends — for example
      a PDF to use as a document-header on a template, or an image on a message.
  - name: Contact
    description: >-
      Full create / read / update / delete over your contacts and leads,
      including search by number, tags and custom attributes.
  - name: ContactGroup
    description: >-
      Organise contacts into groups: create groups, list them, and add or remove
      members — handy for targeting broadcasts and campaigns.
  - name: Broadcast
    description: >-
      Send the same message to many contacts at once and track each broadcast's
      progress and per-recipient delivery.
  - name: Campaign
    description: >-
      Create, start, pause and monitor drip / marketing campaigns and their
      recipients.
  - name: Scheduled
    description: >-
      Schedule a WhatsApp send for a future time, list upcoming scheduled
      messages, and cancel one before it goes out.
  - name: AutoReply
    description: >-
      Manage keyword auto-replies — the automatic responses that fire when an
      inbound message matches a rule.
  - name: Flow
    description: >-
      Enroll a contact into an automation flow (chatbot) and manage your flows
      through the API.
  - name: Device
    description: >-
      List the WhatsApp numbers / devices connected to your workspace and check
      each one's connection status.
  - name: Webhook
    description: >-
      Register and manage webhook endpoints so Wachat POSTs real-time events
      (message received / sent / delivered / read / failed, plus campaign and
      contact events) to your server. When you set a signing secret each
      delivery carries an HMAC-SHA256 signature header you can verify.
  - name: Deal
    description: >-
      Manage sales-pipeline deals — create, list, update and move deals between
      stages.
  - name: Conversation
    description: >-
      Read your workspace inbox: list chat threads (conversations) and fetch the
      messages inside a thread.
  - name: Account
    description: Read your account details, plan, limits and message-credit usage.
paths:
  /messages:
    post:
      tags:
        - Message
      summary: Create messages
      description: >-
        Sends one WhatsApp message through a connected workspace device. Use it
        for text, media, location, and supported interactive message types; the
        request can select a sender or use the workspace default.
      operationId: v1.messages.store
      requestBody:
        content:
          multipart/form-data:
            schema:
              allOf:
                - $ref: '#/components/schemas/SendMessageRequest'
                - type: object
                  properties:
                    delay:
                      type: boolean
                      default: true
      responses:
        '200':
          description: Successful response.
          content:
            application/json:
              schema:
                type: string
        '403':
          description: Request failed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        const: sender_not_in_workspace
                      message:
                        type: string
                        const: >-
                          The selected device does not belong to the workspace
                          associated with this API key.
                      details:
                        type: string
                    required:
                      - code
                      - message
                      - details
                required:
                  - error
        '422':
          $ref: '#/components/responses/ValidationException'
          description: Request failed.
components:
  schemas:
    SendMessageRequest:
      type: object
      description: >-
        Send a single WhatsApp message. Scramble reads these rules to document
        the

        request body. Supports text, media (by URL), location and Baileys

        interactive buttons; template/bulk

        sends use the /templates + /broadcasts endpoints.
      properties:
        to:
          type: string
          description: Recipient phone in international format (digits, E.164). Required.
          maxLength: 32
        device_id:
          type:
            - string
            - 'null'
          description: |-
            Sending sender (optional — defaults to the workspace's primary).
            Accepts a Baileys device id (57), a WABA/Twilio provider-config id
            ("cfg_20" or a bare 20), or an "engine:id" key — resolved across
            both the devices + wa_provider_configs tables. String, not int,
            so the "cfg_20" form from /api/v1/devices is accepted.
          maxLength: 40
        type:
          type:
            - string
            - 'null'
          description: Message type. Defaults to "text".
          enum:
            - text
            - image
            - video
            - document
            - audio
            - location
            - interactive
        text:
          type:
            - string
            - 'null'
          description: Text body (required for text; used as caption for media).
          maxLength: 4096
        media:
          type:
            - string
            - 'null'
          format: binary
          contentMediaType: application/octet-stream
          description: >-
            Image / video / document / audio sends — EITHER way:

            media     — attach the file directly (multipart upload, max 16 MB),
            OR

            media_url — a public URL we download for you.

            No need to host the file first; just send `media` in the same call.
          maxLength: 16384
        media_url:
          type:
            - string
            - 'null'
          format: uri
          maxLength: 2048
        latitude:
          type:
            - number
            - 'null'
          description: Location (when type=location).
          minimum: -90
          maximum: 90
        longitude:
          type:
            - number
            - 'null'
          minimum: -180
          maximum: 180
        footer:
          type:
            - string
            - 'null'
          maxLength: 60
        title:
          type:
            - string
            - 'null'
          maxLength: 256
        subtitle:
          type:
            - string
            - 'null'
          maxLength: 256
        buttons:
          type:
            - array
            - 'null'
          description: |-
            Baileys-only interactive message. The API deliberately exposes
            this as a first-class type so Scramble documents it publicly.
          items:
            type: object
            properties:
              type:
                type: string
                enum:
                  - quick_reply
                  - cta_url
                  - url
                  - visit_website
                  - cta_call
                  - call
                  - call_phone
                  - cta_copy
                  - copy_code
              text:
                type: string
                maxLength: 20
              value:
                type:
                  - string
                  - 'null'
                maxLength: 2048
              id:
                type:
                  - string
                  - 'null'
                maxLength: 128
              url:
                type:
                  - string
                  - 'null'
                format: uri
                maxLength: 2048
              phone_number:
                type:
                  - string
                  - 'null'
                maxLength: 32
              copy_code:
                type:
                  - string
                  - 'null'
                maxLength: 256
            required:
              - type
              - text
          minItems: 1
          maxItems: 3
      required:
        - to
      title: SendMessageRequest
  responses:
    ValidationException:
      description: Validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Errors overview.
              errors:
                type: object
                description: A detailed description of each field that failed validation.
                additionalProperties:
                  type: array
                  items:
                    type: string
            required:
              - message
              - errors
  securitySchemes:
    http:
      type: http
      scheme: bearer

````