Docs
API · templates

Render a template

Resolve a saved template's merge variables against a data object and return the final subject, HTML, and text — without sending anything. Useful for previews and QA.

POST/v1/templates/{id}/render

This is a pure render: nothing is queued or delivered. To send a template, pass templateId + data to POST /v1/emails instead — the pipeline renders it for you.

01 Path parameters

idstringRequired
The template id or slug to render.

02 Body parameters

dataobjectOptional
Merge variables, keyed by placeholder name. Nested objects are reachable with dot paths ({{user.name}}). Omit to render with no substitutions.

03 Request

curl https://api.drin.run/v1/templates/order-receipt/render \
  -H "Authorization: Bearer $DRIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "data": { "firstName": "Sam", "orderId": "A-1042" }
  }'

04 Response

subjectstringOptional
The rendered subject line.
htmlstring | nullOptional
The rendered HTML body, or null if the template has none.
textstring | nullOptional
The rendered plain-text body, or null.
missingstring[]Optional
Variables referenced by the template but absent from data. They render as empty strings; surface this array in QA to catch gaps.
200 OK
{
  "subject": "Receipt A-1042",
  "html": "<p>Hi Sam, thanks for your order.</p>",
  "text": null,
  "missing": []
}
Previewing an unsaved draftTo render a template you haven't saved yet — e.g. a live editor — use POST /v1/templates/preview, which takes the draft fields inline instead of an id.