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

# Create message template

> Creates an email or WhatsApp message template. WhatsApp templates are submitted for provider approval.



## OpenAPI

````yaml /openapi.yaml post /v1/message-templates
openapi: 3.1.0
info:
  title: Quentli REST API
  version: 1.0.0
  description: OpenAPI spec for Quentli REST endpoints.
servers:
  - url: https://api.quentli.com
    description: Production API
  - url: https://api.staging.quentli.com
    description: Staging API for production-like validation
security:
  - organizationApiKey: []
  - oauthAccessToken: []
tags:
  - name: Auth
  - name: Management
  - name: Billing
  - name: Catalog
  - name: Customers
  - name: Invoices
  - name: Payment Methods
  - name: Payment Sessions
  - name: Payments
  - name: Subscriptions
  - name: Tax Invoices
  - name: Webhooks
  - name: Messaging
paths:
  /v1/message-templates:
    post:
      tags:
        - Messaging
      summary: Create message template
      description: >-
        Creates an email or WhatsApp message template. WhatsApp templates are
        submitted for provider approval.
      operationId: message_templates_create
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateMessageTemplateArgs'
      responses:
        '200':
          description: Message template created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageTemplatePayload'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserError'
        '401':
          description: Authentication required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserError'
        '403':
          description: Permission denied
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserError'
components:
  schemas:
    CreateMessageTemplateArgs:
      type: object
      properties:
        input:
          type: object
          properties:
            name:
              type: string
              minLength: 1
              maxLength: 191
            description:
              type:
                - string
                - 'null'
              maxLength: 1024
            channel:
              type: string
              enum:
                - EMAIL
                - SMS
                - WHATSAPP
            purpose:
              type:
                - string
                - 'null'
              enum:
                - PAYMENT_REMINDER_NEAR_DUE
                - PAYMENT_REMINDER_DUE
                - PAYMENT_REMINDER_NEAR_OVERDUE
                - DECLINED_PAYMENT
                - PAYMENT_RECEIPT
                - CARD_EXPIRY_NOTICE
                - WHATSAPP_OPT_IN
                - LOGIN_VERIFICATION_CODE
                - MESSAGE_PREVIEW_NOTIFICATION
                - PENDING_INVOICES_REMINDER
                - null
            emailTemplate:
              type: object
              properties:
                subject:
                  type: string
                  minLength: 1
                  maxLength: 512
                body:
                  type: string
                  minLength: 1
                linkText:
                  type:
                    - string
                    - 'null'
                  maxLength: 255
              required:
                - subject
                - body
            whatsappTemplate:
              type: object
              properties:
                name:
                  type: string
                  minLength: 1
                category:
                  type: string
                  enum:
                    - AUTHENTICATION
                    - FREE_SERVICE
                    - MARKETING
                    - UTILITY
                language:
                  type: string
                parameterFormat:
                  type: string
                  enum:
                    - NAMED
                    - POSITIONAL
                  default: POSITIONAL
                components:
                  type: array
                  items:
                    type: object
                    properties:
                      type:
                        type: string
                        enum:
                          - HEADER
                          - BODY
                          - FOOTER
                          - BUTTONS
                      text:
                        type: string
                      format:
                        anyOf:
                          - type: string
                            enum:
                              - TEXT
                              - IMAGE
                              - VIDEO
                              - DOCUMENT
                              - LOCATION
                          - type: string
                      buttons:
                        type: array
                        items:
                          type: object
                          properties:
                            type:
                              type: string
                              enum:
                                - PHONE_NUMBER
                                - URL
                                - QUICK_REPLY
                                - COPY_CODE
                                - OTP
                            text:
                              type: string
                              maxLength: 25
                            url:
                              type: string
                              format: uri
                            phoneNumber:
                              type: string
                            exampleCode:
                              type: string
                              maxLength: 15
                            urlExampleParam:
                              type: string
                              maxLength: 2000
                          required:
                            - type
                      example:
                        type: object
                        properties:
                          headerText:
                            type: string
                            minLength: 1
                          headerHandle:
                            type: string
                            minLength: 1
                          headerTextNamedParams:
                            type: array
                            items:
                              type: object
                              properties:
                                paramName:
                                  type: string
                                  minLength: 1
                                example:
                                  type: string
                                  minLength: 1
                              required:
                                - paramName
                                - example
                          bodyText:
                            type: array
                            items:
                              type: string
                              minLength: 1
                          bodyTextNamedParams:
                            type: array
                            items:
                              type: object
                              properties:
                                paramName:
                                  type: string
                                  minLength: 1
                                example:
                                  type: string
                                  minLength: 1
                              required:
                                - paramName
                                - example
                    required:
                      - type
                  minItems: 1
                allowCategoryChange:
                  type: boolean
                  default: true
                config:
                  type: object
                  properties:
                    variableMappings:
                      type: array
                      items:
                        type: object
                        properties:
                          component:
                            type: string
                            enum:
                              - HEADER
                              - BODY
                          paramName:
                            type: string
                            minLength: 1
                          variableName:
                            type: string
                            minLength: 1
                            description: >-
                              Literal text, or a runtime expression such as
                              {{organizacion.nombre}}.
                        required:
                          - component
                          - paramName
                          - variableName
                  required:
                    - variableMappings
              required:
                - name
                - category
                - language
                - components
          required:
            - name
            - channel
          additionalProperties: false
      required:
        - input
      description: Request body for creating a message template.
    MessageTemplatePayload:
      type: object
      properties:
        messageTemplate:
          $ref: '#/components/schemas/MessageTemplate'
      required:
        - messageTemplate
      description: The created or updated message template.
    UserError:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
          required:
            - message
      required:
        - error
      additionalProperties: false
      description: Standard user-facing error response envelope.
    MessageTemplate:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier of the message template.
          example: msgt_1234567890abcdefghij
        createdAt:
          type: string
          format: date-time
          description: When the template was created.
        updatedAt:
          type: string
          format: date-time
          description: When the template was last updated.
        organizationId:
          type: string
          description: Organization that owns the template.
        name:
          type: string
          description: Name of the template.
          example: Recordatorio de pago
        description:
          type:
            - string
            - 'null'
          description: Optional description of the template.
        channel:
          type: string
          enum:
            - EMAIL
            - SMS
            - WHATSAPP
          description: Channel the template is sent through.
        purpose:
          type:
            - string
            - 'null'
          enum:
            - PAYMENT_REMINDER_NEAR_DUE
            - PAYMENT_REMINDER_DUE
            - PAYMENT_REMINDER_NEAR_OVERDUE
            - DECLINED_PAYMENT
            - PAYMENT_RECEIPT
            - CARD_EXPIRY_NOTICE
            - WHATSAPP_OPT_IN
            - LOGIN_VERIFICATION_CODE
            - MESSAGE_PREVIEW_NOTIFICATION
            - PENDING_INVOICES_REMINDER
            - null
          description: Automatic message this template is the default for, if any.
        emailTemplate:
          type:
            - object
            - 'null'
          properties:
            id:
              type: string
              description: Unique identifier of the configuration.
            createdAt:
              type: string
              format: date-time
              description: When the configuration was created.
            updatedAt:
              type: string
              format: date-time
              description: When the configuration was last updated.
            organizationId:
              type: string
              description: Organization that owns the configuration.
            messageTemplateId:
              type: string
              description: Message template this configuration belongs to.
            subject:
              type: string
              description: Email subject. May contain variable placeholders.
            body:
              type: string
              description: Email body. May contain variable placeholders.
            linkText:
              type:
                - string
                - 'null'
              description: Payment link text. May contain variable placeholders.
          required:
            - id
            - createdAt
            - updatedAt
            - organizationId
            - messageTemplateId
            - subject
            - body
            - linkText
          description: Subject, body, and link text of an EMAIL template.
        smsTemplate:
          type:
            - object
            - 'null'
          properties:
            id:
              type: string
              description: Unique identifier of the configuration.
            createdAt:
              type: string
              format: date-time
              description: When the configuration was created.
            updatedAt:
              type: string
              format: date-time
              description: When the configuration was last updated.
            organizationId:
              type: string
              description: Organization that owns the configuration.
            messageTemplateId:
              type: string
              description: Message template this configuration belongs to.
            body:
              type: string
              description: SMS body. May contain variable placeholders.
          required:
            - id
            - createdAt
            - updatedAt
            - organizationId
            - messageTemplateId
            - body
          description: Body of an SMS template.
        whatsappTemplate:
          type:
            - object
            - 'null'
          properties:
            id:
              type: string
              description: Unique identifier of the configuration.
            createdAt:
              type: string
              format: date-time
              description: When the configuration was created.
            updatedAt:
              type: string
              format: date-time
              description: When the configuration was last updated.
            organizationId:
              type: string
              description: Organization that owns the configuration.
            messageTemplateId:
              type:
                - string
                - 'null'
              description: Message template this configuration belongs to.
            whatsappTemplateId:
              type:
                - string
                - 'null'
              description: WhatsApp template whose components contain the message content.
            variableMappings:
              type: array
              items:
                $ref: '#/components/schemas/WhatsappTemplateConfigVariableMapping'
              description: Values assigned to the WhatsApp template parameters.
          required:
            - id
            - createdAt
            - updatedAt
            - organizationId
            - messageTemplateId
            - whatsappTemplateId
            - variableMappings
          description: WhatsApp template and parameter values of a WHATSAPP template.
      required:
        - id
        - createdAt
        - updatedAt
        - organizationId
        - name
        - description
        - channel
        - purpose
        - emailTemplate
        - smsTemplate
        - whatsappTemplate
      description: An email or WhatsApp message template used by reminders and workflows.
    WhatsappTemplateConfigVariableMapping:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier of the configuration.
        createdAt:
          type: string
          format: date-time
          description: When the configuration was created.
        updatedAt:
          type: string
          format: date-time
          description: When the configuration was last updated.
        organizationId:
          type: string
          description: Organization that owns the configuration.
        whatsappTemplateConfigId:
          type: string
          description: WhatsApp configuration this mapping belongs to.
        component:
          type: string
          enum:
            - HEADER
            - BODY
          description: WhatsApp component containing the parameter.
        paramName:
          type: string
          description: WhatsApp template parameter name.
          example: customer_name
        variableName:
          type: string
          description: >-
            Literal text, or a runtime expression such as
            {{organizacion.nombre}}.
      required:
        - id
        - createdAt
        - updatedAt
        - organizationId
        - whatsappTemplateConfigId
        - component
        - paramName
        - variableName
      description: Value assigned to a WhatsApp template parameter.
  securitySchemes:
    organizationApiKey:
      type: http
      scheme: bearer
      description: 'Organization API key using `Authorization: Bearer sk_...`.'
    oauthAccessToken:
      type: http
      scheme: bearer
      bearerFormat: OAuth 2.1
      description: 'OAuth access token using `Authorization: Bearer qoa_at_...`.'

````

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