The following adheres to Send API v3.0
Mailjet provides 2 properties to tag messages with your own custom information.
These custom pieces of information are returned back in the events you registered to via our Event API and in the messages processed via our Parse API.
Sometimes you need to use your own ID in addition to ours to be able to trace back the message in our system easily. For this purpose we let you insert your own ID in the message. To achieve this, just pass the ID you want to use in the Mj-CustomID property.
# This call sends a message to one recipient with a CustomID.
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!",
"Text-part":"Dear passenger, welcome to Mailjet! May the delivery force be with you!",
"Html-part":"<h3>Dear passenger, welcome to <a href=\"https://www.mailjet.com/\">Mailjet</a>!<br />May the delivery force be with you!",
"Recipients":[{"Email":"passenger@mailjet.com"}],
"Mj-CustomID":"PassengerEticket1234"
}'From then, your CustomID is linked to our own Message ID. You can also retrieve the message later by providing it to the /message resource CustomID filter.
# View : API Key Statistical campaign/message data.
curl -s \
-X GET \
--user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" \
https://api.mailjet.com/v3/REST/message?CustomID=PassengerEticket1234Sometimes, you need more than just an ID to represent the context to what a specific message is attached to. For this purpose, we let you insert a payload in the message which can be of any format (XML, JSON, CSV, etc). To take advantage of this, just pass the payload you want in the Mj-EventPayLoad property.
# This call sends a message to one recipient with an EventPayload.
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!",
"Text-part":"Dear passenger, welcome to Mailjet! May the delivery force be with you!",
"Html-part":"<h3>Dear passenger, welcome to <a href=\"https://www.mailjet.com/\">Mailjet</a>!<br />May the delivery force be with you!",
"Recipients":[{"Email":"passenger@mailjet.com"}],
"Mj-EventPayLoad":"Eticket,1234,row,15,seat,B"
}'