Skip to content

List of Templates

Endpoint: GET https://api.mailjet.com/v1/REST/templates

Using this endpoint, you can retrieve comprehensive list of templates and their corresponding data, including the ExternalID which is needed to send your templates.

Query Parameters

NameTypeDescription
SortstringSort is available for Name, CreatedAt, IsStarred and UpdatedAt. Default: ID ASC.
CheckLocaleOnLastContentbooleanTrue = check the value of the Locale query parameter based on the last content
IDintegerSearch by the ID of the template.
IDsarray of integersSearch by multiple template IDs.
NamestringSearch by the template name. Only returns exact match.
PartialNamestringSearch by partial or fragmentary name.
LocalestringSearch by the template locale. See the list of accepted locales.
EditModeintegerAccepted values: 1, 2, 3 or 4. See more about Edit mode.
LabelIDsarray of integersSearch by label IDs associated to a template.
PurposesstringComma-separated list of purposes. Filters templates having all specified purposes. Accepted values: marketing, transactional, opt-in and automation. Learn more about template purposes.
ExternalIDstringSearch by the send ID of the template.
IsPublishedbooleanTrue = published
IsStarredbooleanTrue = favorite

Example Request

curl --request GET \
  --url https://api.mailjet.com/v1/rest/templates?Limit=3&Sort=UpdatedAt%20DESC&IsStarred=false&Purposes=marketing' / \
  --header 'Authorization: Bearer 612d5125131d406081abb9cd2afdc4e3'

Status Code 200

Response Data Field Structure:

NameTypeDescription
IDintegerThe ID of the template.
NamestringThe name of the template.
EditModeintegerSpecifies the mode in which the template can be edited.
LabelIDsarray of integersAn array of IDs representing labels associated with the template.
Purposesarray of stringsThe type of template. Learn more about template purposes.
ExternalIDstring or nullThe ID that must be used to send the template.
Descriptionstring or nullA brief description of the template.
IsPublishedbooleanIndicates whether the template is published.
IsStarredbooleanIndicates whether the template is marked as a favorite.
IsTextPartGenerationEnabledbooleanDetermines if text part generation functionality is enabled for this template.
CreatedAtDate RFC3339The date and time when the template was created.
UpdatedAtDate RFC3339The date and time when the template was last updated.

API Reponse Example

{
	"Count": 3,
	"Total": 6,
	"Data": [
		{
			"ID": 12,
			"OrganisationID": 2,
			"Name": "Welcome to Mailjet1",
			"EditMode": 2,
			"LabelIDs": [],
			"LastContentType": null,
			"PartialIDs": [],
			"Purposes": [
				"marketing",
				"transactional"
			],
			"Categories": [
				"e-commerce"
			],
			"Presets": null,
			"ExternalID": "123",
			"Description": null,
			"IsPublished": false,
			"IsStarred": false,
			"SoftDeleted": false,
			"IsTextPartGenerationEnabled": false,
			"CreatedAt": "2024-04-19T11:44:24.0638Z",
			"UpdatedAt": "2024-04-19T11:44:24.0638Z"
		},
		{
			"ID": 11,
			"OrganisationID": 2,
			"Name": "Welcome to Mailjet2",
			"EditMode": 2,
			"LabelIDs": [],
			"LastContentType": null,
			"PartialIDs": [],
			"Purposes": [
				"marketing",
				"transactional"
			],
			"Categories": null,
			"Presets": null,
			"ExternalID": "456",
			"Description": null,
			"IsPublished": false,
			"IsStarred": false,
			"SoftDeleted": false,
			"IsTextPartGenerationEnabled": false,
			"CreatedAt": "2024-04-19T11:43:56.283337Z",
			"UpdatedAt": "2024-04-19T11:43:56.283337Z"
		},
		{
			"ID": 10,
			"OrganisationID": 2,
			"Name": "Welcome to Mailjet3",
			"EditMode": 2,
			"LabelIDs": [],
			"LastContentType": null,
			"PartialIDs": [],
			"Purposes": [
				"marketing",
				"transactional"
			],
			"Categories": null,
			"Presets": null,
			"ExternalID": "789",
			"Description": null,
			"IsPublished": false,
			"IsStarred": false,
			"SoftDeleted": false,
			"IsTextPartGenerationEnabled": false,
			"CreatedAt": "2024-04-19T11:33:57.789254Z",
			"UpdatedAt": "2024-04-19T11:33:57.789254Z"
		}
	]
}

Retrieve a Single Template

Endpoint: GET https://api.mailjet.com/v1/REST/templates/:id

Using this endpoint, you can retrieve detailed information about a specific email template using its unique template ID. This endpoint is particularly useful when you need to fetch the details of a single template for viewing, editing, or sending purposes.

URL Parameters

id = The ID of the template.

Example Request

curl --request GET \
  --url https://api.mailjet.com/v1/rest/templates/1 \
  --header 'Authorization: Bearer 612d5125131d406081abb9cd2afdc4e3'

Status code: 200

Response Data Field Structure:

NameTypeDescription
IDintegerThe ID of the template.
NamestringThe name of the template.
EditModeintegerSpecifies the mode in which the template can be edited.
LabelIDsarray of integersAn array of IDs representing labels associated with the template.
Purposesarray of stringsThe type of template. Learn more about template purposes.
ExternalIDstring or nullThe ID that must be used to send the template.
Descriptionstring or nullA brief description of the template.
IsPublishedbooleanIndicates whether the template is published.
IsStarredbooleanIndicates whether the template is marked as a favorite.
IsTextPartGenerationEnabledbooleanDetermines if text part generation functionality is enabled for this template.
CreatedAtDate RFC3339The date and time when the template was created.
UpdatedAtDate RFC3339The date and time when the template was last updated.

API Response Example

{
    "Count": 1,
    "Total": 1,
    "Data": [
        {
            "ID": 27,
            "OrganisationID": 2,
            "Name": "Welcome to Mailjet!",
            "EditMode": 2,
            "LabelIDs": [],
            "LastContentType": null,
            "PartialIDs": [],
            "Purposes": [
                "marketing",
                "transactional"
            ],
            "Categories": [
                "e-commerce"
            ],
            "Presets": null,
            "ExternalID": "123",
            "Description": null,
            "IsPublished": false,
            "IsStarred": true,
            "SoftDeleted": false,
            "IsTextPartGenerationEnabled": false,
            "CreatedAt": "2024-05-23T09:05:22.21546Z",
            "UpdatedAt": "2024-05-23T09:05:22.21546Z"
        }
    ]
}