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_idstringrequired

The template ID (UUID) or alias string.

Body Parameters

namestring

The new template name.

htmlstring

New HTML content with variable placeholders.

aliasstring

New alias. Must be unique within your organization.

fromstring

New default sender email address.

subjectstring

New default email subject.

reply_tostring | string[]

New default reply-to email address(es).

textstring

New plain text content.

variablesarray

New set of template variables (replaces existing variables, max 50).

keystringrequired

Variable key.

typestringrequired

Variable type: "string" or "number".

fallback_valuestring | number

Default value for the variable.

Response Fields

idstring

The template ID.

objectstring

Always "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

Response
{
  "id": "e5f6a7b8-c9d0-1234-efab-345678901234",
  "object": "template"
}