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

# Send template message

> Send a WhatsApp template with flat params (no component arrays). Supports body variables (variables=a,b,c or body1..body20), header text/media, footer, and button params. Sends via the authorized channel credentials only.

Authentication: API key via X-API-Key header (or Authorization: Bearer).
Permissions: User API key
Rate limit: api_messaging — 20 requests/min per API user.



## OpenAPI

````yaml /api-reference/workspace.openapi.json post /api/workspace/v1/whatsapp/templates/send
openapi: 3.1.0
info:
  title: Workspace API
  version: 1.0.0
  description: >-
    Manage contacts, labels, custom fields, WhatsApp messaging, and automations
    for your workspace.


    Generate your API key in the Developer Portal (profile menu → Developer) and
    send it in the `X-API-Key` header, or as `Authorization: Bearer <key>`.
    Never put the key in the URL.


    Every endpoint accepts POST with a JSON body, and also accepts GET with the
    same parameters as query-string values. All responses use the envelope `{
    success, data?, message?, error? }`.
servers:
  - url: https://YOUR_DOMAIN
    description: Your deployment, for example https://app.example.com
security: []
tags:
  - name: Channels
  - name: Contacts
  - name: Custom Fields
  - name: Labels
  - name: WhatsApp
  - name: Automations
paths:
  /api/workspace/v1/whatsapp/templates/send:
    post:
      tags:
        - WhatsApp
      summary: Send template message
      description: >-
        Send a WhatsApp template with flat params (no component arrays).
        Supports body variables (variables=a,b,c or body1..body20), header
        text/media, footer, and button params. Sends via the authorized channel
        credentials only.


        Authentication: API key via X-API-Key header (or Authorization: Bearer).

        Permissions: User API key

        Rate limit: api_messaging — 20 requests/min per API user.
      parameters:
        - name: channelId
          in: query
          required: false
          description: Channel id. Auto-selects when omitted.
          schema:
            type: string
            example: ch_123
        - name: to
          in: query
          required: false
          description: Recipient phone or WhatsApp BSUID.
          schema:
            type: string
            example: '919876543210'
        - name: templateName
          in: query
          required: false
          description: Template name as synced for the channel.
          schema:
            type: string
            example: order_update
        - name: languageCode
          in: query
          required: false
          description: Template language, auto-resolved from stored template. Default en.
          schema:
            type: string
        - name: variables
          in: query
          required: false
          description: Body variables as comma list, e.g. variables=John,123.
          schema:
            type: string
        - name: body1
          in: query
          required: false
          description: >-
            1st body variable (alternative to variables). body2..body20
            continue.
          schema:
            type: string
        - name: header
          in: query
          required: false
          description: Header text variable.
          schema:
            type: string
        - name: mediaUrl
          in: query
          required: false
          description: Header media URL (pair with mediaType).
          schema:
            type: string
        - name: mediaType
          in: query
          required: false
          description: image | video | document.
          schema:
            type: string
        - name: footer
          in: query
          required: false
          description: Footer text variable.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - to
                - templateName
              properties:
                channelId:
                  type: string
                  description: Channel id. Auto-selects when omitted.
                  example: ch_123
                to:
                  type: string
                  description: Recipient phone or WhatsApp BSUID.
                  example: '919876543210'
                templateName:
                  type: string
                  description: Template name as synced for the channel.
                  example: order_update
                languageCode:
                  type: string
                  description: >-
                    Template language, auto-resolved from stored template.
                    Default en.
                variables:
                  type: string
                  description: Body variables as comma list, e.g. variables=John,123.
                body1:
                  type: string
                  description: >-
                    1st body variable (alternative to variables). body2..body20
                    continue.
                header:
                  type: string
                  description: Header text variable.
                mediaUrl:
                  type: string
                  description: Header media URL (pair with mediaType).
                mediaType:
                  type: string
                  description: image | video | document.
                footer:
                  type: string
                  description: Footer text variable.
            example:
              channelId: ch_123
              to: '919876543210'
              templateName: order_update
              variables: John,12345
      responses:
        '200':
          description: 'Success. Envelope: { success:true, data, message? }.'
          content:
            application/json:
              schema:
                type: object
                required:
                  - success
                properties:
                  success:
                    type: boolean
                    example: true
                  data: {}
                  message:
                    type: string
                  pagination:
                    type: object
                  total:
                    type: number
              example:
                success: true
                data:
                  messaging_product: whatsapp
                  messages:
                    - id: wamid.xxx
                message: Template sent successfully
        '400':
          description: >-
            Missing/invalid parameters. Body has success:false plus error and
            message.
          content:
            application/json:
              schema:
                type: object
                required:
                  - success
                  - error
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                  message:
                    type: string
        '401':
          description: >-
            Missing or invalid API key (or session expired for session
            endpoints).
          content:
            application/json:
              schema:
                type: object
                required:
                  - success
                  - error
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                  message:
                    type: string
        '403':
          description: >-
            Authenticated but not authorized — wrong permissions or cross-tenant
            resource.
          content:
            application/json:
              schema:
                type: object
                required:
                  - success
                  - error
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                  message:
                    type: string
        '429':
          description: >-
            Rate limited. Retry after the Retry-After seconds; see RateLimit-*
            headers.
          content:
            application/json:
              schema:
                type: object
                required:
                  - success
                  - error
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                  message:
                    type: string
        '500':
          description: >-
            Unexpected server error. Body has success:false plus error and
            message.
          content:
            application/json:
              schema:
                type: object
                required:
                  - success
                  - error
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                  message:
                    type: string
      security:
        - apiKeyHeader: []
        - bearerAuth: []
components:
  securitySchemes:
    apiKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
      description: Preferred. API key value directly.
    bearerAuth:
      type: http
      scheme: bearer
      description: Alternative. API key as the bearer token.

````