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

# Create a WhatsApp template

> Checked against Meta's rules, then sent to Meta for review: the template is PENDING until Meta approves it (webhook `template.status_updated`). Refused by Meta: nothing is kept and the error says why.



## OpenAPI

````yaml /api-reference/v2.0/openapi.json post /templates
openapi: 3.1.0
info:
  title: Shortext API
  description: >-
    **Versioning**: every version is a frozen contract. A released version only
    receives additive changes

    (new endpoints, new optional fields, new response fields); anything breaking
    ships in a new version.

    Responses carry `X-Shortext-Api-Version`. When a version is scheduled for
    removal, responses also carry

    `Deprecation` and `Sunset` headers; after the sunset date the version
    answers HTTP 410.

    The list of versions and their status is available at `GET /api/versions`.


    **Responses**: always HTTP 200. Check `success` and `code` (`1000` =
    success), see `ApiEnvelope`.

    On failure, `trace_id` identifies the request for support.


    **Rate limit**: 300 requests per minute per company, shared by all its keys
    and by every API version.

    Responses carry `X-RateLimit-Limit` and `X-RateLimit-Remaining`; beyond the
    limit the API answers

    HTTP 429 with `Retry-After` (seconds) and the usual envelope. Prefer
    webhooks to polling.
  version: '2.0'
servers:
  - url: https://shortext.ny-corp.io/api/v2.0
security: []
tags:
  - name: Agents
    description: Agents
  - name: Knowledge
    description: Knowledge
  - name: Dynamic links
    description: Dynamic links
  - name: Billing
    description: Billing
  - name: Channels
    description: Channels
  - name: Conversations
    description: Conversations
  - name: Account
    description: Account
  - name: Tickets
    description: Tickets
  - name: Templates
    description: Templates
  - name: Hosted sessions
    description: Hosted sessions
  - name: Webhooks
    description: Webhooks
paths:
  /templates:
    post:
      tags:
        - Templates
      summary: Create a WhatsApp template
      description: >-
        Checked against Meta's rules, then sent to Meta for review: the template
        is PENDING until Meta approves it (webhook `template.status_updated`).
        Refused by Meta: nothing is kept and the error says why.
      operationId: createTemplate
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TemplateInput'
      responses:
        '200':
          description: >-
            Always HTTP 200: the outcome is in `success` and `code` (absolute
            value of the response code).
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/ApiEnvelope'
                  - properties:
                      body:
                        $ref: '#/components/schemas/Template'
                    type: object
      security:
        - bearerAuth: []
