EmailAPI (v1)

License: Copyright

API to send emails through campaigns: a campaign holds the template, subject and sender, and messages are sent to recipients with personalised data.

Error list

Here is the list of internal error codes, these errors only appear with an HTTP 500 status.

Code HTTP Status
EMA-1 500
EMA-4 500
EMA-10 500
EMA-102 500
EMA-103 500
EMA-105 500

Here is the list of error codes

Code Description HTTP Status
EMA-2 Invalid route 404
EMA-3 A parameter is missing or invalid in the request body (e.g., parameter sent as string instead of an integer) 422
EMA-5 Missing token 401
EMA-6 Invalid token signature 400
EMA-7 Expired token 400
EMA-8 Invalid token 400
EMA-9 Unauthorized access to service (invalid token) 403
EMA-11 Rate limit exceeded 429
EMA-12 HTTP method not allowed for this route (e.g., POST instead of GET), see the Allow header 405
EMA-13 Requested resource not found (e.g., unknown identifier) 404
EMA-101 Failed to download the attachment 422
EMA-104 Blocked campaign 422
EMA-106 Invalid email address 422
EMA-107 One or more provided message references are already used 409

Localization

The API supports response localization based on the Accept-Language HTTP header.
Supported locales: en, fr. Defaults to en if the header is absent or contains an unsupported locale.

Request identifier

Every response (success or error) includes an x-request-id header containing a unique identifier for the request.
Please provide it when contacting support about a specific call.

Rate limiting

All routes are subject to a rate limit (requests per minute). When the limit is exceeded, the API returns an HTTP 429 with error code EMA-11.
The response includes the following headers:

  • X-RateLimit-Limit: maximum number of requests allowed per minute
  • X-RateLimit-Remaining: number of requests remaining in the current window
  • Retry-After: seconds to wait before retrying

Usages

Get API usages

Get API usages for a given period

Authorizations:
BearerToken
query Parameters
start_date
required
string <date>
Example: start_date=2024-01-01
end_date
required
string <date>
Example: end_date=2024-01-31
header Parameters
Accept-Language
string
Example: fr

Locale for response messages. Supported: en, fr. Defaults to en.

Responses

Response samples

Content type
application/json
{
  • "message": "The bearer token is missing",
  • "code": "EMA-5"
}

Status

Check that the API is available

Responses

Response samples

Content type
application/json
{
  • "OK": true
}

Campaigns

Delete a campaign

Delete a campaign.

Authorizations:
BearerToken
path Parameters
id
required
integer
Example: 123

Campaign identifier

header Parameters
Accept-Language
string
Example: fr

Locale for response messages. Supported: en, fr. Defaults to en.

Responses

Response samples

Content type
application/json
{
  • "message": "The bearer token is missing",
  • "code": "EMA-5"
}

Update a campaign

Update an existing campaign. Only the provided fields are modified.

Authorizations:
BearerToken
path Parameters
id
required
integer
Example: 123

Campaign identifier

header Parameters
Accept-Language
string
Example: fr

Locale for response messages. Supported: en, fr. Defaults to en.

Request Body schema: application/json
required

Campaign fields to update

template
string
subject
string
label
string
sender_email
string <email>
sender_name
string
reply_to
string <email>
callback_url
string or null <uri>
operator
string
Enum: "CISS" "SENDGRID"

Responses

Request samples

Content type
application/json
{
  • "template": "<html><body>Hello {{ first_name }}</body></html>",
  • "subject": "Special offer",
  • "label": "May newsletter",
  • "sender_email": "contact@example.com",
  • "sender_name": "John Doe",
  • "reply_to": "reply@example.com",
  • "callback_url": "https://example.com/callback",
  • "operator": "CISS"
}

Response samples

Content type
application/json
{ }

Add attachments to a campaign

Add one or more attachments to a campaign. They are sent with every message of the campaign.

Authorizations:
BearerToken
path Parameters
id
required
integer
Example: 123

Campaign identifier

header Parameters
Accept-Language
string
Example: fr

Locale for response messages. Supported: en, fr. Defaults to en.

Request Body schema: application/json
required

Attachments to add to the campaign

required
Array of objects

Responses

Request samples

Content type
application/json
{}

Response samples

Content type
application/json
{
  • "campaign_id": 123
}

Messages

Send messages for a campaign

Send one or more messages, each to its own recipient, using the template of the campaign. Each message can carry personalised data and optional attachments. Messages are sent asynchronously.

Authorizations:
BearerToken
path Parameters
id
required
integer
Example: 123

Campaign identifier

header Parameters
Accept-Language
string
Example: fr

Locale for response messages. Supported: en, fr. Defaults to en.

Request Body schema: application/json
required

Messages to send, with their recipient, personalised data and attachments (links)

required
Array of objects

Responses

Request samples

Content type
application/json
{
  • "messages": [
    ]
}

Response samples

Content type
application/json
{
  • "campaign_id": 123,
  • "references": [
    ]
}

Validation

Validate an email address

Check that an email address is well formatted and that its domain has a valid MX record.

Authorizations:
BearerToken
header Parameters
Accept-Language
string
Example: fr

Locale for response messages. Supported: en, fr. Defaults to en.

Request Body schema: application/json
required

Email address to validate

email
required
string <email>

Responses

Request samples

Content type
application/json
{
  • "email": "user@example.com"
}

Response samples

Content type
application/json
{
  • "message": "Valid email address."
}