/v1/workspaces/{workspace_id}/templates/previewAuthPreview an unsaved draft. Renders subject + bodyHtml against the workspace brand tokens + supplied data, with all workspace layouts/partials registered. Used by the editor for live preview.
Path parameters
workspace_id*string · uuidId of the workspace.
Request body
subjectstringSubject template (Handlebars).
body_html*stringHTML body to render (Handlebars).
dataobjectSample data to render variables with. Keys are your variable names and are kept exactly as sent.
Response · 200
subject*stringThe rendered subject line.
html*stringFully-rendered HTML body.
text*stringPlain-text body (derived if not authored).
Example
Request
POST https://api.mail.productcraft.co/v1/workspaces/{workspace_id}/templates/preview
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
{
"subject": "string",
"body_html": "string",
"data": {}
}Response
{
"subject": "string",
"html": "string",
"text": "string"
}