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

# Send a template message

> Sends an approved WhatsApp template message to a recipient phone number. Template messages can be sent outside the 24-hour customer service window. The template must already be APPROVED on the WABA, and the language code must match an approved variant. Component parameter order must match the template's placeholders.



## OpenAPI

````yaml /api-reference/openapi.json post /platforms/whatsapp/accounts/{id}/send-template
openapi: 3.0.0
info:
  description: >-
    Unified social media inbox API. Read and respond to comments, DMs, reviews,
    and mentions across Instagram, Facebook, Threads, Google Business Profile,
    TikTok, LinkedIn, and YouTube through a single REST API. X/Twitter and
    Trustpilot coming soon.
  title: SocialAPI.AI
  contact:
    name: SocialAPI.AI Support
    email: support@social-api.ai
  license:
    name: MIT
  version: '1.0'
servers:
  - url: https://api.social-api.ai/v1
security: []
paths:
  /platforms/whatsapp/accounts/{id}/send-template:
    post:
      tags:
        - WhatsApp
      summary: Send a template message
      description: >-
        Sends an approved WhatsApp template message to a recipient phone number.
        Template messages can be sent outside the 24-hour customer service
        window. The template must already be APPROVED on the WABA, and the
        language code must match an approved variant. Component parameter order
        must match the template's placeholders.
      parameters:
        - example: acc_01HZ9X3Q4R5M6N7P8V2K0W1J
          description: Connected account ID (sapi_acc_...)
          name: id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/api_endpoints.WhatsAppSendTemplateRequest'
        description: Recipient, template name, language, and components
        required: true
      responses:
        '200':
          description: Message accepted by WhatsApp
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/api_endpoints.WhatsAppSendTemplateResponse
        '400':
          description: Missing required field (to, template_name, language)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api_endpoints.ErrorResponse'
        '401':
          description: Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api_endpoints.ErrorResponse'
        '404':
          description: Account not found or not owned by caller
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api_endpoints.ErrorResponse'
        '429':
          description: Monthly interaction limit exceeded or platform rate limit
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api_endpoints.ErrorResponse'
        '502':
          description: >-
            WhatsApp/Meta upstream error (template not approved, invalid
            parameters)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api_endpoints.ErrorResponse'
      security:
        - BearerAuth: []
components:
  schemas:
    api_endpoints.WhatsAppSendTemplateRequest:
      type: object
      properties:
        components:
          description: >-
            Components carries header/body/button variable substitutions.

            Each component matches WhatsApp's template component schema (type +
            parameters).
          type: array
          items:
            $ref: '#/components/schemas/api_endpoints.WhatsAppTemplateComponent'
        language:
          description: >-
            Language is the BCP-47 code matching the template's approved
            language (e.g. en_US, fr_FR).
          type: string
          example: en_US
        template_name:
          description: TemplateName is the approved template name to send.
          type: string
          example: order_confirmation
        to:
          description: >-
            To is the recipient phone number in E.164 format without the leading
            "+".
          type: string
          example: '15551234567'
    api_endpoints.WhatsAppSendTemplateResponse:
      type: object
      properties:
        contacts:
          description: Contacts maps the input phone number to its canonical WhatsApp ID.
          type: array
          items:
            $ref: '#/components/schemas/api_endpoints.WhatsAppContact'
        messages:
          description: >-
            Messages contains one entry per delivered message, with its platform
            ID.
          type: array
          items:
            $ref: '#/components/schemas/api_endpoints.WhatsAppMessageRef'
        messaging_product:
          description: MessagingProduct is always "whatsapp".
          type: string
          example: whatsapp
    api_endpoints.ErrorResponse:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/api_endpoints.ErrorBody'
    api_endpoints.WhatsAppTemplateComponent:
      type: object
      properties:
        parameters:
          description: Parameters lists variable substitutions for this component.
          type: array
          items:
            $ref: '#/components/schemas/api_endpoints.WhatsAppTemplateParameter'
        type:
          description: 'Type is the component slot: header, body, or button.'
          type: string
          enum:
            - header
            - body
            - button
          example: body
    api_endpoints.WhatsAppContact:
      type: object
      properties:
        input:
          type: string
          example: '15551234567'
        wa_id:
          type: string
          example: '15551234567'
    api_endpoints.WhatsAppMessageRef:
      type: object
      properties:
        id:
          type: string
          example: wamid.HBgLMTU1NTEyMzQ1NjcVAgARGBI...
        message_status:
          type: string
          example: accepted
    api_endpoints.ErrorBody:
      type: object
      properties:
        code:
          type: string
          example: resource.not_found
        message:
          type: string
          example: Account not found
        meta:
          type: object
          additionalProperties: {}
    api_endpoints.WhatsAppTemplateParameter:
      type: object
      properties:
        text:
          description: Text is the substituted value when Type is "text".
          type: string
          example: John
        type:
          description: Type is the parameter type. Only "text" is supported today.
          type: string
          enum:
            - text
          example: text
  securitySchemes:
    BearerAuth:
      description: >-
        Prefix your API key with "Bearer ". Example: `Authorization: Bearer
        sapi_key_...`
      type: apiKey
      name: Authorization
      in: header

````