The following adheres to Send API v3.0
Mailjet offers to store your transactional message templates on its platform. You can use these templates in your transactional API call to remove the need to repeat the content of a transactional message at each Send API call.
You can either create the templates through our online drag and drop Email Editor or through the /template resource.
You can learn more about storing your templates through API here.
You can also follow our Step by Step guide to create your first Passport template with templating language.
In the templates, you will be able to use simple personalization ([[data:property_name]] or [[var:variable_name]]) or advanced templating language ({{data:property_name}}, {{var:variable_name}}, conditional statements and loop statements).
In this sample, Mj-TemplateID will be the ID provided by Passport at the end of your designing process or the ID returned by the /template resource.
The Mj-TemplateLanguage property in the payload provided to Send API is optional but if you want to have the templating language interpreted, it will be mandatory and must have a true value..
# This call sends a message based on a template.
curl -s \
-X POST \
--user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" \
https://api.mailjet.com/v3/send \
-H 'Content-Type: application/json' \
-d '{
"FromEmail":"pilot@mailjet.com",
"FromName":"Mailjet Pilot",
"Subject":"Your email flight plan!",
"Mj-TemplateID":"1",
"Mj-TemplateLanguage":true,
"Recipients":[
{
"Email": "passenger@mailjet.com"
}
]
}'