> ## 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.

# Update a message template

> Update a message template. This is a partial update: a field you omit keeps its stored value. Only a template still in `draft` can be updated.

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


Update a message template. This is a partial update: a field you omit keeps its stored value. `channels`, `variants` and `countries` are replaced as a whole when you send them.

Only a template still in `draft` can be updated. Once it is submitted, a change is refused with `template_not_editable`, because a template under review or already registered with providers cannot change underneath that process.


## OpenAPI

````yaml patch /v2/notify/management/templates/{template_id}
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/{template_id}:
    patch:
      tags:
        - Notify
      summary: Update a message template
      description: >
        Update a message template. This is a partial update: a field you omit
        keeps its stored value. Only a template still in `draft` can be updated.


        In order to get access to this endpoint, contact our support team.
      operationId: updateNotifyTemplate
      parameters:
        - name: template_id
          in: path
          required: true
          schema:
            type: string
          description: The identifier of the template.
          example: template_01k8ap1btqf5r9fq2c8ax5fhc9
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateNotifyTemplateRequest'
      responses:
        '200':
          description: OK
          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'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Rate limited
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    UpdateNotifyTemplateRequest:
      type: object
      description: >-
        A partial update. Every field is optional, and a field you omit keeps
        its stored value.
      properties:
        name:
          type: string
          description: The name of the template.
          examples:
            - Acme Receipts
        type:
          type: string
          description: What the template is used for.
          enum:
            - transactional
            - marketing
        channels:
          type: array
          description: >-
            The channels the template should be delivered over. Replaces the
            stored channels.
          items:
            type: string
            enum:
              - sms
              - rcs
              - whatsapp
              - viber
              - zalo
              - telegram
        variants:
          type: array
          description: >-
            The wording of the message, one entry per locale. Replaces the
            stored variants.
          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 should work in. Replaces the stored
            countries.
          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

````