Skip to content

Email Templates ​

SendAPI provides a built-in template engine for rendering dynamic HTML emails. Templates use standard variable interpolation syntax (e.g., ) and can be managed programmatically.

Template identifiers ​

Every template has an opaque id of the form tmpl_xyaq57kye8ji. Pass it as template_id when sending, or find it on the Email Templates page in the dashboard.

Templates created before September 2026 were addressed by a numeric id. Those still work everywhere a template_id is accepted, and the numeric value is returned as legacy_id so existing integrations keep functioning.

Starter library ​

Rather than writing a template from scratch, you can copy one of ten ready-made transactional templates (welcome, verification, password reset, receipts, invoices, shipping, dunning, appointment reminders, trial expiry, security alerts).

GET /v1/email/templates/gallery — list the library GET /v1/email/templates/gallery/{slug} — preview one, including its full HTML POST /v1/email/templates/gallery/{slug} — copy it into your account

A copied template is an ordinary template: it gets its own tmpl_ id, and you can edit or delete it freely. Later changes to the library never affect copies you have already made.

bash
curl -X POST https://sendapi.co/v1/email/templates/gallery/order-confirmation \
  -H "Authorization: Bearer sk_live_YOUR_API_KEY"

List Templates ​

Retrieve all email templates stored in the project.

GET /v1/email/templates

Response ​

json
{
  "data": [
    {
      "id": "tmpl_8ta3isfkgnsk",
      "legacy_id": 1,
      "name": "Welcome Email",
      "subject": "Welcome to SendAPI, {{ name }}!",
      "created_at": "2026-03-09T14:30:00.000000Z",
      "updated_at": "2026-03-10T09:15:00.000000Z"
    }
  ]
}

Create a Template ​

Store a new reusable HTML template.

POST /v1/email/templates

Request Body ​

ParameterTypeRequiredDescription
namestringYesInternal reference name for the template.
subjectstringYesDefault subject line (supports variables).
body_htmlstringYesThe raw HTML structure of your email. Use for dynamic data injection.
bash
curl -X POST https://sendapi.co/v1/email/templates \
  -H "Authorization: Bearer sk_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Password Reset",
    "subject": "Reset your password",
    "body_html": "<html><body>Hi {{ name }}, <a href=\"{{ reset_url }}\">Click here to reset</a>.</body></html>"
  }'

Get a Template ​

Retrieve the full details of a specific template, including its body_html.

GET /v1/email/templates/{id}


Update a Template ​

Update the contents of an existing template.

PUT /v1/email/templates/{id}

Request Body ​

ParameterTypeRequiredDescription
namestringNoInternal reference name for the template.
subjectstringNoDefault subject line (supports variables).
body_htmlstringNoThe raw HTML structure of your email.

Delete a Template ​

DELETE /v1/email/templates/{id}

Immediate Effect

Deleting a template is immediate. Any active API integrations calling /v1/email/send using this template ID will instantly fail with a 404 Not Found error.

Released under the MIT License.