Create reusable email templates with variables and fallbacks, publish versions, and send them from the API by id or alias.
Templates keep email design out of your code. Build them in the dashboard's visual or HTML editor (or with the API), publish a version, and send by alias with just the data that changes.
order-confirmation.Or with the API:
curl -X POST https://delivrie.io/api/templates \
-H "Authorization: Bearer $DELIVRIE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Order confirmation",
"alias": "order-confirmation",
"from": "Acme <orders@mail.acme.com>",
"subject": "Order {{order_id}} confirmed",
"html": "<p>Hi {{first_name|there}},</p><p>Order {{order_id}} is on its way.</p>"
}'
curl -X POST https://delivrie.io/api/templates/order-confirmation/publish \
-H "Authorization: Bearer $DELIVRIE_API_KEY"
Only published versions can be sent. Editing a template doesn't change what's sent until you publish again, and every publish is kept in the version history so you can roll back.
Delivrie includes 22 designed templates you can start from, each with its variables already set up:
| Category | Templates |
|---|---|
| Account | Welcome, Verify email, Sign-in link, Team invitation, Account closed |
| Security | Verification code, Password reset, Password changed, New sign-in alert |
| Billing | Payment receipt, Invoice, Payment failed, Trial ending, Subscription renewed |
| Commerce | Order confirmation, Order shipped, Cart reminder |
| Marketing | Newsletter, Product announcement, Feedback request, Event invitation, We miss you |
They use a card layout: your logo above a white card, the content inside it, and the footer below. They're built with email-safe table layouts and adapt to phone screens. Everything is editable after you create one. Transactional templates have no unsubscribe link; marketing ones do.
On the Starter plan and above, set your brand once in Settings → Brand: logo, button and text colours, background, font, button corners, postal address, support email and social links. New templates are created with your brand already applied. To restyle a template or broadcast you already have, open it, click Styles, then Apply brand kit.
Use a PNG or JPG logo, at least twice the height it's shown at so it stays sharp on high-resolution screens. Most email apps don't show SVG images.
Pass template instead of html/text. subject and from are optional; the template's defaults are used when you leave them out.
cURL
curl -X POST https://delivrie.io/api/emails \
-H "Authorization: Bearer $DELIVRIE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "ada@example.com",
"template": {
"id": "order-confirmation",
"variables": { "first_name": "Ada", "order_id": "#1042" }
}
}'Node.js
await delivrie.emails.send({
from: "Acme <orders@mail.acme.com>",
to: "ada@example.com",
template: { id: "order-confirmation", variables: { first_name: "Ada", order_id: "#1042" } },
}); // `subject` comes from the templatePython
requests.post("https://delivrie.io/api/emails", headers=auth, json={
"to": "ada@example.com",
"template": {"id": "order-confirmation", "variables": {"first_name": "Ada", "order_id": "#1042"}},
})
template.id takes the template's id or its alias.
| Syntax | Inserts | Use for |
|---|---|---|
{{first_name}} | The value, HTML-escaped | Anything a user typed: names, messages, addresses |
{{{reset_url}}} | The value exactly as given | HTML snippets and URLs you build yourself |
{{first_name|there}} | The value, or there if it's missing or empty | Friendly fallbacks |
Variables work in the subject, the HTML and the text version. Missing variables without a fallback become an empty string. You can also set a default fallback for each variable in the template editor.
Warning Never put user input in a {{{triple}}} variable. It's inserted unescaped, so someone could inject HTML into your email.
In broadcasts, variables come from the contact: {{first_name}}, {{last_name}}, {{email}} and any contact property, like {{plan}}. {{{unsubscribe_url}}} inserts the recipient's unsubscribe link.
In automations, templates can also use the data sent with the triggering event.
GET /templates lists templates with their alias and status.GET /templates/:id (id or alias) returns one template.