---
title: "Replace an email template"
method: PUT
path: "/email_templates/{id}"
tags: ["Email Templates"]
---

# Replace an email template

`PUT /email_templates/{id}`

## Request

- Base URL: `https://api.telnyx.com/v2`
- URL: `https://api.telnyx.com/v2/email_templates/{id}`
- Auth: HTTP bearer

Replaces template fields. Behaves identically to PATCH; provided for compatibility with Phoenix resource routes.

## Path parameters

- `id` string, uuid, required

## Request body

- UpdateEmailTemplateRequest
  - `name` string
  - `subject` string, nullable: Liquid template subject.
  - `html_body` string, nullable: Liquid template HTML body.
  - `text_body` string, nullable: Liquid template text body.
  - `variables` string[], nullable: Persisted variable names. In `automatic` mode a non-null array is rejected; in `explicit` mode this is the exact manual array and each item is limited to 255 Unicode code points.
  - `variables_mode` 'automatic' | 'explicit': Controls how `variables` is maintained. Setting `automatic` re-extracts immediately from the effective subject, HTML body, and text body and rejects a simultaneous non-null array. Setting `explicit` requires the exact non-null array, including valid `[]`. With the mode omitted, a non-null array selects explicit mode, null selects automatic mode, and omitting both fields preserves the current mode. Source-content changes re-extract only in automatic mode.
  - `strict_variables` boolean: Per-template strict variable-validation setting.
  - `autoescape` boolean: Per-template HTML autoescaping setting.
  - `variable_schema` object, nullable: Structured variable requirements. Required variables cannot define defaults; invalid combinations return 422. Set to `null` to clear the schema.

## Response `200`

Template updated.

- EmailTemplateResponse
  - `data` EmailTemplate, required
    - `record_type` 'email_template', required
    - `id` string, uuid, required
    - `name` string, required
    - `html_body` string, nullable, required
    - `text_body` string, nullable, required
    - `variables` string[], required: Persisted variable names. In `explicit` mode this array preserves the exact provided order, duplicates, and string contents; in `automatic` mode it is derived from the stored subject and bodies.
    - `variables_mode` 'automatic' | 'explicit', required: `automatic` when variable names are derived from template content; `explicit` when `variables` is the exact manually managed array.
    - `strict_variables` boolean, required: Whether strict variable validation is enabled for this template. When `true`, sends and renders that are missing a variable marked `required: true` in `variable_schema` fail with 422 naming the variable.
    - `autoescape` boolean, required: Whether HTML autoescaping is enabled for this template. When `true`, only rendered `html_body` expression output is HTML-escaped at the output boundary; `subject` and `text_body` are never autoescaped.
    - `variable_schema` object, nullable, required: Structured variable requirements, or `null` when the template uses only the legacy `variables` array.
    - `created_at` string, date-time, required
    - `updated_at` string, date-time, required
    - `subject` string, nullable, required

## Other responses

- `401`: Not authorized (10006).
- `404`: Resource not found (10001).
- `422`: Validation Failed (10015) or changeset validation error.

## Changes

- **2026-10-15** `a72569d69430`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/team-telnyx/apis/telnyx-api/changes/email_templates/:id/put.md)

---

[API](https://skmtc.dev/team-telnyx/apis/telnyx-api.md) - [All operations](https://skmtc.dev/team-telnyx/apis/telnyx-api/llms.txt) - [OpenAPI document](https://skmtc.dev/team-telnyx/apis/telnyx-api/revisions/0f17b8167873?raw)
