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

# Create a message template

> Goes through Meta's normal PENDING → APPROVED review, same as the dashboard. Set `source_library_template_id` to adopt a pre-vetted Template Library entry (tracks provenance on the created template).



## OpenAPI

````yaml /openapi.json post /api/v1/templates/
openapi: 3.0.3
info:
  title: ChatBridge Public API
  version: 1.0.0
  description: >-
    Customer-facing REST API for ChatBridge — contacts, conversations, messages,
    templates, team, catalogue, tickets, and WhatsApp Flows. Authenticate with a
    workspace API key: `Authorization: Bearer cb_...`. See
    https://github.com/algosmiths/whatschat/blob/main/public_api.md for the full
    scope/versioning reference.
servers:
  - url: https://api.algosmiths.com
    description: Production
security: []
paths:
  /api/v1/templates/:
    post:
      tags:
        - Templates
      summary: Create a message template
      description: >-
        Goes through Meta's normal PENDING → APPROVED review, same as the
        dashboard. Set `source_library_template_id` to adopt a pre-vetted
        Template Library entry (tracks provenance on the created template).
      operationId: templates_create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MessageTemplateRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/MessageTemplateRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/MessageTemplateRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Template'
          description: ''
      security:
        - ApiKeyAuth: []
        - tokenAuth: []
        - CookieAuth: []
