Get your API key
API reference

Templates

Saved email templates plus the premade base templates — create them, fetch them, and send from them with a templateId.

Auth: Session token · Base URL: https://api.mailkite.dev

Endpoints

Each row expands to its request and response schema. The address bar follows along, so any endpoint can be linked to directly.

GET /api/templates List your saved email templates (light metadata only — no body). Use getTemplate for the full template.

List your saved email templates (light metadata only — no body). Use getTemplate for the full template.

Response body

array template-meta.json

The light shape list endpoints return — identity and labelling only. The html/json/text/theme blobs are omitted here because a gallery never renders them; fetch one template by id to get the full row.

FieldTypeNotes
id req stringTemplate id. User templates are tpl_…; base (premade) templates are base_<slug>. Either can be passed as send()'s templateId.
name req stringDisplay name, as shown in the template gallery.
category req stringGallery group for base templates (Welcome, Receipt, …). Empty string for user templates, which are not grouped.
subject req stringDefault subject line applied when sending with this template. Empty string when the template does not set one.
is_base req 0 · 11 for a premade base template (world-readable, owned by the system), 0 for one of your own. Base templates cannot be edited — clone one via createTemplate's baseId.
updated_at req integerWhen the template was last modified, in Unix epoch milliseconds (UTC). List endpoints sort by this, newest first.
GET /api/templates/base List the premade base templates (light metadata). Clone one with createTemplate({ baseId }) or send from it directly via send({ templateId }).

List the premade base templates (light metadata). Clone one with createTemplate({ baseId }) or send from it directly via send({ templateId }).

Response body

array template-meta.json

The light shape list endpoints return — identity and labelling only. The html/json/text/theme blobs are omitted here because a gallery never renders them; fetch one template by id to get the full row.

FieldTypeNotes
id req stringTemplate id. User templates are tpl_…; base (premade) templates are base_<slug>. Either can be passed as send()'s templateId.
name req stringDisplay name, as shown in the template gallery.
category req stringGallery group for base templates (Welcome, Receipt, …). Empty string for user templates, which are not grouped.
subject req stringDefault subject line applied when sending with this template. Empty string when the template does not set one.
is_base req 0 · 11 for a premade base template (world-readable, owned by the system), 0 for one of your own. Base templates cannot be edited — clone one via createTemplate's baseId.
updated_at req integerWhen the template was last modified, in Unix epoch milliseconds (UTC). List endpoints sort by this, newest first.
GET /api/templates/:id Get one template (full: subject, html, text, theme). Works for your templates (tpl_…) and base templates (base_…).

Get one template (full: subject, html, text, theme). Works for your templates (tpl_…) and base templates (base_…).

Response body

template.json

A saved email template, returned in full by getTemplate and createTemplate. Pass its id as send()'s templateId to use it: the stored subject/html/text seed the message, and anything you pass to send() explicitly overrides them.

FieldTypeNotes
id req stringTemplate id. User templates are tpl_…; base (premade) templates are base_<slug>.
user_id req stringOwner of the template. The literal string "system" for base templates, which belong to no account.
name req stringDisplay name, as shown in the template gallery.
category req stringGallery group for base templates (Welcome, Receipt, …). Empty string for user templates.
subject req stringDefault subject line applied when sending with this template. Empty string when the template does not set one.
json req stringThe editor document as a JSON string (TipTap format). This is the re-editable source the dashboard's template editor loads; `html` is what actually gets sent. Defaults to "{}".
html req stringThe rendered, inbox-safe HTML body used when sending. Empty string for a template that has no HTML part.
text req stringPlain-text fallback body used when sending. Empty string for a template that has no text part.
theme req stringBrand tokens as a JSON string (bg, surface, primary, text, logo, …) applied when the editor re-renders the HTML. Defaults to "{}".
is_base req 0 · 11 for a premade base template (world-readable, owned by the system), 0 for one of your own. Base templates cannot be edited — clone one via createTemplate's baseId.
created_at req integerWhen the template was created, in Unix epoch milliseconds (UTC).
updated_at req integerWhen the template was last modified, in Unix epoch milliseconds (UTC).
POST /api/templates Create a template. Pass `baseId` to clone a base template into your own, or provide name/subject/html/text/theme directly.

Create a template. Pass `baseId` to clone a base template into your own, or provide name/subject/html/text/theme directly.

Request body

create-template-request.json
FieldTypeNotes
baseIdstringClone this base template (base_…) into your own. When set, name is optional (defaults to the base's name).
namestringTemplate name. Required unless baseId is given.
subjectstringDefault subject line for sends.
htmlstringRendered, send-ready HTML.
textstringPlaintext fallback.
jsonstringEditor (TipTap) JSON source, for re-editing in the dashboard.
themestringBrand tokens JSON (bg, surface, primary, text, logo, …).

Response body

template.json

A saved email template, returned in full by getTemplate and createTemplate. Pass its id as send()'s templateId to use it: the stored subject/html/text seed the message, and anything you pass to send() explicitly overrides them.

FieldTypeNotes
id req stringTemplate id. User templates are tpl_…; base (premade) templates are base_<slug>.
user_id req stringOwner of the template. The literal string "system" for base templates, which belong to no account.
name req stringDisplay name, as shown in the template gallery.
category req stringGallery group for base templates (Welcome, Receipt, …). Empty string for user templates.
subject req stringDefault subject line applied when sending with this template. Empty string when the template does not set one.
json req stringThe editor document as a JSON string (TipTap format). This is the re-editable source the dashboard's template editor loads; `html` is what actually gets sent. Defaults to "{}".
html req stringThe rendered, inbox-safe HTML body used when sending. Empty string for a template that has no HTML part.
text req stringPlain-text fallback body used when sending. Empty string for a template that has no text part.
theme req stringBrand tokens as a JSON string (bg, surface, primary, text, logo, …) applied when the editor re-renders the HTML. Defaults to "{}".
is_base req 0 · 11 for a premade base template (world-readable, owned by the system), 0 for one of your own. Base templates cannot be edited — clone one via createTemplate's baseId.
created_at req integerWhen the template was created, in Unix epoch milliseconds (UTC).
updated_at req integerWhen the template was last modified, in Unix epoch milliseconds (UTC).