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

# Create a message template

> Creates a template as a local draft. A draft cannot be used for sending until it has been submitted to Meta and approved.



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/whatsapp_templates
openapi: 3.1.0
info:
  contact:
    email: suporte@izap.ai
    name: iZap API Support
  description: Public REST API for the iZap WhatsApp business messaging platform.
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
  title: iZap API
  version: v1
servers:
  - description: Production
    url: https://api.izap.ai
  - description: Staging
    url: https://api-staging.izap.ai
security: []
tags:
  - description: >-
      Personal access tokens for calling this API, plus introspection of the
      token presented on a request.
    name: api-tokens
  - description: >-
      Create a business, read and update its profile, and manage its opening
      hours.
    name: businesses
  - description: >-
      Reusable images belonging to the caller's business, referenced when
      composing messages.
    name: business-library
  - description: Product catalog menus a business publishes to its customers.
    name: menus
  - description: >-
      Provision and inspect the WhatsApp Cloud API numbers attached to a
      business: registration, WABA details, per-number assistant binding and
      catalog sends.
    name: whatsapp-cloud
  - description: >-
      Conversation lifecycle — list, create and delete chats, and control read,
      snooze, status and AI pause state.
    name: chats
  - description: >-
      Read a conversation's messages, send free-form or template replies, and
      upload attachments.
    name: messages
  - description: >-
      Manage WhatsApp message templates: draft them locally, submit them to Meta
      for review and sync approval status back.
    name: whatsapp-templates
  - description: >-
      Bulk template sends. A transmission is previewed into a draft, then
      confirmed or cancelled — confirming dispatches to real recipients.
    name: transmissions
  - description: >-
      Register URLs that receive signed event deliveries when something happens
      in a business, rotate their signing secrets, and replay an individual
      delivery.
    name: webhooks
  - description: >-
      Server-rendered order visualisation page for a business slug, behind HTTP
      Basic auth.
    name: orders
paths:
  /api/v1/whatsapp_templates:
    post:
      tags:
        - whatsapp-templates
      summary: Create a message template
      description: >-
        Creates a template as a local draft. A draft cannot be used for sending
        until it has been submitted to Meta and approved.
      operationId: createWhatsAppTemplate
      parameters:
        - in: header
          name: business-id
          required: true
          schema:
            format: uuid
            title: Business-Id
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WhatsAppTemplateCreate'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WhatsAppTemplateOut'
          description: Successful Response
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
          description: Missing or invalid credentials.
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
          description: The credential is valid but not authorized for this action.
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
          description: The resource, or the business named in the request, does not exist.
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
        default:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
          description: Unexpected error.
      security:
        - bearerAuth: []
