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

# Create a message template

> Create a message template. It always lands in `draft`: nothing is sent with it and no registration is opened until you submit it for review.

In order to get access to this endpoint, contact our support team.


Create a message template. Only `name` is required, and the template always lands in `draft`: nothing is sent with it and no registration is opened until you [submit it for review](/notify/v2/api-reference/management/templates/submit-template).

The `variables` of the template are read from the `{{placeholder}}` names in your variants, so you never set them yourself. The same goes for `status` and `region_statuses`, which follow the review and the per-country registrations. While the template is a draft, every country in `region_statuses` reads `draft`.


## OpenAPI

````yaml post /v2/notify/management/templates
openapi: 3.1.0
info:
  title: Prelude API
  version: 2.0.0
  description: The Prelude API allows you to send messages to your users.
  contact:
    email: support@prelude.so
servers:
  - url: https://api.prelude.dev
    description: Production server
security:
  - apiToken: []
tags:
  - name: Notify
    description: Send transactional and marketing messages with compliance enforcement.
  - name: Transactional
    description: Send transactional messages (deprecated - use Notify API instead).
  - name: Verify
    description: Verify phone numbers.
  - name: Watch
    description: Evaluate email addresses and phone numbers for trustworthiness.
  - name: Lookup
    description: >-
      Retrieve detailed information about a phone number including carrier data,
      line type, and portability status.
paths:
  /v2/notify/management/templates:
    post:
      tags:
        - Notify
      summary: Create a message template
      description: >
        Create a message template. It always lands in `draft`: nothing is sent
        with it and no registration is opened until you submit it for review.


        In order to get access to this endpoint, contact our support team.
      operationId: createNotifyTemplate
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateNotifyTemplateRequest'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotifyTemplate'
        '400':
          description: KO
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Rate limited
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    CreateNotifyTemplateRequest:
      type: object
      required:
        - name
      properties:
        name:
          type: string
          description: The name of the template.
          examples:
            - Acme Receipts
        type:
          type: string
          description: What the template is used for. Defaults to `transactional`.
          enum:
            - transactional
            - marketing
        channels:
          type: array
          description: The channels the template should be delivered over.
          items:
            type: string
            enum:
              - sms
              - rcs
              - whatsapp
              - viber
              - zalo
              - telegram
        variants:
          type: array
          description: The wording of the message, one entry per locale.
          items:
            $ref: '#/components/schemas/NotifyTemplateVariant'
        default_locale:
          type: string
          description: >-
            The locale used when the recipient's own locale has no variant.
            Defaults to `en`.
          examples:
            - en
        countries:
          type: array
          description: The countries the template should work in.
          items:
            $ref: '#/components/schemas/NotifyTemplateCountry'
    NotifyTemplate:
      type: object
      required:
        - id
        - type
        - name
        - status
        - channels
        - variables
        - variants
        - default_locale
        - countries
        - region_statuses
        - created_at
      properties:
        id:
          type: string
          description: >-
            The identifier of the template, to pass as `template_id` when
            sending a message.
          examples:
            - template_01k8ap1btqf5r9fq2c8ax5fhc9
        type:
          type: string
          description: |
            What the template is used for. Possible values are:
              * `transactional` - A message triggered by an action of the recipient.
              * `marketing` - A promotional message, subject to marketing rules.
          enum:
            - transactional
            - marketing
        name:
          type: string
          description: The name of the template.
          examples:
            - Acme Receipts
        status:
          type: string
          description: |
            Where the template stands in the approval flow. Possible values are:
              * `draft` - Yours to edit. Nothing is sent with it yet.
              * `pending` - Submitted, and waiting on our review and on the per-country registrations.
              * `ready` - Approved and usable in every country you asked for.
              * `rejected` - Refused. Contact support for the reason.
          enum:
            - draft
            - pending
            - ready
            - rejected
        channels:
          type: array
          description: The channels the template can be delivered over.
          items:
            type: string
            enum:
              - sms
              - rcs
              - whatsapp
              - viber
              - zalo
              - telegram
        variables:
          type: array
          description: >-
            The placeholder names found in the variants, to fill in when
            sending.
          items:
            type: string
          examples:
            - - name
              - order_id
        variants:
          type: array
          description: The wording of the message, one entry per locale.
          items:
            $ref: '#/components/schemas/NotifyTemplateVariant'
        default_locale:
          type: string
          description: The locale used when the recipient's own locale has no variant.
          examples:
            - en
        countries:
          type: array
          description: >-
            The countries the template works in, with the monthly volume
            recorded for each.
          items:
            $ref: '#/components/schemas/NotifyTemplateCountry'
        region_statuses:
          type: object
          description: >-
            The readiness of the template per country, keyed by ISO 3166-1
            alpha-2 country code.
          additionalProperties:
            $ref: '#/components/schemas/NotifyTemplateRegionStatus'
        created_at:
          type: string
          format: date-time
          description: The date and time when the template was created.
          examples:
            - '2024-01-01T12:00:00Z'
    Error:
      type: object
      properties:
        code:
          type: string
          description: The error code.
          examples:
            - invalid_phone_number
        message:
          type: string
          examples:
            - >-
              The provided phone number is invalid. Provide a valid E.164 phone
              number.
          description: A human-readable message describing the error.
        type:
          type: string
          examples:
            - bad_request
          description: The error type.
        request_id:
          type: string
          examples:
            - 3d19215e-2991-4a05-a41a-527314e6ff6a
          description: >-
            A string that identifies this specific request. Report it back to us
            to help us diagnose your issues.
        param:
          type: string
          examples:
            - phone_number
          description: The parameter the error refers to, when it applies to a single one.
      required:
        - code
        - message
        - type
    NotifyTemplateVariant:
      type: object
      required:
        - locale
        - text
      properties:
        locale:
          type: string
          description: The BCP-47 locale this wording is written in.
          examples:
            - en
        text:
          type: string
          description: >-
            The message body, with `{{variable}}` placeholders for the values
            you pass when sending.
          examples:
            - Hi {{name}}, your order {{order_id}} shipped.
    NotifyTemplateCountry:
      type: object
      required:
        - country
      properties:
        country:
          type: string
          description: An ISO 3166-1 alpha-2 country code the template should work in.
          examples:
            - ES
        monthly_volume:
          type: integer
          description: >-
            The number of messages you expect to send to this country each
            month. Required, and at least 1000, for a country that needs a
            sender registration.
          examples:
            - 5000
    NotifyTemplateRegionStatus:
      type: object
      required:
        - status
        - requires_registration
      properties:
        status:
          type: string
          description: >
            How far this country is from being usable with the template.
            Possible values are:
              * `draft` - The template is still a draft, so nothing is sent with it in this country yet.
              * `pending` - Registration is needed in this country and is not ready yet.
              * `in_review` - The template was submitted and is being reviewed, along with the registration this country needs.
              * `ready` - The template can be used in this country.
              * `rejected` - The template was refused. Contact support for the reason.
          enum:
            - draft
            - pending
            - in_review
            - ready
            - rejected
        requires_registration:
          type: boolean
          description: >-
            Whether this country needs a sender registration before the template
            can be used there.
          examples:
            - true
  securitySchemes:
    apiToken:
      type: http
      scheme: bearer

````