Skip to content

Templates

A template defines the subject and body (HTML and/or plain text) of emails. Campaigns and sequences reference it by id — you can update the template without touching the campaign, and change the content before sending. This lets you iterate on copy or design without having to edit each campaign separately.

FieldTypeDescription
idstringSlug identifier for the template.
namestringDescriptive name to identify it in the dashboard.
subjectstringEmail subject. Supports merge tags.
htmlstringHTML body. Supports merge tags.
body_textstringPlain-text body. Supports merge tags.
key_idstringAPI key this template belongs to.
created_atstringCreation date (ISO 8601).
updated_atstringLast updated date (ISO 8601).

You can personalize the subject and body using {{name}} to insert the contact’s name. MailerDash replaces the tag at send time with the value of the name field on the recipient contact.

Example:

subject: "Hi {{name}}, your report is ready"
html: "<h1>Hi {{name}},</h1><p>Your monthly report is available.</p>"

If the contact has no name, the tag is replaced with an empty string.

You can also use any field from the contact’s metadata: if you imported a company column, {{company}} works.

MailerDash generates these at send time, one per recipient. You can’t define them yourself: if your metadata carries a field with one of these names, it’s ignored and ours wins. The reason is that they carry a signed token only we can issue — an unsubscribe link pointing somewhere else is an email that looks compliant and isn’t.

TagWhat it inserts
{{unsubscribe_url}}Unsubscribe link. Required: a template without it is rejected with 400 on save.
{{preferences_url}}Preference center, to adjust what they receive instead of leaving entirely.
{{physical_address}}Your postal address. A CAN-SPAM requirement.
{{reconfirm_url}}Re-confirmation link for re-engagement campaigns. See campaigns.

The editor warns you while you work if the template carries no {{unsubscribe_url}} anywhere —not in the HTML, not in the MJML, not in the plain text— so you don’t hit the 400 once you thought you were done. The warning comes with an “Add to footer” button that inserts it for you: it writes on whichever field has content, and if your template is plain text only it adds a readable line instead of inventing an HTML body for you.

The visual editor also ships a drag-and-drop “Legal footer” block with the unsubscribe link and your postal address — the two things CAN-SPAM §7704 asks for. The address lives only in that block, where you can see it and remove it, and not in what the button inserts: if your account hasn’t set one, it would leave an empty line in the email.

GET /v1/bulk/templates

Returns an array with all templates in your account.


POST /v1/bulk/templates

Body:

{
"name": "Bienvenida onboarding",
"subject": "Bienvenido a bordo, {{name}}",
"html": "<h1>Hola {{name}},</h1><p>Tu cuenta está lista.</p>",
"body_text": "Hola {{name}},\n\nTu cuenta está lista."
}

name and subject are required. Returns 201 with the created template.


GET /v1/bulk/templates/{id}

Returns all fields of the template, including html and body_text.


PATCH /v1/bulk/templates/{id}

Body (all fields are optional):

{
"subject": "¡Bienvenido, {{name}}!",
"html": "<h1>Hola {{name}},</h1><p>Tu cuenta está lista. Empieza ahora.</p>"
}

Returns 200 with the updated template. Fields you don’t send are not modified.


DELETE /v1/bulk/templates/{id}

Deletes the template. Returns 204 No Content. If it is referenced by an active campaign, returns 409 Conflict.


POST /v1/bulk/templates/delete

Atomic deletion of multiple templates. Body:

{ "ids": ["bienvenida-onboarding-abc", "promo-verano-xyz"] }

Response:

{
"requested": 2,
"deleted": 1,
"not_found": [],
"forbidden": [],
"in_use": ["promo-verano-xyz"]
}

Templates in use by active campaigns are reported in in_use and are not deleted. The rest are deleted in the same request.

Create a template with HTML and plain text

Section titled “Create a template with HTML and plain text”
Ventana de terminal
curl -X POST https://api.mailerdash.com/v1/bulk/templates \
-H "Authorization: Bearer $MAILERDASH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Bienvenida onboarding",
"subject": "Bienvenido a bordo, {{name}}",
"html": "<h1>Hola {{name}},</h1><p>Tu cuenta está lista.</p>",
"body_text": "Hola {{name}},\n\nTu cuenta está lista."
}'

For the full request/response schema and error codes, see the bulk API reference.