Skip to main content
PATCH
Change an email template

Authorizations

Authorization
string
header
required

An API key, sent as Authorization: Bearer stfy_live_…. See Authentication for how to get one and which scopes it needs.

Path Parameters

template_id
string
required

The template's id, from GET /v1/templates

Body

application/json
description
string | null

null clears it

Maximum string length: 2000
editor
string

html: the app opens it in its HTML editor from now on, and a design made in the visual editor is dropped. Needed to change the HTML of a template built in the visual editor

Allowed value: "html"
html
string

The email's HTML, with Jinja merge tags such as {{contact.first_name}}, {{account.name}}, {{user.name}} (the sender) and {{unsubscribe_this}} (the unsubscribe link's address). GET /v1/templates/merge-tags lists the workspace's. A merge tag with no value for a recipient renders empty, except a {{user.*}} tag (the sender): it takes its value from the person the campaign sends as through an owner role, and when there is no such person or their field is blank, the campaign's send fails. To change the HTML of a template built in the visual editor, send editor: html too

Maximum string length: 2000000
name
string

Unique among templates of its type

Required string length: 1 - 255
sender_email
string | null

null clears it

Required string length: 3 - 320
Pattern: ^[^@\s]+@[^@\s]+$
sender_name
string | null

null clears it

Maximum string length: 255
state
enum<string>

published as on create; draft hides it when someone sets up a campaign or flow, but those already using it keep sending it, so a template that was published still needs what publishing needs

Available options:
draft,
published
subject
string | null

null clears it. Sent as written: merge tags in a subject are not filled in

Maximum string length: 998
type
enum<string>

promotion, newsletter, updates or custom, as the app offers them. An updates email may go without an unsubscribe link; the others need one to be published

Available options:
promotion,
newsletter,
updates,
custom

Response

200 - application/json

Successful Response

attachments
EmailTemplateAttachment · object[]
required

Files sent with it, added in the app

created_at
string<date-time>
required
creator
string | null
required

The email of the member who created it; null when an API key did

description
string | null
required
editor
enum<string>
required

Which of the app's editors opens it: visual (the drag-and-drop builder, which keeps its own design of the email) or html (its HTML editor)

Available options:
visual,
html
html
string
required

The email's HTML, with Jinja merge tags such as {{contact.first_name}}, {{account.name}}, {{user.name}} (the sender) and {{unsubscribe_this}} (the unsubscribe link's address). GET /v1/templates/merge-tags lists the workspace's. A merge tag with no value for a recipient renders empty, except a {{user.*}} tag (the sender): it takes its value from the person the campaign sends as through an owner role, and when there is no such person or their field is blank, the campaign's send fails

id
string
required
merge_tags
string[] | null
required

The merge tags its HTML uses, as group.key (account.name) or a name (unsubscribe_this); null when the HTML isn't valid Jinja (a preview says why)

name
string
required

Unique among templates of its type (deleted ones included)

sender_email
string | null
required
sender_name
string | null
required
state
enum<string>
required

draft or published. The app offers only published templates when someone sets up a campaign or flow, but a campaign or flow already using a template reads it each time it sends, draft or published: a change goes out on its next send. Deleting a template is what stops it

Available options:
draft,
published
subject
string | null
required

Sent as written: merge tags in a subject are not filled in

type
string
required

promotion, newsletter, updates or custom, as the app offers them. An updates email may go without an unsubscribe link; the others need one to be published

updated_at
string<date-time>
required
used_by_campaigns
integer
required

How many campaigns point at it, whatever their status. Each reads the template when it sends; a campaign whose template is deleted skips sending. Agent Studio flows that send it are not counted