DocumentationPublish workflow

Publish workflow

POST .../publish, inline CSS, and unpublish.

Publishing locks a template version for production use and prepares HTML for email clients.

Publish a version

POST /templates/{templateId}/versions/{versionId}/publish
Authorization: Bearer <accessToken>
X-Tenant-Id: clxxxxxxxx

Requires dashboard JWT (template management is not available via API key today).

What happens on publish

  1. Inline CSS — external <style> blocks and linked stylesheets are inlined into HTML attributes where possible. This improves rendering in clients that strip <head> styles (Gmail, Outlook).
  2. Status changes from Draft to Published.
  3. The version ID becomes valid for templateVersionId in POST /emails/send and campaigns.
{
  "id": "clxversion...",
  "status": "PUBLISHED",
  "publishedAt": "2026-06-30T10:00:00.000Z"
}

Unpublish

To edit a published version, unpublish first:

POST /templates/{templateId}/versions/{versionId}/unpublish

The version returns to Draft. Active sends already queued are not affected; new sends must use another published version or inline htmlBody.

Recommended workflow

Edit draft  →  Preview  →  Publish  →  Send with templateVersionId
                ↑                              |
                └──── Unpublish to edit ───────┘

Inline CSS notes

  • Prefer simple, email-safe CSS (tables, inline-friendly properties).
  • Complex layouts (flexbox-heavy) may not inline perfectly — test with real clients.
  • MJML and Unlayer exports are supported via mjmlSource and unlayerDesign fields on the version.

Related