Skip to content

List All Template Content

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

You can use this endpoint to retrieve previous versions of your template's content. Specifically, you can access the five most recent versions for each status: Draft, Published and Autosave.

This feature is particularly useful when looking to revert your template content to a previous version. Learn how to revert your template content to a previous version in the FAQ.

URL Parameters id = The ID of the template.

Query Parameters

NameTypeDescription
SortstringSort is available for UpdatedAt. Default: UpdatedAt DESC.
IDintegerThe ID of the content version.
LocalestringSpecifies the locale (language and region) for the template content.
ContentTypestring"D", "P" or "A". Always "D" when created
IsLockedbooleanIf this field is true (locked), the template content cannot be edited.

Example Request

curl --request GET \
  --url https://api.mailjet.com//v1/rest/templates/1/contents?Limit=2&Sort=Updated%20ASC&Locale=fr_FR' \
  --header 'Authorization: Bearer 612d5125131d406081abb9cd2afdc4e3'

Status Code 200

Response Data Field Structure

NameTypeDescription
IDintegerThe ID of the content version.
TemplateIDintegerThe ID of the template.
ContentTypestring"D", "P" or "A". Always "D" when created.
Authorstring or nullThe name of the person or entity creating the template content.
NamestringThe name of the template content.
IsLockedbooleanIf this field is true (locked), the template content cannot be edited.
LocalestringSpecifies the locale (language and region) for the template content. See the full list of accepted locales.
MJMLPartstring or nullThe MJML code for the template.
HTMLPartstring or nullThe HTML code for the template.
TextPartstring or nullThe plain text version of the template content.
Headersjson stringAdditional headers for the template in JSON format.
CreatedAtDate RFC3339The date and time when the template was created.
UpdatedAtDate RFC3339The date and time when the template was last updated.

API Response

{
	"Count": 2,
	"Total": 2,
	"Data": [
		{
			"ID": 2,
			"OrganisationID": 2,
			"UserID": 2,
			"TemplateID": 1,
			"ContentType": "P",
			"Author": "",
			"Name": "",
			"IsLocked": false,
			"Locale": "fr_FR",
			"Headers": {
				"Subject": "Welcome to Mailjet",
				"From": "MyCompany <info@mycompany.com>",
				"Reply-To": "",
				"SenderName": "My Company",
				"SenderEmail": "info@mycompany.com"
			},
			"HTMLPart": "<!doctype html><html><body><p>May the delivery force be with you!</p></body></html>",
			"TextPart": "Dear passenger, welcome to Mailjet! May the delivery force be with you!",
			"CreatedAt": "2024-03-27T16:15:44.812084Z",
			"UpdatedAt": "2024-03-27T16:15:44.812084Z"
		},
		{
			"ID": 1,
			"OrganisationID": 2,
			"UserID": 2,
			"TemplateID": 1,
			"ContentType": "D",
			"Author": "",
			"Name": "",
			"IsLocked": false,
			"Locale": "fr_FR",
			"Headers": {
				"Subject": "Welcome to Mailjet",
				"From": "MyCompany <info@mycompany.com>",
				"Reply-To": "",
				"SenderName": "My Company",
				"SenderEmail": "info@mycompany.com"
			},
			"HTMLPart": "<!doctype html><html><body><p>May the delivery force be with you!</p></body></html>",
			"TextPart": "Dear passenger, welcome to Mailjet! May the delivery force be with you!",
			"CreatedAt": "2024-03-19T13:37:27.11497Z",
			"UpdatedAt": "2024-03-19T13:37:27.11497Z"
		}
	]
}