Templates

Templates are essential building blocks for your campaigns, transactional emails or automation workflows. With the resources below you can manage your templates and their content.

post

Create an email template

post

Create the contents of an email template

post

/template

Create a new email template object and select its basic configuration settings.

Full API path

https://api.mailjet.com/v3/REST/template

Body parameters

Author

string

The name of the template author.

Categories

string

An array containing a list of strings indicating the categories, to which the template is associated. Accepted values are full, basic, newsletter, e-commerce, events, travel, sports, welcome, contact-property-update, support, invoice, anniversary, account, activation.

Copyright

string

The Copyright message.

Description

string

Free text used as a description for this template.

EditMode

integer

Edit mode for this template:

  • 1 - Passport drag-and-drop builder
  • 2 - Passport HTML builder
  • 3 - Passport Saved Section (snippet) builder
  • 4 - Passport MJML builder

IsStarred

boolean

Indicates whether this campaign is marked as starred or not.

IsTextPartGenerationEnabled

boolean

Indicates whether the generation of a text version of the template will be enabled or not.

Locale

string

The locale for this template (AnsiString).

Default value: en_US

Name

string

Internal name for this template.

OwnerType

string

Indicates the type of the template owner.

Possible values:

  • apikey - Templates and their content can be retrieved, edited and used only by the API Key they were created from.
  • user - Templates created by the Master API Key. Templates and their content can be retrieved by the Master API Key, as well as all subaccount API Keys. However, they can be edited and used only by the Master API Key.
  • global - Generic templates created by Mailjet visible in the Passport Template Gallery.

Default value: apikey

Presets

string

A JSON array containing the different pre-defined styles for this template.

Purposes

string

An array indicating whether the template is a marketing, transactional or automation one. Upon POST request only the first value in the array is taken into account.

Possible values:

  • marketing
  • transactional
  • automation
Responses

Note: You can find all the errors related to API in the error page

Count

integer

Data

array

Author

string

The name of the template author.

Categories

string

An array containing a list of strings indicating the categories, to which the template is associated. Accepted values are full, basic, newsletter, e-commerce, events, travel, sports, welcome, contact-property-update, support, invoice, anniversary, account, activation.

Copyright

string

The Copyright message.

Description

string

Free text used as a description for this template.

EditMode

integer

Edit mode for this template:

  • 1 - Passport drag-and-drop builder
  • 2 - Passport HTML builder
  • 3 - Passport Saved Section (snippet) builder
  • 4 - Passport MJML builder

IsStarred

boolean

Indicates whether this campaign is marked as starred or not.

IsTextPartGenerationEnabled

boolean

Indicates whether the generation of a text version of the template will be enabled or not.

Locale

string

The locale for this template (AnsiString).

Default value: en_US

Name

string

Internal name for this template.

OwnerType

string

Indicates the type of the template owner.

Possible values:

  • apikey - Templates and their content can be retrieved, edited and used only by the API Key they were created from.
  • user - Templates created by the Master API Key. Templates and their content can be retrieved by the Master API Key, as well as all subaccount API Keys. However, they can be edited and used only by the Master API Key.
  • global - Generic templates created by Mailjet visible in the Passport Template Gallery.

Default value: apikey

Presets

string

A JSON array containing the different pre-defined styles for this template.

Purposes

string

An array indicating whether the template is a marketing, transactional or automation one. Upon POST request only the first value in the array is taken into account.

Possible values:

  • marketing
  • transactional
  • automation

ID

integer

Unique numeric ID for this template.

OwnerId

integer

The UserID associated with the owner of this template.

Previews

object

A JSON array containing Data ID's for the previews.

CreatedAt

string

Timestamp indicating when the template was created.

LastUpdatedAt

string

Timestamp indicating when the template was last updated.

Total

integer

post

/template/{template_ID or Owner_Type|Template_Name}/detailcontent

Create the contents of an email template. You can select a Text part, HTML part, MJML content, as well as additional headers.

Full API path

https://api.mailjet.com/v3/REST/template/{template_ID}/detailcontent

Path parameters

template_ID

integer, required

Unique numeric ID for the template you want to create contents for.

Owner_Type|Template_Name

A combination of the OwnerType and user-selected name for the template you want to create the contents of, separated with a vertial line. E.g. user|Weekly Newsletter.

Body parameters

Headers

object

List of default headers as {header_name}:{header_value} pairs. The accepted headers are:

  • From - Value should include the sender name and/or email address in the following formats: john@example.com or <john@example.com> or "John Doe" <john@example.com>

  • Subject - The subject line of this template

  • Reply-To - The reply-to email address for this template

Html-part

string

The HTML-formatted content of the template with Mustache-like logic.

MJMLContent

string

The content of the template in MJML.

Text-part

string

The plain text content of the template with Mustache-like logic.

Responses

Note: You can find all the errors related to API in the error page

Count

integer

Data

array

Headers

object

List of default headers as {header_name}:{header_value} pairs. The accepted headers are:

  • From - Value should include the sender name and/or email address in the following formats: john@example.com or <john@example.com> or "John Doe" <john@example.com>

  • Subject - The subject line of this template

  • Reply-To - The reply-to email address for this template

Html-part

string

The HTML-formatted content of the template with Mustache-like logic.

MJMLContent

string

The content of the template in MJML.

Text-part

string

The plain text content of the template with Mustache-like logic.

Total

integer