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.
| Name | Type | Description |
|---|---|---|
Sort | string | Sort is available for UpdatedAt. Default: UpdatedAt DESC. |
ID | integer | The ID of the content version. |
Locale | string | Specifies the locale (language and region) for the template content. |
ContentType | string | "D", "P" or "A". Always "D" when created |
IsLocked | boolean | If this field is true (locked), the template content cannot be edited. |
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
| Name | Type | Description |
|---|---|---|
ID | integer | The ID of the content version. |
TemplateID | integer | The ID of the template. |
ContentType | string | "D", "P" or "A". Always "D" when created. |
Author | string or null | The name of the person or entity creating the template content. |
Name | string | The name of the template content. |
IsLocked | boolean | If this field is true (locked), the template content cannot be edited. |
Locale | string | Specifies the locale (language and region) for the template content. See the full list of accepted locales. |
MJMLPart | string or null | The MJML code for the template. |
HTMLPart | string or null | The HTML code for the template. |
TextPart | string or null | The plain text version of the template content. |
Headers | json string | Additional headers for the template in JSON format. |
CreatedAt | Date RFC3339 | The date and time when the template was created. |
UpdatedAt | Date RFC3339 | The date and time when the template was last updated. |
{
"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"
}
]
}