Create Email Template

POST https://{{instance_url}}/templates/email/create

Use the Template REST APIs to programmatically manage the email templates that you have stored on the Braze dashboard, on the Templates & Media page. Braze provides two endpoints for creating and updating your email templates.

Users' email subscription status can be updated and retrieved via Braze using a RESTful API. You can use the API to set up bi-directional sync between Braze and other email systems or your own database. All API requests are made over HTTPS.

Use the endpoints below to create email templates on the Braze dashboard. These templates will be available on the Templates and Media page. The response from this endpoint will include a field for email_template_id, which can be used to update the template in subsequent API calls.

Request Parameters

ParameterRequiredData TypeDescription
template_nameOptionalStringThe name of your email template
subjectOptionalStringThe email template subject line
bodyOptionalStringThe email template body that may include HTML
plaintext_bodyOptionalStringA plaintext version of the email template body
preheaderOptionalStringThe email preheader used to generate previews in some clients
tagsOptionalStringTags must already exist
should_inline_cssOptionalBooleanEnables or disables the 'inline_css' feature per template. If not provided, Braze will use the default setting for the AppGroup. One of 'true' or 'false' is expected

Possible Errors

  • Template Name is required

  • Tags must be an array.

  • All Tags must be Strings.

  • Some Tags could not be found. - A tag was specified which doesn't exist in this environment.

  • Email must have valid content block names. - The email contains Content Blocks which do not exist in this environment.

  • "Invalid value for 'should_inline_css'. One of 'true' or 'false' was expected" - 'shouldinlinecss' accepts boolean characters only. The error likely is being shown as the value is being sent as a 'string'.

Request Body

{"template_name"=>"email_template_name", "subject"=>"Welcome to my email template!", "body"=>"This is the text within my email body and https://www.braze.com/ here is a link to Braze.com.", "plaintext_body"=>"This is the text within my email body and here is a link to https://www.braze.com/.", "preheader"=>"My preheader is pretty cool.", "tags"=>["Tag1", "Tag2"]}

HEADERS

KeyDatatypeRequiredDescription
Content-Typestring
Authorizationstring