API Reference
Duplicate template
POST /templates/:id/duplicate — copy a template into a new draft.
POST
/templates/:id/duplicateCreates a new template that is an exact copy of the source (subject, html, text, from, reply_to, variables). The copy starts as a fresh draft — new id, no published snapshot, no version history. The source's alias is dropped because aliases must be unique; supply a new one in the request body if you want one.
Body parameters
namestringoptionalName for the copy. Defaults to "<source name> (copy)" when omitted.
aliasstringoptionalAlias for the copy. Must be unique across your templates. Omit to create the copy without an alias.
import { Mailblastr } from 'mailblastr';
const mb = new Mailblastr('mb_xxxxxxxxx');
const { data, error } = await mb.templates.duplicate('43f68331-0622-4e15-8202-246a0388854b', { "name": "Welcome email v2" });
console.log({ data, error });Response
{ "object": "template", "id": "b8d4f21c-3e07-4a95-bf62-1d9c5e08a743" }Returns
not_found if no template with that id belongs to you.