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

# Update template

> Update an existing template



## OpenAPI

````yaml /openapi.json put /v1/templates/{id}
openapi: 3.0.3
info:
  title: Emailr API
  version: 1.0.0
servers:
  - url: https://api.emailr.dev
    description: Production
security: []
tags:
  - name: emails
    description: Email sending and management
  - name: contacts
    description: Contact management
  - name: templates
    description: Email template management
  - name: domains
    description: Domain verification and management
  - name: webhooks
    description: Webhook configuration
  - name: broadcasts
    description: Broadcast campaign management
  - name: segments
    description: Contact segmentation
paths:
  /v1/templates/{id}:
    put:
      tags:
        - templates
      summary: Update template
      description: Update an existing template
      operationId: updateTemplate
      parameters:
        - schema:
            type: string
            format: uuid
            example: 123e4567-e89b-12d3-a456-426614174000
          required: true
          name: id
          in: path
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateTemplateRequest'
      responses:
        '200':
          description: Template updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Template'
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth: []
components:
  schemas:
    UpdateTemplateRequest:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          example: Welcome Email
        subject:
          type: string
          minLength: 1
          example: Welcome to {{company}}
        html_content:
          type: string
          example: <h1>Welcome {{name}}</h1>
        text_content:
          type: string
          example: Welcome {{name}}
        variables:
          type: array
          items:
            type: string
          example:
            - name
            - company
        from_email:
          type: string
          format: email
          description: Default from email address. Must match a verified domain.
          example: hello@example.com
        from_name:
          type: string
          description: Display name for the sender.
          example: Acme Inc
        reply_to:
          type: string
          format: email
          description: Reply-To email address for template-based emails.
          example: support@example.com
        preview_text:
          type: string
          description: Preview text (preheader) shown in email clients.
          example: Check out what's new...
        inbox_id:
          type: string
          nullable: true
          format: uuid
          description: >-
            Optional inbox ID. When provided, the inbox's name, from address,
            and reply-to address are used as defaults unless explicit values are
            given. Set to null to remove inbox association.
          example: 123e4567-e89b-12d3-a456-426614174000
        tags:
          type: array
          items:
            type: string
          description: Tags for categorization. Lowercase, max 50 chars each, max 20 tags.
          example:
            - newsletter
            - vip
    Template:
      type: object
      properties:
        id:
          type: string
          format: uuid
          example: 123e4567-e89b-12d3-a456-426614174000
        organization_id:
          type: string
          format: uuid
        name:
          type: string
        subject:
          type: string
        html_content:
          type: string
          nullable: true
        text_content:
          type: string
          nullable: true
        variables:
          type: array
          nullable: true
          items:
            type: string
        from_email:
          type: string
          nullable: true
        from_name:
          type: string
          nullable: true
        reply_to:
          type: string
          nullable: true
        preview_text:
          type: string
          nullable: true
        preview_html:
          type: string
          nullable: true
          description: Preview HTML content for AI agent review workflow
        inbox_id:
          type: string
          nullable: true
          format: uuid
          description: Associated inbox ID for sender identity defaults
          example: 123e4567-e89b-12d3-a456-426614174000
        tags:
          type: array
          items:
            type: string
          description: Tags for categorization.
          example:
            - newsletter
            - vip
        created_by:
          type: string
          nullable: true
          format: uuid
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
      required:
        - id
        - organization_id
        - name
        - subject
        - html_content
        - text_content
        - variables
        - from_email
        - from_name
        - reply_to
        - preview_text
        - preview_html
        - inbox_id
        - tags
        - created_by
        - created_at
        - updated_at
    Error:
      type: object
      properties:
        error:
          type: string
          example: An error occurred
        code:
          type: string
          example: VALIDATION_ERROR
        details: {}
      required:
        - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: API key authentication. Use your API key as the bearer token.

````