Update Template
Update a template's content or metadata. Updating a published template sets has_unpublished_versions to true until it is re-published.
PATCH
/templates/{template_id}Requires a full_access API key.
Path Parameters
template_idstringrequiredThe template ID (UUID) or alias string.
Body Parameters
namestringThe new template name.
htmlstringNew HTML content with variable placeholders.
aliasstringNew alias. Must be unique within your organization.
fromstringNew default sender email address.
subjectstringNew default email subject.
reply_tostring | string[]New default reply-to email address(es).
textstringNew plain text content.
variablesarrayNew set of template variables (replaces existing variables, max 50).
keystringrequiredVariable key.
typestringrequiredVariable type: "string" or "number".
fallback_valuestring | numberDefault value for the variable.
Response Fields
idstringThe template ID.
objectstringAlways "template".
curl -X PATCH 'https://api.postflare.app/templates/e5f6a7b8-c9d0-1234-efab-345678901234' \
-H 'Authorization: Bearer re_xxxxxxxxx' \
-H 'Content-Type: application/json' \
-d '{
"subject": "Welcome to Acme — Getting Started",
"html": "<p>Welcome, {{{FIRST_NAME}}}! Let us show you around.</p>"
}'const response = await fetch(
'https://api.postflare.app/templates/welcome-email',
{
method: 'PATCH',
headers: {
'Authorization': 'Bearer re_xxxxxxxxx',
'Content-Type': 'application/json',
},
body: JSON.stringify({
subject: 'Welcome to Acme — Getting Started',
html: '<p>Welcome, {{{FIRST_NAME}}}! Let us show you around.</p>',
}),
}
);
const data = await response.json();Response
{
"id": "e5f6a7b8-c9d0-1234-efab-345678901234",
"object": "template"
}