Update template
PATCH /templates/:id — edit a template's name, subject, or body.
/templates/:idUpdates only the fields you provide; omitted fields are left unchanged.
namestringoptionalNew name.
aliasstring | nulloptionalNew alias. Pass null to clear. Must be unique across your templates.
subjectstring | nulloptionalNew default subject. Pass null to clear.
htmlstring | nulloptionalNew HTML body. Pass null to clear.
textstring | nulloptionalNew plain-text body. Pass null to clear.
fromstring | nulloptionalNew default sender address. Use "Your Name <sender@domain.com>" for a friendly name. Pass null to clear.
reply_tostring | string[] | nulloptionalNew default Reply-To address, or an array of addresses. Pass null to clear.
variablesarrayoptionalReplaces the template's variables (up to 50). Each is an object with key, type, and optional fallback_value — same shape as on create.
keystringrequiredThe variable key. Reserved names that cannot be used: FIRST_NAME, LAST_NAME, EMAIL, UNSUBSCRIBE_URL, contact, this. Keys must start with a letter or underscore and contain only letters, digits, underscores, or dots.
type'string' | 'number'optionalThe type of the variable. Defaults to string when omitted.
fallback_valuestring | number | nulloptionalThe value used when none is supplied at send time. Must match type.
import { MailBlastr } from 'mailblastr';
const mb = new MailBlastr('mb_xxxxxxxxx');
const { data, error } = await mb.templates.update('tmpl_8f5c2a1e', { "subject": "Welcome aboard, {{first_name}}!" });
console.log({ data, error });Also edits a draft (does not auto-publish). Returns { object: "template", id }.