Relayloft docsSign in

Templates

API base URL: https://api.relayloft.com

A template holds an email's HTML (and optionally its text, subject, from and reply-to) with {{{KEY}}} where values go. Manage them under Templates in the portal, or with Resend's Templates API and a Full access key (resend.templates.*).

Variables

Drafts and publishing

A new template is a draft. POST /templates/:id/publish makes the current draft the version emails use. Edits after that stay a draft (has_unpublished_versions is true) until you publish again, so sends keep using the published version. Only published templates can be sent. Duplicating makes a new draft named "… (copy)", without the alias.

const { data } = await resend.templates
  .create({
    name: "Order confirmation",
    alias: "order-confirmation",
    from: "Acme <orders@mail.yourcompany.com>",
    subject: "Order {{{ORDER}}}",
    html: "<p>{{{PRODUCT}}} costs {{{PRICE}}}</p>",
    variables: [
      { key: "ORDER", type: "string" },
      { key: "PRODUCT", type: "string", fallbackValue: "Your item" },
      { key: "PRICE", type: "number" },
    ],
  })
  .publish(); // POST /templates, then POST /templates/:id/publish

Also GET /templates (newest first; limit, after, before), GET /templates/:id, PATCH /templates/:id, DELETE /templates/:id and POST /templates/:id/duplicate. Anywhere an id goes, the alias works too. Changes return { "id", "object": "template" }, as Resend's do.

Sending with a template

curl -X POST https://api.relayloft.com/emails \
  -H "Authorization: Bearer $RESEND_API_KEY" -H "Content-Type: application/json" \
  -d '{"to":"user@example.com","template":{"id":"order-confirmation","variables":{"ORDER":"#42","PRICE":499}}}'

Limits