/v1/workspaces/{workspace_id}/templates/{name}/publishAuthPublish the draft as the next version. Every send uses it from now on; the version history keeps the previous ones, and the draft is cleared.
Path parameters
workspace_id*string · uuidId of the workspace.
name*stringName of the template.
Headers
Idempotency-KeystringOpaque client-generated string (1–256 chars, `[A-Za-z0-9._:-]`) used to deduplicate retries within a 24h window. A retry with the same key and body returns the original response with `Idempotent-Replay: true`.
Request body
notestringWhat changed, shown in the version history.
Example: "Shorter subject line"
Response · 200 The template at its new `version`.
id*string · uuidThe template id.
workspace_id*string · uuidThe workspace that owns the template.
name*stringTemplate name, unique in the workspace; used in send URLs.
kind*objectWhat the template is: a sendable `template`, a `layout` that wraps templates, or a `partial` included by them.
subject*stringSubject line (Handlebars).
body_html*stringHTML body (Handlebars).
body_text*stringPlain-text body (Handlebars); null to derive it from the HTML.
variables_schema*objectDeclared variable schema (`{ version: 1, vars: { <name>: { type, required?, default?, description?, options? } } }`), as stored; null if not configured.
tags*arrayTags for organising templates.
created_at*string · date-timeWhen the template was created.
updated_at*string · date-timeWhen the template was last changed.
source*objectWhere this row came from. 'manual' for UI-authored, 'github' for rows maintained by the workspace GitHub integration sync. Migration 0020.
source_ref*stringStable provider pointer used by the editor to build "Open on GitHub →" links. Shape: `github:<owner>/<repo>@<branch>:<path-in-repo>`.
source_synced_at*string · date-timeWhen the sync service last wrote this row. null for manual rows.
version*numberThe published version: the one every send uses (tasks/mail-api/087). The subject, bodies and schema above are its content.
has_draft*booleanWhether an unpublished draft exists.
draftobjectThe unpublished draft, or null. Returned by single-template reads and writes; absent from lists.
Example
Request
POST https://api.mail.productcraft.co/v1/workspaces/{workspace_id}/templates/{name}/publish
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
{
"note": "Shorter subject line"
}Response
{
"id": "00000000-0000-0000-0000-000000000000",
"workspace_id": "00000000-0000-0000-0000-000000000000",
"name": "string",
"kind": {},
"subject": "string",
"body_html": "string",
"body_text": "string",
"variables_schema": {},
"tags": [
"string"
],
"created_at": "2026-01-01T00:00:00.000Z",
"updated_at": "2026-01-01T00:00:00.000Z",
"source": {},
"source_ref": "string",
"source_synced_at": "2026-01-01T00:00:00.000Z",
"version": 0,
"has_draft": false,
"draft": {}
}