The Mailosaur API lets you test email using a simple REST API. You can make the API calls yourself, however because email and SMS messages can take time to arrive, we highly recommend using one of our official clients.
The Mailosaur API uses API keys to authenticate requests.
Authentication to the API is performed via HTTP Basic Auth. Your API key must be provided as the basic auth username value. You do not need to provide a password.
Your API keys carry many privileges, so always keep them secret and secure! Never share your API key in publicly-accessible areas such GitHub, client-side code, etc.
All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.
curl https://mailosaur.com/api/servers \ -u api:YOUR_API_KEY
You can manage all your API keys in the Mailosaur Dashboard.
Mailosaur uses conventional HTTP response codes to indicate the success or failure of an API request. In general, codes in the
2xx range indicate success, codes in the
4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted), and codes in the
5xx range indicate an error with Mailosaur’s servers (give us a shout in the unlikely event that you see one of those).
|200 OK||Request was successful.|
|204 No Content||Request was successful, no response content.|
|400 Bad Request||The request could not be handled, often due to missing a required parameter.|
|401 Unauthorized||No valid API key provided.|
|404 Not Found||The requested resource doesn’t exist.|
|5XX Server Errors||Something went wrong at Mailosaur. (Give us a shout).|
In case of an error the server will return as much information as possible. In the case of a
404 error the status code gives as much information as you’d need. But for
400 errors Mailosaur will return a JSON object containing the structure below.
Note that our client libraries convert responses to appropriate language-specific objects.
|type||The type of error returned.|
|message||A human-readable message providing more details about the error.|
|parameters||A JSON object containing a key for each property name at fault, with a human-readable message per field.|
|model||The request model that was sent and failed to be processed.|
In this section
The Messages API allows you to list, search, view, modify and create email and SMS messages within your Mailosaur account.
The Analysis API allows you to analyse messages in more detail. For example, running a SpamAssassin report.
The Devices API allows you to generate one-time passwords (OTPs) and virtual security devices, for the purpose of testing authentication systems.
The Servers API allows you to list, view, create, and modify the servers that store your email and SMS messages.