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

# Update a template

> Updating a template's `body` creates a new version. Messages already queued continue to use the version that was current when they were sent.



## OpenAPI

````yaml PATCH /templates/{template_id}
openapi: 3.1.0
info:
  title: Pulsewave API
  description: >-
    Pulsewave is a messaging platform for sending transactional and marketing
    email, SMS, and push notifications. This specification documents every
    resource and operation exposed by the Pulsewave API.
  version: '2024-06-01'
  license:
    name: MIT
  contact:
    name: Pulsewave Developer Support
    url: https://pulsewave.dev/support
    email: developers@pulsewave.dev
servers:
  - url: https://api.pulsewave.dev/v1
    description: Production
  - url: https://api.sandbox.pulsewave.dev/v1
    description: Sandbox (test keys only)
security:
  - bearerAuth: []
tags:
  - name: Messages
    description: Send and inspect individual messages
  - name: Templates
    description: Reusable, versioned content for messages
  - name: Contacts
    description: People you send messages to
  - name: Lists
    description: Named groups of contacts
  - name: Domains
    description: Sending domains and their verification status
  - name: API Keys
    description: Credentials used to authenticate requests
  - name: Webhook Endpoints
    description: URLs that receive event notifications
  - name: Events
    description: Read-only log of everything that happened to a message
paths:
  /templates/{template_id}:
    patch:
      tags:
        - Templates
      summary: Update a template
      description: >-
        Updating a template's `body` creates a new version. Messages already
        queued continue to use the version that was current when they were sent.
      operationId: updateTemplate
      parameters:
        - $ref: '#/components/parameters/TemplateId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateTemplate'
      responses:
        '200':
          description: The updated template
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Template'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
components:
  parameters:
    TemplateId:
      name: template_id
      in: path
      required: true
      schema:
        type: string
        example: tmpl_8f3e2a
  schemas:
    UpdateTemplate:
      type: object
      properties:
        name:
          type: string
        subject:
          type: string
        body:
          type: string
    Template:
      type: object
      properties:
        id:
          type: string
          example: tmpl_8f3e2a
        object:
          type: string
          enum:
            - template
        name:
          type: string
        channel:
          $ref: '#/components/schemas/Channel'
        subject:
          type: string
          nullable: true
        body:
          type: string
        version:
          type: integer
          description: Incremented every time the body changes
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    Channel:
      type: string
      enum:
        - email
        - sms
        - push
      description: Delivery channel for a message
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            type:
              type: string
              enum:
                - invalid_request
                - authentication_error
                - not_found
                - validation_error
                - rate_limit_error
                - api_error
            code:
              type: string
              example: missing_required_field
            message:
              type: string
              example: The 'to' field is required for channel 'email'
            param:
              type: string
              nullable: true
              example: to
  responses:
    Unauthorized:
      description: Missing or invalid API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: The requested resource does not exist
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ValidationError:
      description: The request body failed validation
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        All requests must include `Authorization: Bearer <api_key>`. Keys are
        prefixed `pw_live_` or `pw_test_`. See
        [Authentication](/authentication).

````