Templates from code

Send templates designed in Relevate, with values from your app.

Designers build templates in Relevate; your code sends them with the values that change, like an order number or a sign-in link.

Send a template

{
  "to": "jane@example.com",
  "template": {
    "id": "order-shipped",
    "variables": { "order": { "id": "A-2", "total": 42 } }
  }
}
  • id: the template's alias (like order-shipped) or ID. Copy either from the template's ⋯ → Developers menu.
  • variables: values for the template's declared variables. Dots nest: {"order": {"total": 42}} fills {{order.total}}.
  • version: optional, to pin a published version.

The sender, type and purpose come from the template. Only the published version is sent. Every missing, unknown or mistyped value is named in one 422 invalid_variables, before anything is sent.

Manage templates

GET /email/templatesPublished templates with their variables
GET /email/templates/{id}One template; ?draft=true for the draft
POST /email/templatesCreate a draft from HTML
PATCH /email/templates/{id}Change the draft
POST /email/templates/{id}/publishPublish, with the same checks as the dashboard
POST /email/templates/{id}/duplicateCopy into a new draft
POST /email/templates/{id}/renderSee the finished email for given values, without sending
DELETE /email/templates/{id}Delete a draft, or archive a published template

Variables are {name, type, required, fallback, example, description}; key and fallback_value are accepted too.