Sendr Docs
API Reference

Templates

Create and manage reusable email templates with variable substitution.

Templates let you define reusable HTML email layouts with {{variable}} placeholders. When you send an email using template_id, Sendr substitutes the variables before delivery.


Create template

POST /v1/templates

Requires full_access scope.

Request body

{
  "name": "Welcome Email",
  "subject": "Welcome to {{company_name}}, {{name}}!",
  "html": "<h1>Hi {{name}}</h1><p>Thanks for joining {{company_name}}.</p>",
  "text": "Hi {{name}}, thanks for joining {{company_name}}."
}
FieldTypeRequiredDescription
namestringYesHuman-readable template name.
subjectstringYesSubject line with optional {{variables}}.
htmlstringNo*HTML body. At least one of html or text required.
textstringNo*Plain-text body.

Response

{
  "id": "tmpl_abc123",
  "name": "Welcome Email",
  "subject": "Welcome to {{company_name}}, {{name}}!",
  "created_at": "2025-03-12T09:00:00Z",
  "updated_at": "2025-03-12T09:00:00Z"
}

Get template

GET /v1/templates/:id

Requires read_only scope.


List templates

GET /v1/templates

Requires read_only scope.

Response

{
  "data": [
    {
      "id": "tmpl_abc123",
      "name": "Welcome Email",
      "subject": "Welcome to {{company_name}}, {{name}}!",
      "created_at": "2025-03-12T09:00:00Z",
      "updated_at": "2025-03-12T09:00:00Z"
    }
  ],
  "has_more": false,
  "next_cursor": null
}

Update template

PATCH /v1/templates/:id

Requires full_access scope.

Request body

All fields are optional — only include fields you want to change.

{
  "subject": "Updated subject: welcome {{name}}!",
  "html": "<h1>Updated body for {{name}}</h1>"
}

Delete template

DELETE /v1/templates/:id

Requires full_access scope.


Render template (preview)

POST /v1/templates/:id/render

Requires read_only scope. Returns the rendered HTML and subject with variables substituted — useful for previewing before sending.

Request body

{
  "variables": {
    "name": "Alice",
    "company_name": "Acme Corp"
  }
}

Response

{
  "subject": "Welcome to Acme Corp, Alice!",
  "html": "<h1>Hi Alice</h1><p>Thanks for joining Acme Corp.</p>",
  "text": "Hi Alice, thanks for joining Acme Corp."
}

Using templates when sending

Pass template_id and variables when calling the send endpoint:

await sendr.emails.send({
  from: "hello@acme.com",
  to: "user@example.com",
  template_id: "tmpl_abc123",
  variables: {
    name: "Alice",
    company_name: "Acme Corp",
  },
});

template_id overrides the html and text fields.


Plan limits

PlanTemplates
Free5
Pro25
BusinessUnlimited
EnterpriseUnlimited

On this page