components:
  schemas:
    TemplateInput:
      properties:
        channel_id:
          description: >-
            Creation: a WhatsApp number of the company; the template belongs to
            its WhatsApp Business Account and every number of that account can
            send it
          type: string
        name:
          description: >-
            Creation: normalized for Meta (`Order update` becomes
            `order_update`)
          type: string
        language:
          description: Creation
          type: string
          example: fr
        category:
          description: >-
            Creation. A utility body has at least one variable; an
            authentication template only takes `authentication`
          type: string
          enum:
            - MARKETING
            - UTILITY
            - AUTHENTICATION
        header:
          properties:
            type:
              type: string
              enum:
                - NONE
                - TEXT
                - IMAGE
                - VIDEO
                - DOCUMENT
            text:
              description: 'TEXT: 60 characters, one variable at most'
              type: string
            examples:
              description: '`{ variable: example }`'
              type: object
            media_url:
              description: 'IMAGE, VIDEO, DOCUMENT: a public link to the file'
              type: string
          type: object
        body:
          properties:
            text:
              description: Variables like `{{order_number}}`, not at the very start or end
              type: string
              example: Hello {{name}}, your order {{order_number}} is ready.
            examples:
              description: 'One example per variable: Meta reviews the template with them'
              type: object
              example:
                name: Awa
                order_number: A-42
          type: object
        footer:
          description: 60 characters, no variable
          type:
            - string
            - 'null'
        buttons:
          description: >-
            Up to 10: quick replies grouped together, 2 links, 1 call, 1 copy
            code (marketing). A link with `{{1}}` at the end of the URL needs an
            `example`
          type: array
          items:
            properties:
              type:
                type: string
                enum:
                  - QUICK_REPLY
                  - URL
                  - PHONE_NUMBER
                  - COPY_CODE
              text:
                type: string
                maxLength: 25
              url:
                type: string
                example: https://shop.example/orders/{{1}}
              example:
                description: 'URL: the full example link; COPY_CODE: an example code'
                type: string
              phone_number:
                type: string
                example: '+237690000000'
            type: object
        authentication:
          properties:
            add_security_recommendation:
              type: boolean
              default: true
            code_expiration_minutes:
              type:
                - integer
                - 'null'
              maximum: 90
              minimum: 1
            otp_type:
              type: string
              default: COPY_CODE
              enum:
                - COPY_CODE
                - ONE_TAP
            package_name:
              description: 'ONE_TAP: the Android app'
              type: string
            signature_hash:
              description: 'ONE_TAP: 11 characters'
              type: string
          type: object
      type: object
    ApiEnvelope:
      properties:
        success:
          type: boolean
          example: true
        code:
          type: integer
          example: 1000
        message:
          type: string
          example: Request success.
        body:
          description: Endpoint payload, null when there is none
        token:
          description: Present only on authentication routes
          type:
            - string
            - 'null'
        trace_id:
          description: Present only when success is false
          type:
            - string
            - 'null'
      type: object
    Template:
      properties:
        id:
          description: >-
            Public representation of a WhatsApp template (API v2.0). A template
            belongs to a WhatsApp Business

            Account: every number of that account can send it (`channels`).
          type: string
        name:
          description: message.content.template_name
          type: string
          example: order_update
        language:
          description: message.content.language
          type: string
          example: fr
        status:
          description: Only APPROVED templates can be sent
          type: string
          enum:
            - APPROVED
            - PENDING
            - REJECTED
        rejection_reason:
          type:
            - string
            - 'null'
        quality:
          type:
            - string
            - 'null'
          example: GREEN
        category:
          type:
            - string
            - 'null'
          example: UTILITY
        channels:
          description: WhatsApp channel ids (channel_id) of the company that can send it
          type: array
          items:
            type: string
        header:
          properties:
            type:
              type: string
              enum:
                - NONE
                - TEXT
                - IMAGE
                - VIDEO
                - DOCUMENT
            text:
              type:
                - string
                - 'null'
            variables:
              description: 'TEXT header: `message.content.header` = `{ name: value }`'
              type: array
              items:
                type: string
            media_url:
              description: 'Media header: sent when message.content.header.url is not given'
              type:
                - string
                - 'null'
          type: object
        body:
          properties:
            text:
              type: string
              example: Hello {{name}}, your order {{order}} is ready.
            variables:
              description: '`message.content.body` = `{ name: value }`'
              type: array
              items:
                type: string
              example:
                - name
                - order
          type: object
        footer:
          type:
            - string
            - 'null'
        buttons:
          description: >-
            In order: `message.content.buttons` = `{ index: value }` for the
            buttons that need a value
          type: array
          items:
            properties:
              index:
                type: integer
                example: 0
              type:
                type: string
                enum:
                  - QUICK_REPLY
                  - URL
                  - PHONE_NUMBER
                  - COPY_CODE
                  - OTP
                example: URL
              text:
                type:
                  - string
                  - 'null'
              needs_value:
                description: >-
                  A dynamic link (its end), a copy code button (the coupon) or
                  the code of an authentication template (or send
                  `message.content.code`)
                type: boolean
            type: object
        updated_at:
          type: string
          format: date-time
      type: object
  securitySchemes:
    bearerAuth:
      type: http
      description: >-
        Company API key, sent as `Authorization: Bearer <key>`. Create it in the
        dashboard (Developer > API Keys) with the permissions the integration
        needs.
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.