Render a saved templateMenu

Render a saved template

POST/v1/templates/{id}/render

Requires an API key with the templates:read scope. About keys and scopes

Works with integration, agent and partner keys.

Reads only: safe to retry. About idempotency

Renders a saved template to the subject, HTML and plain text a recipient would get, without sending or changing anything. By default it renders the published version, which is what sends use, drawn with the brand and shared blocks it was published with; pass "draft": true for the draft as it stands now, or "version" for an earlier published version. Rendering the published version of a template never published is 409 TEMPLATE_NOT_PUBLISHED. Merge tags show their defaults, or pass contact to render them as that contact would see them, and data for what a send's data would carry. warnings flags problems that do not stop rendering, such as an oversized message.

Path parameters

idstringrequired

The template's id.

uuid

Header parameters

Kirora-Workspacestringoptional

Partner keys only: the child workspace to act in, by the external id the partner gave it. Without it, a partner key acts in its own workspace. Any other key that sends it is refused with 403, and an unknown workspace is 404.

pattern ^[A-Za-z0-9._:-]{1,128}$

Request body

draftbooleanoptional

true: the template as it is now, in the current brand and shared blocks. Left out, the published version: what sends use, with the brand and shared blocks it was published with.

default false

versionintegeroptional

A published version to render instead of the current one.

min > 0

contactobjectoptional

A contact whose values fill the merge tags and decide each block's visibleIf. Without one, merge tags show their defaults.

Any of 3 shapes
By contact id
1 child attribute
contactIdstringrequired

Kirora's id for the contact.

uuid

By external id
1 child attribute
externalIdstringrequired

Your own id for the contact, as set with identify.

1–255 characters

By email
1 child attribute
emailstringrequired

The contact's email address, matched trimmed and without case.

datamap<string, any>optional

Sample data for {{ event.properties.* }} tags and repeat lists: what a transactional send's data or a journey's event would carry. Without it, a repeat shows once with its item tags as written.

keys: pattern ^[A-Za-z0-9_-]{1,64}$

contextstringoptional

HTML only. marketing: the email as a marketing send has it, with the postal address and an unsubscribe link ({{unsubscribe_url}}; # in a test send) added below when the HTML does not show them. transactional (the default): nothing is added, as a transactional send adds nothing, and the HTML is as saving keeps it.

one of marketing, transactional · default "transactional"

Returns

Returns 200 OK with a SavedTemplateRender in data. It can also return 409 Conflict, 413 Payload Too Large or 415 Unsupported Media Type; see the statuses below. Otherwise returns an error; Errors lists every code and which to retry.

  • 200 OKThe version rendered, its subject, HTML, plain text, size and warnings.
  • 409 ConflictThe request conflicts with current state — a duplicate unique value, or a resource whose status does not allow this operation.
  • 413 Payload Too LargeThe body is larger than this operation accepts (PAYLOAD_TOO_LARGE).
  • 415 Unsupported Media TypeThe body is not JSON, or not the upload the operation takes (UNSUPPORTED_MEDIA_TYPE).
htmlstringrequired

The rendered HTML.

textstringrequired

The rendered plain-text version.

subjectstring | nullrequired

The template's default subject with merge tags filled in; null when it has none.

sizeBytesintegerrequired

Size of the HTML in bytes.

min 0

warningsobject[]required

Problems that do not stop rendering, such as a size that risks clipping.

3 child attributes
codestringrequired

A stable code for the kind of problem.

titlestringrequired

A short summary.

detailstringrequired

What is wrong and how to fix it.

versioninteger | nullrequired

The published version rendered; null for the draft.

min > 0