---
title: "Render an email template"
method: POST
path: "/email_templates/{id}/render"
tags: ["Email Templates"]
---

# Render an email template

`POST /email_templates/{id}/render`

## Request

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

Renders a template using the provided Liquid variables. Missing `template_variables` defaults to `{}`.

When the template has `strict_variables` enabled and a required variable (per `variable_schema`) is missing, returns 422 naming the variable. When the template has `autoescape` enabled, the rendered `html_body` expression output is HTML-escaped at the output boundary; `subject` and `text_body` are not autoescaped.

## Path parameters

- `id` string, uuid, required

## Request body

- RenderEmailTemplateRequest
  - `template_variables` object: Variables for Liquid template rendering. Non-object values are silently treated as an empty object.

## Response `200`

Rendered template content.

- RenderedEmailTemplateResponse
  - `data` RenderedEmailTemplate, required: Template object with `subject`, `html_body`, and `text_body` replaced by their Liquid-rendered values. Rendered content is not limited by the stored template-field lengths. All other template fields remain unchanged.
    - `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`: Standalone template render failure (10015).

## Changes

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

[Operation history](https://skmtc.dev/team-telnyx/apis/telnyx-api/changes/email_templates/:id/render/post.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/432d76d72a80?raw)
