Skip to navigation

Create an email template

View as Markdown

Create a new transactional email template with the specified sender, subject, and content. The sender, subject, and templateName fields are required. Template content can be provided via htmlContent (minimum 10 characters) or htmlUrl; at least one must be supplied. Templates are created as inactive by default unless isActive is explicitly set to true.

Authentication

api-keystring

The API key should be passed in the request headers as api-key for authentication.

OR
AuthorizationBearer

OAuth 2.0 client_credentials (machine-to-machine) grant. Exchange your app's client_id/client_secret for a short-lived Bearer token.

Request

values to update in transactional email template
senderobjectRequired

Sender details including id or email and name (optional). Only one of either Sender's email or Sender's ID shall be passed in one request at a time. For example: {"name":"xyz", "email":"example@abc.com"} {"name":"xyz", "id":123}

subjectstringRequired
Subject of the template
templateNamestringRequired
Name of the template
attachmentUrlstringOptionalformat: "url"

Absolute url of the attachment (no local file). Extension allowed: #### xlsx, xls, ods, docx, docm, doc, csv, pdf, txt, gif, jpg, jpeg, png, tif, tiff, rtf, bmp, cgm, css, shtml, html, htm, zip, xml, ppt, pptx, tar, ez, ics, mobi, msg, pub and eps'

htmlContentstringOptional

Body of the message (HTML version). The field must have more than 10 characters. REQUIRED if htmlUrl is empty

htmlUrlstringOptionalformat: "url"
Url which contents the body of the email message. REQUIRED if htmlContent is empty
isActivebooleanOptional

Status of template. isActive = true means template is active and isActive = false means template is inactive

replyTostringOptionalformat: "email"
Email on which campaign recipients will be able to reply to
tagstringOptional
Tag of the template
toFieldstringOptional

To personalize the To Field. If you want to include the first name and last name of your recipient, add {FNAME} {LNAME}. These contact attributes must already exist in your Brevo account. If input parameter params used please use {{contact.FNAME}} {{contact.LNAME}} for personalization

Response

successfully created
idlong
ID of the object created

Errors

400
Bad Request Error