Introduction
The LianaMailer REST API lets your applications manage contacts and mailing lists, send newsletters and transactional mail, and read delivery reports and tracking events. Responses are JSON.
API versions
The API has three versions. They cover different tasks rather than replacing each other, and they all use the same credentials.
| Version | Requests | Use it for |
|---|---|---|
| v1 | POST with a JSON body, e.g. /v1/getRecipient | Account, sites, contacts, mailing lists, deliveries and reports |
| v2 | POST with a JSON body | Importing mailing lists, and sending batch, event and web page mail |
| v3 | GET with query parameters | Paged lists of delivery openers and clickers, and tracking events |
See Parameters for how each version takes its parameters.
Regions
Send requests to {base URL}/api/{version}/{endpoint}, using the base URL of your region:
| Region | API URL |
|---|---|
| EU | https://rest.lianamailer.com |
| Asia | https://rest.asia.lianamailer.com |
| Dubai | https://rest.me.lianamailer.com |
For example, getRecipient in the EU region is https://rest.lianamailer.com/api/v1/getRecipient.
Make your first request
The v1 echoMessage endpoint returns the message you send. Use it to
check that your credentials and the connection work.
-
Get a Bearer token
Create a client ID and secret in LianaAccount, and request a token with them. The examples request the scope
mailer-api, which is optional. The token is valid for 15 minutes. -
Send the request
-
Check the response
ResponseIn v1 and v2, a successful response has
succeedset totrueand the data inresult. When a request fails,succeedisfalseandmessagedescribes the error, and the HTTP status is usually still 200. See Errors for v3 and for handling errors.
Next steps
Start with the basics, in this order:
- Authorization: getting a Bearer token.
- Parameters: how v1, v2 and v3 take their parameters, and paging in v3.
- Restrictions: request rate limits and reserved property names.
- Errors: how each version reports errors, and how to handle them.
Then pick the guide for what you are building:
Contact states, and what deleting, restoring and forgetting a contact keeps or erases.
Importing contactsThe v1 and v2 imports compared, and how to follow an import until it is done.
Sending mailChoose between event, batch and web page send, and follow the delivery.
Then browse the endpoints, with examples in cURL, JavaScript, Python, PHP, Java, C#, Go and Ruby: