DocumentationCreate and edit templates
Create and edit templates
Dashboard editor — Monaco, Unlayer blocks, and draft versions.
Templates in MailingCore are versioned. Each template has one or more versions in DRAFT or PUBLISHED state.
Dashboard editor
The dashboard provides a dual editor (ADR-035):
| Mode | Editor | Best for |
|---|---|---|
| Code | Monaco | Developers, custom HTML, Handlebars variables |
| Blocks | Unlayer (when licensed) | Marketing drag-and-drop layouts |
| Preview | Sandboxed iframe | Gmail/Outlook preview before publish |
Create a template
- Dashboard → Templates → New template
- First version is created automatically as DRAFT
- Edit subject, HTML, and optional Unlayer design JSON
- Save — only draft versions are editable
Edit a draft version
PATCH /templates/:id/versions/:versionId
Authorization: Bearer <JWT>
X-Tenant-Id: clxxxxxxxx
Draft-only fields: htmlBody, subject, textBody, locale, localeGroupId.
Version lifecycle
DRAFT ──publish──▶ PUBLISHED ──unpublish──▶ (back to editable draft flow)
- Draft — editable, cannot send
- Published — inlined CSS, usable in
templateVersionIdsends - Publish inlines CSS for email client compatibility — see Publish workflow
API create
POST /templates
Content-Type: application/json
{
"name": "Welcome email",
"subject": "Welcome to {{appName}}",
"htmlBody": "<h1>Hello {{name}}</h1>"
}
Creates template + initial draft version.
Related
- Template variables —
{{var}}syntax - Locale variants — multi-language versions