Send with a Template with Sendar

Send a saved template by id instead of passing inline content. The template's subject and HTML are resolved with your variables at send time, and the sent email stores the resolved result — editing or deleting the template later never changes what was already sent.

POST /emails

Send a saved template by id instead of passing inline content. The template's subject and HTML are resolved with your variables at send time, and the sent email stores the resolved result — editing or deleting the template later never changes what was already sent.

const response = await fetch("https://sendar.app/api/emails", {
  method: "POST",
  headers: {
    Authorization: "Bearer sndr_xxxxxxxxxxxx",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "from": "Acme <hello@acme.com>",
    "to": [
      "delivered@example.com"
    ],
    "templateId": 5,
    "variables": {
      "first_name": "Ada",
      "workspace": "acme-inc"
    }
  }),
});

const data = await response.json();
console.log(data);

Usage note 1

When templateId is set, subject, html, and text must be omitted — the template supplies them.

Usage note 2

variables is checked strictly: every {{placeholder}} in the template needs a value, and unknown keys are rejected. Values are HTML-escaped automatically.

Usage note 3

Batch sends support templateId and variables per item, so one request can send the same template to many recipients with different values.

Usage note 4

Works with scheduledAt and attachments exactly like a normal send.

Example response

The response below is illustrative. Provider acceptance is not proof of delivery to the inbox.

{
  "id": 43,
  "from": "Acme <hello@acme.com>",
  "to": [
    "delivered@example.com"
  ],
  "subject": "Welcome to Acme, Ada!",
  "status": "sent",
  "createdAt": "2026-07-15T12:01:30.000Z"
}

Sendar pricing · Integration guides