components:
  schemas:
    WhatsAppTemplateCreate:
      properties:
        body_text:
          maxLength: 1024
          minLength: 1
          title: Body Text
          type: string
        buttons:
          items:
            $ref: '#/components/schemas/TemplateButton'
          title: Buttons
          type: array
        category:
          $ref: '#/components/schemas/TemplateCategory'
          default: utility
        display_name:
          anyOf:
            - maxLength: 512
              type: string
            - type: 'null'
          title: Display Name
        example_variables:
          items:
            type: string
          title: Example Variables
          type: array
        footer_text:
          anyOf:
            - maxLength: 60
              type: string
            - type: 'null'
          title: Footer Text
        header_format:
          $ref: '#/components/schemas/TemplateHeaderFormat'
          default: none
        header_text:
          anyOf:
            - maxLength: 60
              type: string
            - type: 'null'
          title: Header Text
        language:
          default: pt_BR
          maxLength: 10
          title: Language
          type: string
        name:
          maxLength: 512
          minLength: 1
          pattern: ^[a-z0-9_]+$
          title: Name
          type: string
      required:
        - name
        - body_text
      title: WhatsAppTemplateCreate
      type: object
    WhatsAppTemplateOut:
      properties:
        body_text:
          maxLength: 1024
          minLength: 1
          title: Body Text
          type: string
        business_id:
          format: uuid
          title: Business Id
          type: string
        buttons:
          items:
            $ref: '#/components/schemas/TemplateButtonOut'
          title: Buttons
          type: array
        category:
          $ref: '#/components/schemas/TemplateCategory'
          default: utility
        created:
          format: date-time
          title: Created
          type: string
        display_name:
          anyOf:
            - maxLength: 512
              type: string
            - type: 'null'
          title: Display Name
        example_variables:
          items:
            type: string
          title: Example Variables
          type: array
        footer_text:
          anyOf:
            - maxLength: 60
              type: string
            - type: 'null'
          title: Footer Text
        header_format:
          $ref: '#/components/schemas/TemplateHeaderFormat'
          default: none
        header_text:
          anyOf:
            - maxLength: 60
              type: string
            - type: 'null'
          title: Header Text
        id:
          format: uuid
          title: Id
          type: string
        language:
          default: pt_BR
          maxLength: 10
          title: Language
          type: string
        last_synced_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Last Synced At
        modified:
          format: date-time
          title: Modified
          type: string
        name:
          maxLength: 512
          minLength: 1
          pattern: ^[a-z0-9_]+$
          title: Name
          type: string
        provider_template_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Provider Template Id
        quality_score:
          anyOf:
            - type: string
            - type: 'null'
          title: Quality Score
        rejection_reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Rejection Reason
        status:
          $ref: '#/components/schemas/TemplateStatus'
      required:
        - name
        - body_text
        - id
        - business_id
        - status
        - created
        - modified
      title: WhatsAppTemplateOut
      type: object
    ApiError:
      description: >-
        The response body of a handled API error.


        ``detail`` is either a plain string (FastAPI's default for an

        ``HTTPException`` raised with a string, and for the ``default``
        fastapi-users

        messages like ``"Not authenticated"``) or the structured

        :class:`ApiErrorDetail` object described above. ``code`` is present only
        on

        the top-level shape ``aizap.core.exceptions.AppException`` produces for
        its

        own 5xx responses (``"INTERNAL_ERROR"`` / ``"DB_ERROR"``); it does not

        duplicate the ``code`` nested inside a structured ``detail``.
      properties:
        code:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Code
        detail:
          anyOf:
            - type: string
            - $ref: '#/components/schemas/ApiErrorDetail'
          title: Detail
      required:
        - detail
      title: ApiError
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    TemplateButton:
      description: >-
        A single template button.


        ``type`` is one of QUICK_REPLY, URL, PHONE_NUMBER. URL/PHONE_NUMBER
        buttons

        carry the corresponding ``url``/``phone_number`` field.
      properties:
        phone_number:
          anyOf:
            - type: string
            - type: 'null'
          title: Phone Number
        text:
          maxLength: 25
          title: Text
          type: string
        type:
          description: QUICK_REPLY | URL | PHONE_NUMBER
          title: Type
          type: string
        url:
          anyOf:
            - type: string
            - type: 'null'
          title: Url
      required:
        - type
        - text
      title: TemplateButton
      type: object
    TemplateCategory:
      description: WhatsApp/Meta template category. Drives approval rules and pricing.
      enum:
        - marketing
        - utility
        - authentication
      title: TemplateCategory
      type: string
    TemplateHeaderFormat:
      enum:
        - none
        - text
        - image
        - video
        - document
      title: TemplateHeaderFormat
      type: string
    TemplateButtonOut:
      description: >-
        Stored/returned button. Label length is uncapped so synced templates can
        be listed.
      properties:
        phone_number:
          anyOf:
            - type: string
            - type: 'null'
          title: Phone Number
        text:
          title: Text
          type: string
        type:
          description: QUICK_REPLY | URL | PHONE_NUMBER
          title: Type
          type: string
        url:
          anyOf:
            - type: string
            - type: 'null'
          title: Url
      required:
        - type
        - text
      title: TemplateButtonOut
      type: object
    TemplateStatus:
      description: >-
        Lifecycle/approval status of a template.


        DRAFT is local-only (not yet submitted to Meta). The remaining values
        mirror

        the statuses returned by the WhatsApp Cloud API.
      enum:
        - draft
        - pending
        - approved
        - rejected
        - paused
        - disabled
      title: TemplateStatus
      type: string
    ApiErrorDetail:
      additionalProperties: true
      description: |-
        The structured ``detail`` object some error responses carry.

        Several handlers (the REST API plan gate, the free-tier limits, the
        webhooks entitlement gate, the closed customer-service window) raise
        ``HTTPException(detail={"code": ..., "message": ..., ...})`` — a fixed
        ``code``/``message`` pair plus extra fields specific to that error.
        ``extra="allow"`` keeps those fields in the documented shape instead of
        dropping them.
      properties:
        code:
          title: Code
          type: string
        message:
          title: Message
          type: string
      required:
        - code
        - message
      title: ApiErrorDetail
      type: object
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
  securitySchemes:
    bearerAuth:
      description: >-
        Personal access token (izap_pat_…) sent as Authorization: Bearer
        <token>; dashboard session JWTs are also accepted.
      scheme: bearer
      type: http

````