Skip to main content
POST
Create 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.

Body

application/json
name
string
required

Unique among templates of its type, deleted ones included

Required string length: 1 - 255
type
enum<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

Available options:
promotion,
newsletter,
updates,
custom
creator
string | null

The email of a current member of your workspace, credited as its creator; left out, a person's own key credits that person, and any other key (an org key, a digital worker, a Statisfy staff grant) is credited as itself

Required string length: 3 - 320
Pattern: ^[^@\s]+@[^@\s]+$
description
string | null
Maximum string length: 2000
html
string
default:""

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

Maximum string length: 2000000
sender_email
string | null

The address it's sent from

Required string length: 3 - 320
Pattern: ^[^@\s]+@[^@\s]+$
sender_name
string | null
Maximum string length: 255
state
enum<string>
default:draft

published needs a subject, a sender and HTML, and the unsubscribe link unless it is an updates email

Available options:
draft,
published
subject
string | null

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

Maximum string length: 998

Response

201 - 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