Skip to the documentation
API

Preview a template

Exactly the HTML a send would produce, without sending it.

POSTapi.openemail.uk/templates/{id}/preview

Runs the real call against your workspace, with your own key.

POST /templates/{id}/preview

Exactly the HTML a send would produce, without sending it.

Example

Needs templates:read. A POST because the values go in a body; nothing is written and nothing is sent.

curl
curl -X POST "$OE/templates/order-shipped/preview" -H "$AUTH" -H "Content-Type: application/json" \  -d '{ "version": 5, "props": { "orderId": "AC-4192" } }'
Response
{  "object": "template_preview",  "templateId": "tpl_9c1f0a4b7e05d3862c1f0a44",  "version": 5,  "subject": "Order AC-4192 is on its way",  "html": "<!DOCTYPE html><html>…</html>",  "text": "Hello there, AC-4192 is on its way.",  "warnings": [{ "code": "unfilled_placeholder", "key": "customer" }]}

Point your CI at this. A template change that breaks your integration is then a failing test rather than a customer’s confusing email.

Lenient where a send is strict: a missing required prop is reported in warnings rather than refused, because a template being previewed is usually a template being written. An UNKNOWN prop is still a 422 here, because a typo is a typo at every stage.

A draft can be previewed, and this is the only path that renders anything outside publish. Omit version and you preview what is published; name one to preview that revision, draft included.

JSON, never text/html. The HTML is a string in a field so a client can parse the response before deciding what to do with it.