> ## 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.

# Create a message template

> Submits a new message template to the WhatsApp Business Account (WABA) for review. The request body is the raw WhatsApp Cloud API template payload (name, category, language, components). New templates start in PENDING status; Meta reviews them and the status transitions to APPROVED or REJECTED asynchronously.



## OpenAPI

````yaml /api-reference/openapi.json post /platforms/whatsapp/accounts/{id}/templates
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}/templates:
    post:
      tags:
        - WhatsApp
      summary: Create a message template
      description: >-
        Submits a new message template to the WhatsApp Business Account (WABA)
        for review. The request body is the raw WhatsApp Cloud API template
        payload (name, category, language, components). New templates start in
        PENDING status; Meta reviews them and the status transitions to APPROVED
        or REJECTED asynchronously.
      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.WhatsAppCreateTemplateRequest'
        description: Template definition
        required: true
      responses:
        '201':
          description: Created template (initial status)
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/api_endpoints.WhatsAppTemplateCreateResponse
        '400':
          description: Missing or invalid field
          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'
        '409':
          description: Template name already exists
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api_endpoints.ErrorResponse'
        '502':
          description: WhatsApp/Meta upstream error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api_endpoints.ErrorResponse'
      security:
        - BearerAuth: []
components:
  schemas:
    api_endpoints.WhatsAppCreateTemplateRequest:
      type: object
      properties:
        category:
          description: >-
            Category is the message category. Marketing intent in a UTILITY
            template triggers automatic rejection.
          type: string
          enum:
            - MARKETING
            - UTILITY
            - AUTHENTICATION
          example: UTILITY
        components:
          description: >-
            Components define the template body, optional header, optional
            footer, and optional buttons.

            At minimum one BODY component is required.
          type: array
          items:
            $ref: '#/components/schemas/api_endpoints.WhatsAppTemplateComponentDef'
        language:
          description: Language is the BCP-47 language code (e.g. en_US, fr_FR, pt_BR).
          type: string
          example: en_US
        name:
          description: >-
            Name is the template identifier. Lowercase letters, digits,
            underscores only; no spaces.
          type: string
          example: order_confirmation
    api_endpoints.WhatsAppTemplateCreateResponse:
      type: object
      properties:
        category:
          type: string
          enum:
            - AUTHENTICATION
            - MARKETING
            - UTILITY
          example: UTILITY
        id:
          type: string
          example: '1234567890123456'
        status:
          type: string
          enum:
            - APPROVED
            - PENDING
            - REJECTED
          example: PENDING
    api_endpoints.ErrorResponse:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/api_endpoints.ErrorBody'
    api_endpoints.WhatsAppTemplateComponentDef:
      type: object
      properties:
        buttons:
          description: >-
            Buttons populate a BUTTONS component (one of QUICK_REPLY, URL,
            PHONE_NUMBER, COPY_CODE).
          type: array
          items:
            $ref: '#/components/schemas/api_endpoints.WhatsAppTemplateButtonDef'
        example:
          description: >-
            Example carries WhatsApp's sample values, forwarded verbatim. For a
            TEXT

            BODY/HEADER it is {"body_text":[["v1","v2"]]} /
            {"header_text":["v1"]}; for

            a media HEADER it is {"header_handle":["<url-or-handle>"]}. Required
            for

            approval when the component contains variables.
          type: object
        format:
          description: Format is required for HEADER components.
          type: string
          enum:
            - TEXT
            - IMAGE
            - VIDEO
            - DOCUMENT
          example: TEXT
        text:
          description: >-
            Text is the literal text for HEADER (when Format is TEXT), BODY, or
            FOOTER components.

            May contain 1-indexed placeholders such as {{1}}, {{2}}.
          type: string
          example: Hello {{1}}, your order {{2}} is confirmed.
        type:
          description: Type is the component slot.
          type: string
          enum:
            - HEADER
            - BODY
            - FOOTER
            - BUTTONS
          example: BODY
    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.WhatsAppTemplateButtonDef:
      type: object
      properties:
        example:
          description: >-
            Example carries the button's sample value(s), forwarded verbatim: a
            dynamic

            URL example (["https://..."]) or a COPY_CODE sample ("250FF").
          type: object
        phone_number:
          description: >-
            PhoneNumber is required when Type is PHONE_NUMBER. E.164 format with
            leading "+".
          type: string
          example: '+15551234567'
        text:
          description: >-
            Text is the button label. Not required for COPY_CODE (WhatsApp
            auto-labels it).
          type: string
          example: Visit
        type:
          description: Type is the button kind.
          type: string
          enum:
            - QUICK_REPLY
            - URL
            - PHONE_NUMBER
            - COPY_CODE
          example: URL
        url:
          description: >-
            URL is required when Type is URL. May contain a single {{1}}
            placeholder.
          type: string
          example: https://example.com/{{1}}
  securitySchemes:
    BearerAuth:
      description: >-
        Prefix your API key with "Bearer ". Example: `Authorization: Bearer
        sapi_key_...`
      type: apiKey
      name: Authorization
      in: header

````