Templates
Render a template
Preview what a template produces for some data, without sending anything.
POST
/v1/templates/{name}/renderAPI keyRenders a template exactly as a send would, and returns the result. Nothing is stored or sent. Use it to preview a template or to check your data before sending.
The name is looked up like a send does: a template stored in the project first, then the built-in templates. The same checks apply too: required variables of a stored template, and the data schema of a built-in one.
Path parameters
The template name.
Body parameters
The body is optional. Leaving it out is the same as sending { "data": {} }.
The values for the template's variables.
Response
subjectstring
The rendered subject.
htmlstring
The rendered HTML.
textstring
The rendered plain text. For a stored template without a text body, this is made from the rendered HTML.
Errors
| Status | Code | When |
|---|---|---|
| 400 | invalid_body | The body is not valid JSON, or data is not an object. |
| 400 | invalid_template_data | A required variable is missing, or data doesn't match a built-in template's schema. param is the field, for example data.loginUrl. |
| 400 | invalid_template | The stored template has a syntax error. |
| 404 | template_not_found | No stored or built-in template with this name. |