DocumentationTemplates and versions
Templates and versions
Draft vs Published versions and sending with templateVersionId.
MailingCore templates use versioned content. Each template can have multiple versions; only a Published version can be used in production sends.
Draft vs Published
| State | Editable | Usable in POST /emails/send |
|---|---|---|
| Draft | Yes | No |
| Published | No (create a new draft or unpublish first) | Yes |
Workflow:
- Create a template (
POST /templates) with an initial version (Draft). - Edit HTML, subject, and variables in the dashboard or via
PATCH /templates/:id/versions/:versionId. - Publish the version when ready — see Publish workflow.
- Send with
templateVersionIdset to the published version ID.
{
"to": "[email protected]",
"subject": "Order confirmed",
"htmlBody": "<p>Fallback if not using template</p>",
"templateVersionId": "clxversion_published..."
}
When templateVersionId is provided, MailingCore renders the published HTML and subject. You can still override subject in the send payload if your integration requires it.
Locale variants
Versions may include a locale (es, en, it, fr, ca, de) and localeGroupId to group equivalent translations. Campaign sends can pick the best match for each contact.
Management endpoints
| Action | Endpoint | Auth |
|---|---|---|
| List templates | GET /templates | JWT |
| Create template | POST /templates | JWT |
| Add version | POST /templates/:id/versions | JWT |
| Update version | PATCH /templates/:id/versions/:versionId | JWT |
| Publish | POST /templates/:id/versions/:versionId/publish | JWT |
Template CRUD requires a dashboard JWT, not an API key. Sending uses an API key with email:send.
Next steps
- Publish a version (inline CSS, go live)
- Template variables (
{{name}},{{unsubscribeUrl}}) - Send email with
templateVersionId