components:
  schemas:
    MessageTemplateRequest:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 512
        category:
          $ref: '#/components/schemas/CategoryEnum'
        allow_category_change:
          type: boolean
          default: true
        language:
          allOf:
            - $ref: '#/components/schemas/LanguageEnum'
          default: en_US
        components:
          type: array
          items:
            $ref: '#/components/schemas/ComponentRequest'
        source_library_template_id:
          type: integer
          writeOnly: true
        whatsapp_business_account_id:
          type: integer
          description: >-
            Provide the WhatsApp Business Account ID. If multiple accounts are
            present, provide the account ID otherwise it will be defaulted to
            the first account
      required:
        - category
        - components
        - name
    Template:
      type: object
      properties:
        business_account_id:
          type: string
        whatsapp_account_id:
          type: string
        template_id:
          type: string
          maxLength: 255
        name:
          type: string
          maxLength: 512
        components: {}
        language:
          type: string
          maxLength: 8
        status:
          $ref: '#/components/schemas/TemplateStatusEnum'
        category:
          $ref: '#/components/schemas/CategoryEnum'
        quality_score:
          $ref: '#/components/schemas/QualityScoreEnum'
        business_account:
          type: integer
        source_library_template:
          type: integer
          nullable: true
      required:
        - business_account
        - business_account_id
        - category
        - components
        - language
        - name
        - status
        - template_id
        - whatsapp_account_id
    CategoryEnum:
      enum:
        - ACCOUNT_UPDATE
        - PAYMENT_UPDATE
        - PERSONAL_FINANCE_UPDATE
        - SHIPPING_UPDATE
        - RESERVATION_UPDATE
        - ISSUE_RESOLUTION
        - APPOINTMENT_UPDATE
        - TRANSPORTATION_UPDATE
        - TICKET_UPDATE
        - ALERT_UPDATE
        - AUTO_REPLY
        - TRANSACTIONAL
        - OTP
        - UTILITY
        - MARKETING
        - AUTHENTICATION
      type: string
      description: |-
        * `ACCOUNT_UPDATE` - ACCOUNT_UPDATE
        * `PAYMENT_UPDATE` - PAYMENT_UPDATE
        * `PERSONAL_FINANCE_UPDATE` - PERSONAL_FINANCE_UPDATE
        * `SHIPPING_UPDATE` - SHIPPING_UPDATE
        * `RESERVATION_UPDATE` - RESERVATION_UPDATE
        * `ISSUE_RESOLUTION` - ISSUE_RESOLUTION
        * `APPOINTMENT_UPDATE` - APPOINTMENT_UPDATE
        * `TRANSPORTATION_UPDATE` - TRANSPORTATION_UPDATE
        * `TICKET_UPDATE` - TICKET_UPDATE
        * `ALERT_UPDATE` - ALERT_UPDATE
        * `AUTO_REPLY` - AUTO_REPLY
        * `TRANSACTIONAL` - TRANSACTIONAL
        * `OTP` - OTP
        * `UTILITY` - UTILITY
        * `MARKETING` - MARKETING
        * `AUTHENTICATION` - AUTHENTICATION
    LanguageEnum:
      enum:
        - af
        - sq
        - ar
        - az
        - bn
        - bg
        - ca
        - zh_CN
        - zh_HK
        - zh_TW
        - hr
        - cs
        - da
        - nl
        - en
        - en_GB
        - en_US
        - et
        - fil
        - fi
        - fr
        - ka
        - de
        - el
        - gu
        - ha
        - he
        - hi
        - hu
        - id
        - ga
        - it
        - ja
        - kn
        - kk
        - rw_RW
        - ko
        - ky_KG
        - lo
        - lv
        - lt
        - mk
        - ms
        - ml
        - mr
        - nb
        - fa
        - pl
        - pt_BR
        - pt_PT
        - pa
        - ro
        - ru
        - sr
        - sk
        - sl
        - es
        - es_AR
        - es_ES
        - es_MX
        - sw
        - sv
        - ta
        - te
        - th
        - tr
        - uk
        - ur
        - uz
        - vi
        - zu
      type: string
      description: |-
        * `af` - af
        * `sq` - sq
        * `ar` - ar
        * `az` - az
        * `bn` - bn
        * `bg` - bg
        * `ca` - ca
        * `zh_CN` - zh_CN
        * `zh_HK` - zh_HK
        * `zh_TW` - zh_TW
        * `hr` - hr
        * `cs` - cs
        * `da` - da
        * `nl` - nl
        * `en` - en
        * `en_GB` - en_GB
        * `en_US` - en_US
        * `et` - et
        * `fil` - fil
        * `fi` - fi
        * `fr` - fr
        * `ka` - ka
        * `de` - de
        * `el` - el
        * `gu` - gu
        * `ha` - ha
        * `he` - he
        * `hi` - hi
        * `hu` - hu
        * `id` - id
        * `ga` - ga
        * `it` - it
        * `ja` - ja
        * `kn` - kn
        * `kk` - kk
        * `rw_RW` - rw_RW
        * `ko` - ko
        * `ky_KG` - ky_KG
        * `lo` - lo
        * `lv` - lv
        * `lt` - lt
        * `mk` - mk
        * `ms` - ms
        * `ml` - ml
        * `mr` - mr
        * `nb` - nb
        * `fa` - fa
        * `pl` - pl
        * `pt_BR` - pt_BR
        * `pt_PT` - pt_PT
        * `pa` - pa
        * `ro` - ro
        * `ru` - ru
        * `sr` - sr
        * `sk` - sk
        * `sl` - sl
        * `es` - es
        * `es_AR` - es_AR
        * `es_ES` - es_ES
        * `es_MX` - es_MX
        * `sw` - sw
        * `sv` - sv
        * `ta` - ta
        * `te` - te
        * `th` - th
        * `tr` - tr
        * `uk` - uk
        * `ur` - ur
        * `uz` - uz
        * `vi` - vi
        * `zu` - zu
    ComponentRequest:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/ComponentTypeEnum'
        format:
          $ref: '#/components/schemas/FormatEnum'
        text:
          type: string
          minLength: 1
        buttons:
          type: array
          items:
            $ref: '#/components/schemas/ButtonRequest'
        example:
          $ref: '#/components/schemas/ExampleRequest'
        add_security_recommendation:
          type: boolean
          description: Add security recommendation for AUTHENTICATION templates
        code_expiration_minutes:
          type: integer
          description: Code expiration time in minutes for AUTHENTICATION templates
      required:
        - type
    TemplateStatusEnum:
      enum:
        - APPROVED
        - IN_APPEAL
        - PENDING
        - REJECTED
        - PENDING_DELETION
        - DELETED
        - DISABLED
        - PAUSED
        - LIMIT_EXCEEDED
        - ARCHIVED
      type: string
      description: |-
        * `APPROVED` - APPROVED
        * `IN_APPEAL` - IN_APPEAL
        * `PENDING` - PENDING
        * `REJECTED` - REJECTED
        * `PENDING_DELETION` - PENDING_DELETION
        * `DELETED` - DELETED
        * `DISABLED` - DISABLED
        * `PAUSED` - PAUSED
        * `LIMIT_EXCEEDED` - LIMIT_EXCEEDED
        * `ARCHIVED` - ARCHIVED
    QualityScoreEnum:
      enum:
        - GREEN
        - YELLOW
        - RED
        - UNKNOWN
        - BLANK
      type: string
      description: |-
        * `GREEN` - GREEN
        * `YELLOW` - YELLOW
        * `RED` - RED
        * `UNKNOWN` - UNKNOWN
        * `BLANK` - BLANK
    ComponentTypeEnum:
      enum:
        - HEADER
        - BODY
        - FOOTER
        - BUTTONS
      type: string
      description: |-
        * `HEADER` - HEADER
        * `BODY` - BODY
        * `FOOTER` - FOOTER
        * `BUTTONS` - BUTTONS
    FormatEnum:
      enum:
        - TEXT
        - IMAGE
        - VIDEO
        - DOCUMENT
        - LOCATION
      type: string
      description: |-
        * `TEXT` - TEXT
        * `IMAGE` - IMAGE
        * `VIDEO` - VIDEO
        * `DOCUMENT` - DOCUMENT
        * `LOCATION` - LOCATION
    ButtonRequest:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/ButtonTypeEnum'
        text:
          type: string
          minLength: 1
        phone_number:
          type: string
          minLength: 1
        url:
          type: string
          format: uri
          minLength: 1
        otp_type:
          $ref: '#/components/schemas/OtpTypeEnum'
        autofill_text:
          type: string
          minLength: 1
        package_name:
          type: string
          minLength: 1
        signature_hash:
          type: string
          minLength: 1
        example:
          type: array
          items:
            type: string
            minLength: 1
        zero_tap_terms_accepted:
          type: boolean
        supported_apps:
          type: array
          items:
            $ref: '#/components/schemas/SupportedAppRequest'
        active_for_days:
          type: integer
      required:
        - text
        - type
    ExampleRequest:
      type: object
      properties:
        header_text:
          type: array
          items:
            type: string
            minLength: 1
        header_handle:
          type: array
          items:
            type: string
            minLength: 1
        body_text:
          type: array
          items:
            type: array
            items:
              type: string
              minLength: 1
    ButtonTypeEnum:
      enum:
        - QUICK_REPLY
        - URL
        - PHONE_NUMBER
        - OTP
        - CATALOG
        - FLOW
        - VOICE_CALL
        - APP
        - MPM
      type: string
      description: |-
        * `QUICK_REPLY` - QUICK_REPLY
        * `URL` - URL
        * `PHONE_NUMBER` - PHONE_NUMBER
        * `OTP` - OTP
        * `CATALOG` - CATALOG
        * `FLOW` - FLOW
        * `VOICE_CALL` - VOICE_CALL
        * `APP` - APP
        * `MPM` - MPM
    OtpTypeEnum:
      enum:
        - COPY_CODE
        - ONE_TAP
        - ZERO_TAP
      type: string
      description: |-
        * `COPY_CODE` - COPY_CODE
        * `ONE_TAP` - ONE_TAP
        * `ZERO_TAP` - ZERO_TAP
    SupportedAppRequest:
      type: object
      properties:
        package_name:
          type: string
          minLength: 1
        signature_hash:
          type: string
          minLength: 11
          maxLength: 11
      required:
        - package_name
        - signature_hash
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: cb_...
      description: >-
        Workspace API key, e.g. `Authorization: Bearer cb_live_...`. Create one
        in Settings → API Keys. See public_api.md § 3 for scopes.
    tokenAuth:
      type: apiKey
      in: header
      name: Authorization
      description: Token-based authentication with required prefix "Token"
    CookieAuth:
      type: apiKey
      in: cookie
      name: token
      description: Dashboard session cookie — internal use only, not the public contract.

````