Skip to main content
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.

Path parameters

id
string
required
The template id or slug to render.

Body parameters

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

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" }
  }'

Response

subject
string
The rendered subject line.
html
string | null
The rendered HTML body, or null if the template has none.
text
string | null
The rendered plain-text body, or null.
missing
string[]
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 draft. To 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.