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

# Update a template

> Any of `name`, `subject`, `html`, `text`. Setting `html` or `text` to null removes that part; one must remain.
A content change creates a new version; a rename does not. Requires `emails:send`.




## OpenAPI

````yaml /api-reference/openapi.yaml patch /v1/templates/{id}
openapi: 3.1.0
info:
  title: Sendbaze API
  version: '1.0'
  description: >
    Transactional email and SMS for Africa. Send from your own domain through
    Amazon SES in Cape Town.

    Every send returns an id immediately; delivery is reported by webhook and in
    the dashboard logs.
  contact:
    name: Sendbaze support
    email: support@sendbaze.com
    url: https://www.sendbaze.com
servers:
  - url: https://api.sendbaze.com
security:
  - bearerAuth: []
tags:
  - name: Emails
  - name: Templates
  - name: Domains
  - name: Suppressions
  - name: Webhooks
  - name: SMS
  - name: Usage
paths:
  /v1/templates/{id}:
    patch:
      tags:
        - Templates
      summary: Update a template
      description: >
        Any of `name`, `subject`, `html`, `text`. Setting `html` or `text` to
        null removes that part; one must remain.

        A content change creates a new version; a rename does not. Requires
        `emails:send`.
      operationId: updateTemplate
      parameters:
        - $ref: '#/components/parameters/TemplateId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateTemplateRequest'
            example:
              subject: Order {{order_id}} is on its way
      responses:
        '200':
          description: The updated template
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Template'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/Unprocessable'
components:
  parameters:
    TemplateId:
      name: id
      in: path
      required: true
      schema:
        type: string
        example: tpl_01j9x7k2r4m8q3v5n6b7c8d9e0
  schemas:
    UpdateTemplateRequest:
      type: object
      properties:
        name:
          type: string
          maxLength: 80
        subject:
          type: string
          maxLength: 998
        html:
          type:
            - string
            - 'null'
          description: null removes the part.
        text:
          type:
            - string
            - 'null'
    Template:
      type: object
      required:
        - id
        - name
        - subject
        - html
        - text
        - variables
        - version
        - createdAt
        - updatedAt
      properties:
        id:
          type: string
          example: tpl_01j9x7k2r4m8q3v5n6b7c8d9e0
        name:
          type: string
          example: order-shipped
        subject:
          type: string
        html:
          type:
            - string
            - 'null'
        text:
          type:
            - string
            - 'null'
        variables:
          type: array
          description: Placeholder names found in the subject, html and text.
          items:
            type: string
          example:
            - order_id
            - name
            - eta
        version:
          type: integer
          example: 1
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/ErrorBody'
    ErrorBody:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: Stable error code; see the errors reference.
          example: validation_error
        message:
          type: string
        docs:
          type: string
          format: uri
        fields:
          type: object
          description: Present on validation errors. Dotted path to messages.
          additionalProperties:
            type: array
            items:
              type: string
        limit:
          type: integer
          description: On `plan_limit`, the ceiling that was reached.
        upgradeUrl:
          type: string
          format: uri
          description: >-
            Where to change plan, when a bigger plan would have allowed the
            request.
        topUpUrl:
          type: string
          format: uri
          description: >-
            Where to add wallet funds, when a balance would have allowed the
            request.
        settingsUrl:
          type: string
          format: uri
          description: >-
            Where to change an organisation setting that blocked the request
            (SMS destinations).
        domainsUrl:
          type: string
          format: uri
          description: >-
            Where to add and verify a sending domain, on
            `sandbox_recipient_not_allowed` and `sandbox_limit_reached`.
  responses:
    NotFound:
      description: No such resource in your organisation
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: not_found
              message: No email with id em_x.
              docs: https://docs.sendbaze.com/errors#not_found
    Conflict:
      description: Idempotency conflict or duplicate name
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unprocessable:
      description: >-
        Validation failed, a recipient is suppressed, or an SMS destination is
        not supported (destination_not_supported)
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: validation_error
              message: The request has invalid fields.
              docs: https://docs.sendbaze.com/errors#validation_error
              fields:
                to.1:
                  - must be a valid email address
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        An API key from the dashboard. `sk_live_…` sends; `sk_test_…` validates
        and returns ids without sending.

````

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