Render a template without saving or sending
Renders a stored template (template, by slug) or content you have not
saved (body) against the merge values in variables. Supply exactly
one of template and body. Nothing is written and no mail is sent,
which is why this needs only api.templates.view.
Read variables_unresolved before you send anything. A merge field the
template prints and your data does not carry renders as nothing in a
real inbox — and for a STORED template SES refuses the render outright,
which is a bounce rather than a blank. variables_used is the
complement: the fields the data did resolve.
With no variables at all, a template renders against an
auto-generated stub built from its own merge fields, so the shape of
the email is still visible.
Request body
Content type: application/json
template string optional Slug of a stored template to render.
body string optional Unsaved content to render instead.
subject string optional Rendered alongside body. Ignored with template, which uses the stored row's own subject.
variables object optional Merge values. With none, a template renders against an auto-generated stub built from its own merge fields.
Responses
Errors follow the RFC 7807 problem format — see the error reference.
slug string | null required The stored template rendered; null when body was rendered.
subject string required html string required text string required warnings array<object> required Each entry in warnings:
type string enum required One of: missing_variable, extra_variable, type_mismatch
variable string required expected string optional got string optional message string required direct boolean required Whether the template PRINTS this variable. Only a direct missing_variable fails an SES render; one used solely as a block-helper argument renders happily.
variables_used array<string> required Merge fields the template references that the supplied data resolved.
variables_unresolved array<string> required Merge fields the template references that the supplied data did NOT resolve. Read this before sending: an unresolved printed field renders blank in a real inbox, and SES refuses the render of a stored template outright.
validation_failed Problem. When the refusal is about a
reference — a segment key, template slug, topic or attribute name the
organization does not have — it additionally carries validation_code,
field, line/column, missing, candidates and next_step, so a
client can correct the call without a second round of guessing. See
ValidationProblem.
application/problem+json code is internal_error. The
request_id field can be quoted to SendOps support to investigate.
application/problem+json