Mailjet has updated its Data & Privacy Policy, in accordance with european laws on cookies use. If you choose to pursue your browsing on our site, you explicitly agree that we may register cookies on your computer, for purposes of information collect and improvement of our services.

Mailjet Web API

Communication to and from our API is done through HTTP(S) GET and POST queries. We support different formats to choose from depending on your affinities : JSON, XML, serialized PHP, and CSV for some export functions. You can access our API from almost any programming language, and in just a few minutes with our plug and play libraries.

Downloads

PHP

Usage

1. Edit your Api Keys in the Mailjet's API Class.
2. Make a quick call to confirm that everything's fine!

<?php// Include Mailjet's API Classinclude_once('php-mailjet.class-mailjet-0.1.php');// Create a new Object$mj=new Mailjet();// Get some of your account informations$me=$mj->userInfos();// Display your firstnameecho$me->infos->firstname;?>

Urls

The can send or get data via our API functions via two types of requests: GET and POST. Each request made match a method of the API on our servers.
To make the best use of the public API (the one you may have downloaded and installed on your own server), you should understand the difference between GET and POST methods, in which cases and how to use them.

Our public API has been developed to help you formatting queries and interpreting the results (or errors) with the least effort possible. Still, this documentation will be even more necessary if you want to use your own scripts.

GET Requests

Data recovery is done via GET requests. This means you can specify all the information and options directly into the url.
Your need to specify the method and the function and if needed options necessary for your request.
The URL looks like this :

api.mailjet.com/0.1/methodFunction?option=value

For example, if your want to get the statistics of your message with the ID123, The final built URL must be :

api.mailjet.com/0.1/campaignStatistics?id=123

POST Requests

Inserting, updating, or deleting data works via the POST methods. These more sensitive methods require authentication via HTTP_AUTH.
POST requests work much like the GET request, the only difference being that the variables passed as parameters must be submitted via a POST request, and will not be visible in the url.

Status code

500 Internal Server Error

› Description:Status returned when an unknow error occurs

200 OK

› Description:All gone well. Congrats!

201 Created

› Description:A new insertion was done.

204 No Content

› Description:No content found or expected to return.

304 Not Modified

› Description:Nothing was modified.

400 Bad Request

› Description:One or more arguments are missing or maybe mispelling.

401 Unauthorized

› Description:You have specified an incorrect ApiKey or username/password couple