API Reference

Publish template

POST /templates/:id/publish — snapshot the draft and make it live.

POST/templates/:id/publish

Publishes the current draft: copies the working subject/html/text into the published snapshot, sets status to "published", stamps published_at, and records a new entry in the version history (current_version_id is updated). Every send that references the template — `POST /emails`, batch, campaigns and automations — reads the published snapshot, so an unpublished template cannot be sent at all and later draft edits stay invisible until you publish again.

import { Mailblastr } from 'mailblastr';

const mb = new Mailblastr('mb_xxxxxxxxx');

const { data, error } = await mb.templates.publish('43f68331-0622-4e15-8202-246a0388854b');
console.log({ data, error });

Response

{ "object": "template", "id": "43f68331-0622-4e15-8202-246a0388854b" }
Returns not_found if no template with that id belongs to you.