Create Template Render
POSThttps://a.klaviyo.com/api/template-render/
Render a template with the given template ID and context attribute. Returns the HTML and plain text versions of the email template.
Request body parameters (nested under attributes):
return_fields: Request specific fields using sparse fieldsets.context: This is the context your email template will be rendered with. You must pass in acontextobject as a JSON object.
Email templates are rendered with contexts in a similar manner to Django templates. Nested template variables can be referenced via dot notation. Template variables without corresponding context values are treated as FALSE and output nothing.
Ex. { "name" : "George Washington", "state" : "VA" }
- Revision header
revision: 2023-01-24required- Scopes
Templates Read- Rate limits
- Burst:
3/sSteady:60/m
Headers
API endpoint revision (format: YYYY-MM-DD[.suffix])
2023-01-24
Request body
Content type: application/jsonrequired
Show 2 fields
Show 3 fields
The ID of template
The context for the template render. This must be a JSON object which has values for any tags used in the template. See this doc for more details.
Enter valid JSON. Until you do, the example request uses the example value.
Provide fields to limit the returned data
Responses
201
Content type: application/json
Show 4 fields
The ID of template
Show 7 fields
The ID of the company the template belongs to
The name of the template
editor_typehas a fixed set of values:- SYSTEM_DRAGGABLE: indicates a drag-and-drop editor template
- SIMPLE: A rich text editor template
- CODE: A custom HTML template
- USER_DRAGGABLE: A hybrid template, using custom HTML in the drag-and-drop editor
The rendered HTML of the template
The template plain_text
The date the template was created in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm)
The date the template was updated in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm)
Show 1 field
4XXClient Error
Content type: application/json
5XXServer Error
Content type: application/json