Templates & variables
Reference a saved template and pass per-recipient data.
Rather than inlining HTML on every send, save a template once and reference it by ID. Pass a data object and any {{variable}} in the template is substituted at send time.
curl https://www.unitpost.com/api/v1/emails \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"from": "you@yourdomain.com",
"to": "customer@acme.com",
"template": { "id": "tmpl_123" },
"data": { "first_name": "Sam", "plan": "Pro" }
}'When you send to a known contact, that contact's custom fields merge into the variables automatically — so a template can reference {{first_name}} without you re-sending it on every request.
Drafts can't be sent
A template must be published before the API will send it. Referencing a draft returns a 422 with code template_not_published. Publish it in the editor first.
Templates are authored in the visual editor or in code mode with the @unitpost/email component library — manage them under Templates. The library — every block, its props, and copy-paste snippets — is documented under the Email section in this sidebar.