Esendex Logo
MENU
Log in to my account
Log in to my account
  • API Reference
  • Quickstart Guides
  • SDKs
API Reference

Rich Content API

This API allows you to send richer content (images, buttons, files) using multiple communication channels.

Prerequisites

Your account must be allowed to send Rich Content.
Please ask your account manager to give you access to the Rich Content API.



Channels

SMS

SMS is the channel available by default. Sending a message that contains rich content via SMS will result in the rich content platform creating a landing page to display your content. You will be able to customise the link that is displayed in the SMS to match your branding.

RCS

RCS can be used in conjunction with SMS or as the sole channel. When used with SMS, the channels will be attempted in order and the platform will send only once to the first compatible channel. For example a request with the channel "RCS" will attempt to look up the Esendex account's RCS agent before sending. If the agent has been set up, and the recipient is capable of RCS the message will be delivered over RCS.

WhatsApp

WhatsApp is now available via the Rich Content API in preview mode. Once we have registered your account as an official WhatsApp business account you can set the channels object to ["WhatsApp"]. The channels object does not currently support combining WhatsApp with RCS/SMS. Please discuss with your account manager to find out more.

Authentication

First time setup

  1. Access the Esendex developer console https://console.esendex.com
  2. Sign in using your normal Esendex credentials.
  3. Ensure your user has a subscription to the Rich Content Product
  4. Retrieve your Rich Content Primary Key from your Developer Profile



Send a text message

Request sample

POST https://connect.esendex.com/richcontent/v3/send

Authorization: YOUR_PRIMARY_KEY
Content-Type: application/json

Request Body

{
  "accountReference": "{ESENDEX_ACCOUNT_REFERENCE}",
  "channels": [
    "SMS"
  ],
  "metadata":{
    "key": "value"
  },
  "recipient": {
    "variables": {
      "name": "Fred"
    },
    "address": {
      "msisdn": "{INTERNATIONALISED_PHONE_NUMBER}"
    }
  },
  "content": {
    "body": {
      "text": {
        "value": "Hello [[name]]"
      }
    }
  },
  "channelSettings": {
    "sms": {
      "originator": "{MESSSAGE_ORIGINATOR}",
      "characterSet": "GSM"
    }
  },
  "expiry": "30"
}

For more information, see Send Request Elements and Send Responses.



Send a Messaging Studio template

Request sample

POST https://connect.esendex.com/richcontent/v3/send

Authorization: YOUR_PRIMARY_KEY
Content-Type: application/json

Request Body

{
  "accountReference": "{ESENDEX_ACCOUNT_REFERENCE}",
  "channels": [
    "SMS"
  ],
  "metadata":{
    "key": "value"
  },
  "recipient": {
    "variables": {
      "name": "Fred"
    },
    "address": {
      "msisdn": "{INTERNATIONALISED_PHONE_NUMBER}"
    }
  },
  "content": {
    "templateId": "{TEMPLATE_ID}"
  }
}

For more information, see Send Request Elements and Send Responses.



Send Request Elements

Request Body
Property Description
accountReference Your Esendex account reference which was whitelisted for the Rich Content Platform on sign up (e.g. EX000000)
channels See the section on channels
metadata Metadata is used to provide any additonal data with your message that we will then post back to you in all webhook events relating to this message
recipient.address.msisdn This should be set to a MSISDN in E.164 internationalised format.
recipient.variables Key-Value pairs that will be substituted in to the message body before sending. See below for more details.
content The message content to send
content.templateId The ID (not name) of your Messaging Studio template.
Retrieve your template Id
channelSettings.sms.originator This value will appear as the sender of the SMS message.
channelSettings.sms.characterSet The character set used to send SMS messages.
Valid values are: GSM or Unicode or Auto. When using Auto the character set is detected automatically.
What are GSM and Unicode?
expiry This is the number of days that data for this send will be kept for. After this time, no data for this send will be available from the rich content platform.



Template ID

To retrieve your template ID

  1. Sign into https://studio.esendex.com
  2. Locate your template and click the edit button
  3. Retrieve the template ID from the URL

Messaging Studio Url
In this example, the template ID is d055fa56-fca1-4097-8a47-9b361ab62d57



Recipient Variables

Variables allow you to specify placeholders within your message body to be replaced by a value of your choice. The key for your placeholder can be anything you choose, but it can be useful to have them named relevant to the data they are representing.

Example Text Variable Usage

{
   "recipient": {
    "variables": {
      "first_name": "John",
      "last_name": "Smith"
    },
    "address": {
      "msisdn": "+447123456789"
    }
  },
  "content": {
    "text": "Hello [[first_name]] [[last_name]]"
  }
}

Variables can also be used to specify values within more complex body components. When creating a template with calendar buttons in Studio, you can choose to have the start and end date as variables.

Calendar Button Variable Options
Here you can also specify a custom name for the variables, in case the template contains more than one calendar button

Once your template contains calendar button variables, you can provide values in the recipient, just like you would for text variables. It's important to note that the dates used for calendar buttons must be in the UTC timezone, and in the format yyyy-mm-ddThh:mm:ssZ.

Example Calendar Button Variable Usage

{
  "recipient": {
    "variables": {
      "calendar_test_start": "2019-01-01T12:00:00Z",
      "calendar_test_end": "2019-01-01T14:00:00Z"
    },
    "address": {
      "msisdn": "+447123456789"
    }
  },
  "content": {
    "templateId": "194edbcb-f5ca-459a-b368-59d35e5a0cb1"
  }
}



E.164 MSISDN Format

The telephone number of the message recipient must be in E.164 format. This means the number must be in the format:

+{Country Dial Code}{Rest of phone number}

Examples

Phone Number Country Dial Code E.164 Formatted Number
07948751633 UK 44 +447948751633
0123456789 France 33 +33123456789
912345678 Spain 34 +34912345678
0491570156 Australia 61 +61491570156
5417543010 USA 1 +15417543010



Send Responses

Successful Response

HTTP Status Code: 202 Accepted

Example Response Body

Content-Type: application/json

{
  "gatewayId": "720cf6cb-9d65-4891-a40a-f93b275f0230"
}




Gateway ID

The Gateway ID, returned from the API when submitting a message, is your reference to the message. It is highly recommended to store this, as it can be used to retrieve the status of your message, and also acts as a request ID. Providing your Gateway ID when contacting support can help us understand more about what happened to your message.

Error Responses

HTTP Status Code: 400 Bad Request

If there are validation errors in the request the API will return a 400 BAD REQUEST response containing all errors to be rectified by the consumer.

Example Response Body

Content-Type: application/json

{
  "gatewayId": "f0dcb290-cfcf-4f03-8fec-8beb9f55a609",
  "errors": [
    {
      "error": "Channels must be SMS or RCS",
      "code": "channels_invalid"
    }
  ]
}
HTTP Status Code Reason
401 Unauthorized Access denied due to invalid subscription key. Make sure to provide a valid key for an active subscription.
422 Unprocessable Entity The request was not valid JSON and could not be validated.
502 Bad Gateway / 503 Service Unavailable There is a temporary problem contacting the API. Retry the request.




Get the status of a message

GET https://connect.esendex.com/richcontent/v3/accounts/{AccountReference}/messages/{GatewayId}

Request sample

GET https://connect.esendex.com/richcontent/v3/accounts/EX0000123/messages/2f77cb1a-15ae-48d7-a80e-5223f47f4366

Authorization: YOUR_PRIMARY_KEY



Send Status Responses

Successful Response

HTTP Status Code: 200 OK

Example Response Body

Content-Type: application/json

{
  "gatewayId": "2f77cb1a-15ae-48d7-a80e-5223f47f4366",
  "status": "Delivered",
  "channel": "rcs",
  "recipient": {
    "address": {
      "msisdn": "+447123456789"
    }
  },
  "lastUpdatedUtc": "2019-05-28T09:47:21Z",
  "events": [
    {
      "metaData": {
        "customButtonKey1": "value1",
        "customButtonKey2": "value2"
      },
      "type": "Clicked",
      "occurredAt": "2019-10-09T02:29:37Z"
    },
    {
      "type": "Read",
      "occurredAt": "2019-10-09T02:29:27Z"
    },
  ],
  "metadata": {
    "customKey1": "value1",
    "customKey2": "value2"
  },
}



Response body breakdown

Property Description
gatewayId The gateway ID from the response of the original send request
status Message status. Values: Submitted, Delivered, Failed
reason Failure reason. Only present if status is Failed
channel Communication channel used to send the message. Lowercase. See channels
recipient.address.msisdn Formatted recipient phone number. See E.164 MSISDN Format
events Analytics events associated to the message (e.g. Read, Clicked)
lastUpdatedUtc The UTC date & time when the message reached this status


Error Responses
HTTP Status Code Reason
400 Bad Request Your request must contain the expected properties with acceptable data. Will include an error message explaining the problem.
401 Unauthorized Your request must contain a valid subscription key.
You must have access to the account.
The account must have access to the rich content platform.
404 Not found The send cannot be found.
429 Too many requests Number of requests has exceeded allowance. Please wait and try again.
502 Bad Gateway / 503 Service Unavailable There is a temporary problem contacting the API. Retry the request.



Webhooks

Use webhooks to track the status of a message

Esendex's Webhooks system delivers events directly to your applications, letting you know when something has happened, such as a customer sending you a message. They can be used to create conversational experiences for your customers and advanced reports on customer engagement.

Prerequisites

Webhooks has restricted access. Please contact your account manager if you wish to use this feature.

First time setup

  1. Navigate to https://console.esendex.com/products
  2. Sign in using your normal Esendex credentials.
  3. Check that you have a subscription to the Webhooks Product
  4. Retrieve your Webhooks Subscription Key from your Developer Profile

Create a subscription

Request sample

POST https://connect.esendex.com/webhooks/v1/accounts/{accountReference}/subscriptions

Authorization: Your webhooks subscription key

Body

Content-Type: application/json

{
    "productId": "richcontentapi",
    "eventId": "failed",
    "endpoints": [
      {
        "type": "HTTP",
        "uri": "https://example.com/callback"
      }
    ],
    "notificationEmails": ["[email protected]"]
}
Property Description
productId The product containing the event you wish to receive.
eventId The specific event you wish to receive.
endpoints An array of endpoints to receive events
endpoints[...].type Must be "HTTP"
endpoints[...].uri The publicly accessible web address for webhooks to send events to
Successful Response

HTTP Status Code: 200 OK

Example Response Body

Content-Type: application/json

{
    "productId": "richcontentapi",
    "eventId": "failed",
    "version": "1",
    "endpoints": [{
        "type": "HTTP",
          "status": 0,    
        "uri": "https://example.com/callback"
    }],
    "notificationEmails": ["[email protected]"]
}

List existing subscriptions

GET https://connect.esendex.com/webhooks/v1/accounts/{accountReference}/subscriptions

Authorization: Your webhooks subscription key
Content-Type: application/json

Response body

[
    {
        "productId": "richcontentapi",
        "eventId": "delivered",
        "version": "1",
        "endpoints": [
            {
                "type": "default",
                "status": 0,
                "uri": "https://example.com/callback"
            }
        ],
        "notificationEmails": [
            "[email protected]"
        ]
    }
]

Remove a subscription

https://connect.esendex.com/webhooks/v1/accounts/{accountReference}/subscriptions/{productId}/{eventId}

Authorization: Your Webhooks Subscription Key

Path parameters

Property Description
accountReference Esendex account reference. E.g. EX0001234.
productId The product containing the event you are subscribed to.
eventId The specific event you no longer wish to receive

Successful Response
200 OK

Types of events

Below are the payloads for the different types of events that your application can receive. When your application receives a webhook, it will receive an array of events.

Example

[
    {
        "productId": "richcontentapi",
        "eventId": "delivered",
        "eventVersion": "1",
        "eventTime": "2020-07-07T17:16:42Z",
        "data": {
            ...
        }
    },
    {
        "productId": "richcontentapi",
        "eventId": "delivered",
        "eventVersion": "1",
        "eventTime": "2020-07-07T17:18:12Z",
        "data": {
            ...
        }
    }
]

Rich content API message events

productId: richcontentapi

These events are related to a message that you have sent through the Rich Content API. Messages sent through Studio or Chat will not result in message events.

When your application sends a message, the Rich Content API response will contain a gatewayId property.

{
  "gatewayId": "720cf6cb-9d65-4891-a40a-f93b275f0230"
}

This identifier will also be present on message events, allowing your application to relate these events to the message you sent.

Delivered

You will receive this event when a message is delivered to the recipient.

{
    "productId": "richcontentapi",
    "eventId": "delivered",
    "eventVersion": "1",
    "eventTime": "2020-07-07T17:16:42Z",
    "data": {
        "accountReference": "EX0123456",
        "gatewayId": "076911ca-8db5-4839-9e45-cf660ec59a92",
        "messageId": "23c4cb4c-9eaf-4326-9495-bda7e87c4e08",
        "metadata": {},
        "recipient": {
            "address": {
                "msisdn": "+447123456789"
            }
        },
        "channel": "sms",
        "occurredAt": "2020-07-07T17:16:40Z"
    }
}
Failed

You will receive this event when we are unable to deliver a message.

{
    "productId": "richcontentapi",
    "eventId": "failed",
    "eventVersion": "1",
    "eventTime": "2020-07-07T17:16:42Z",
    "data": {
        "accountReference": "EX0123456",
        "gatewayId": "076911ca-8db5-4839-9e45-cf660ec59a92",
        "messageId": "23c4cb4c-9eaf-4326-9495-bda7e87c4e08",
        "errorCode": "RC001",
        "description": "Account-level error",
        "metadata": {},
        "recipient": {
            "address": {
                "msisdn": "+447123456789"
            }
        },
        "channel": "sms",
        "occurredAt": "2020-07-07T17:16:40Z"
    }
}

Failure reasons It is possible we may add more failure reasons in the future. You should write your application such that it can handle failure reasons that it does not recognise.

errorCode Description Details
RC000 Platform error An unknown error has occurred. Please contact support.
RC001 Account-level error This occurs when something is wrong with your account's configuration. Please contact your account manager.
RC002 Insufficient balance You have run out of credits and cannot send any more messages down this channel.
RC003 Network provider-level error The network is unable to deliver the message to this recipient. The recipient may not be reachable.
RC004 Message expired We were unable to deliver your message after multiple attempts. We will no longer try to deliver the message.
RC005 Recipient has opted out This recipient has opted out of receiving messages from you. Retrying will not help.
RC006 Platform error An unknown error has occurred. Please contact support.
RC007 Out of session The session for this recipient has expired. You must send a pre-approved template, or wait for the recipient to contact you first.
RC008 The message could not be delivered to the phone number. The recipient may not have a WhatsApp client This recipient cannot be reached over WhatsApp.
RC009 Messaging this recipient is temporarily restricted. A product, such as a chatbot, has temporarily restricted other sources from messaging this recipient. Try again later.
Read

When an RCS/WhatsApp message has been read, or an SMS landing page has been opened.

{
    "productId": "richcontentapi",
    "eventId": "read",
    "eventVersion": "1",
    "eventTime": "2020-07-07T17:16:42Z",
    "data": {
        "accountReference": "EX0123456",
        "gatewayId": "076911ca-8db5-4839-9e45-cf660ec59a92",
        "messageId": "23c4cb4c-9eaf-4326-9495-bda7e87c4e08",
        "metadata": {},
        "recipient": {
            "address": {
                "msisdn": "+447123456789"
            }
        },
        "channel": "sms",
        "occurredAt": "2020-07-07T17:16:40Z"
    }
}
Clicked

When a rich card button has been clicked.

In order to identify which button has been clicked, consider setting Metadata on your rich card buttons.

{
    "productId": "richcontentapi",
    "eventId": "clicked",
    "eventVersion": "1",
    "eventTime": "2020-07-07T17:16:42Z",
    "data": {
        "accountReference": "EX0123456",
        "gatewayId": "076911ca-8db5-4839-9e45-cf660ec59a92",
        "messageId": "23c4cb4c-9eaf-4326-9495-bda7e87c4e08",
        "metadata": {},
        "recipient": {
            "address": {
                "msisdn": "+447123456789"
            }
        },
        "channel": "sms",
        "occurredAt": "2020-07-07T17:16:40Z"
    }
}

Account events

productId: account

Inbound

This event occurs when a message is sent to your account over SMS, RCS, etc.

Text
{
    "productId": "account",
    "eventId": "inbound",
    "eventVersion": "1",
    "eventTime": "2020-07-07T17:16:42Z",
    "data": {
        "accountReference": "EX0123456",
        "messageId": "23c4cb4c-9eaf-4326-9495-bda7e87c4e08",
        "from": "+447123456789",
        "text": "Hello! This is an inbound message",
        "channel": "sms",
        "occurredAt": "2020-07-07T17:16:40Z"
    }
}
File
{
    "productId": "account",
    "eventId": "inbound",
    "eventVersion": "1",
    "eventTime": "2020-07-07T17:16:42Z",
    "data": {
        "accountReference": "EX0123456",
        "messageId": "23c4cb4c-9eaf-4326-9495-bda7e87c4e08",
        "from": "+447123456789",
        "file": {
               "url": "https://www.example.com/fakeimage.jpg",
               "sizeBytes": 12345,
               "contentType": "jpeg"
        },
        "channel": "sms",
        "occurredAt": "2020-07-07T17:16:40Z"
    }
}
Stop

This occurs when a recipient has requested that you no longer send them messages.

{
    "productId": "account",
    "eventId": "stop",
    "eventVersion": "1",
    "eventTime": "2020-07-07T17:16:42Z",
    "data": {
        "accountReference": "EX0123456",
        "messageId": "23c4cb4c-9eaf-4326-9495-bda7e87c4e08",
        "from": "+447123456789",
        "text": "Stop",
        "channel": "sms",
        "occurredAt": "2020-07-07T17:16:40Z"
    }
}






Surveys API

Send Survey

The Send Survey endpoint allows you to send a survey to a specified recipient, you must supply content for all template fields required by your survey. Requests can be made in either JSON or XML.

Request

Method: POST
Authentication: Basic / Session

https://surveys.api.esendex.com/v1.0/surveys/d89f6514-268c-43de-bb99-d676311aad63/send

Example Request Body

loading animation
JSON|XML
Content-Type: application/json

{
  "recipients": [
    {
      "phonenumber": "447700900123",
      "templatefields": {
        "Name": "John Doe",
        "City": "Nottingham"
      },
      "metadata": {
        "Customer Number" : "12345"
      }
    }
  ]
}
Content-Type: application/xml

<?xml version="1.0" encoding="utf-8"?>
<recipients xmlns="http://api.esendex.com/ns/">
  <recipient>
    <phonenumber>447700900123</phonenumber>
    <templatefields>
      <templatefield>
        <name>Name</name>
        <value>John Doe</value>
      </templatefield>
      <templatefield>
        <name>City</name>
        <value>Nottingham</value>
      </templatefield>
    </templatefields>
    <metadata>
      <metadataitem>
        <name>Customer Number</name>
        <value>12345</value>
      </metadataitem>
    </metadata>
  </recipient>
</recipients>
Successful Response

HTTP Status Code: 200 OK

Error Responses

If a request is missing mandatory template fields, the following response will be received:

HTTP Status Code: 400

loading animation
JSON|XML
Content-Type: application/json

{
  "errors": [
    {
      "code": "templatefields_missing",
      "description": "Template fields that are required by this Survey were not supplied",
      "values": ["Name", "Age"]
    }
  ]
}
Content-Type: application/xml

<response xmlns="http://api.esendex.com/ns/">
  <errors>
    <error>
      <code>templatefields_missing</code>
      <description>Template fields that are required by this Survey were not supplied</description>
      <values>
        <value>Name</value>
        <value>Age</value>
      </values>
    </error>
  </errors>
</response>

If a request contains an invalid phone number, the following response will be received:

HTTP Status Code: 400

loading animation
JSON|XML
Content-Type: application/json

{
  "errors": [
    {
      "code": "phonenumber_invalid",
      "description": "Phone number is invalid"
    }
  ]
}
Content-Type: application/xml

<response xmlns="http://api.esendex.com/ns/">
  <errors>
    <error>
      <code>phonenumber_invalid</code>
      <description>Phone number is invalid</description>
    </error>
  </errors>
</response>

If a request does not have a phone number, the following response will be received:

HTTP Status Code: 400

loading animation
JSON|XML
Content-Type: application/json

{
  "errors": [
    {
      "code": "phonenumber_missing",
      "description": "Phone number is missing"
    }
  ]
}
HTTP Status Code 400
Content-Type: application/xml

<response xmlns="http://api.esendex.com/ns/">
  <errors>
    <error>
      <code>phonenumber_missing</code>
      <description>Phone number is missing</description>
    </error>
  </errors>
</response>

If the survey provided in the request is inactive, the following response will be received:

HTTP Status Code: 400

loading animation
JSON|XML
Content-Type: application/json

{
  "errors": [
    {
      "code": "survey_inactive",
      "description": "Survey is no longer active"
    }
  ]
}
Content-Type: application/xml

<response xmlns="http://api.esendex.com/ns/">
  <errors>
    <error>
      <code>survey_inactive</code>
      <description>Survey is no longer active</description>
    </error>
  </errors>
</response>

If the data provided for a recipient exceeds 5000 characters, the following error will be received:

HTTP Status Code: 400

loading animation
JSON|XML
Content-Type: application/json

{
  "errors": [
    {
      "code": "recipient_too_large",
      "description": "Recipient data is greater than 5000 characters"
    }
  ]
}
Content-Type: application/xml

<response xmlns="http://api.esendex.com/ns/">
  <errors>
    <error>
      <code>recipient_too_large</code>
      <description>Recipient data is greater than 5000 characters</description>
    </error>
  </errors>
</response>
HTTP Status Code Reason
401 Not Authorised No authentication header provided.
403 Forbidden Failed authentication or not authorised to access feature.
404 Not Found Survey doesn't exist.
413 Payload Too Large Request contains more than one recipient.
415 Unsupported Media Type Content type is not supported or unspecified.

Standard Report

The Standard Report endpoint allows you to download a report for the data collected through a survey.

Request

Method: GET
Authentication: Basic / Session

https://surveys.api.esendex.com/v1.0/surveys/d89f6514-268c-43de-bb99-d676311aad63/report/standard

Optional Parameters You can provide optional start and end date parameters for the report. The dates will correspond to either when a question was sent or when an answer was received. Providing just a start date will return data from the start date to 35 days after this date. Providing just an end date will return data from 35 days prior to that date until the end date. If no dates are provided then the report will default to return all questions sent within the last 35 days.

Parameter Description
questionsentafter=yyyy-MM-ddTHH:mm:ssZ The start of the date range for when questions were sent out.
questionsentbefore=yyyy-MM-ddTHH:mm:ssZ The end of the date range for when questions were sent out.
answerreceivedafter=yyyy-MM-ddTHH:mm:ssZ The start of the date range for when answers were received.
answerreceivedbefore=yyyy-MM-ddTHH:mm:ssZ The end of the date range for when answers were received.

The format is yyyy-MM-ddThh:mm:ssZ where y=year, M=month, d=day, T=separator, h=hour, m=min and s=seconds. The value is treated as per ISO 8601 semantics, e.g. without time zone information the value is assumed to be the local time of the server, otherwise as an offset from UTC with Z representing a UTC time.

Successful Response

HTTP Status Code: 200 OK

Example Response Body

loading animation
JSON|XML
Content-Type: application/json

{
  "rows": [
    {
      "phonenumber": "44123456789",
      "status": "Delivered",
      "questionlabel": "1",
      "questiondatetime": "2016-11-24T08:15:36.163",
      "answerlabel": "Yes",
      "answerdatetime": "2016-11-24T08:20:51.1",
      "answertext": "Yes",
      "recipientdata": {}
    },
    {
      "phonenumber": "448811772212",
      "status": "Delivered",
      "questionlabel": "1",
      "questiondatetime": "2016-12-01T14:25:57.677",
      "answerlabel": null,
      "answerdatetime": null,
      "answertext": null,
      "recipientdata": {
        "FirstName": "John",
        "LastName": "Smith",
        "FavoriteFruit": "Kiwi"
      }
    }
  ]
}
Content-Type: application/xml

<?xml version="1.0" encoding="utf-8"?>
<rows xmlns="http://api.esendex.com/ns/">
  <row>
    <phonenumber>44123456789</phonenumber>
    <status>Delivered</status>
    <questionlabel>1</questionlabel>
    <questiondatetime>2016-11-24T08:15:36.163</questiondatetime>
    <answerlabel>Yes</answerlabel>
    <answerdatetime>2016-11-24T08:20:51.1</answerdatetime>
    <answertext>Yes</answertext>
    <recipientdata />
  </row>
  <row>
    <phonenumber>448811772212</phonenumber>
    <status>Delivered</status>
    <questionlabel>1</questionlabel>
    <questiondatetime>2016-12-01T14:25:57.677</questiondatetime>
    <answerlabel d3p1:nil="true" xmlns:d3p1="http://www.w3.org/2001/XMLSchema-instance" />
    <answerdatetime d3p1:nil="true" xmlns:d3p1="http://www.w3.org/2001/XMLSchema-instance" />
    <answertext d3p1:nil="true" xmlns:d3p1="http://www.w3.org/2001/XMLSchema-instance" />
    <recipientdata>
      <recipientdataitem>
        <key>FirstName</key>
        <value>John</value>
      </recipientdataitem>
      <recipientdataitem>
        <key>LastName</key>
        <value>Smith</value>
      </recipientdataitem>
      <recipientdataitem>
        <key>FavoriteFruit</key>
        <value>Kiwi</value>
      </recipientdataitem>
    </recipientdata>
  </row>
Error Responses

If a request uses an invalid combination of date parameters, the following response will be received:

HTTP Status Code: 400

loading animation
JSON|XML
Content-Type: application/json

{
  "errors": [
    {
      "code": "mismatched_date_range",
      "description": "Must supply matching pair of date times for either questions sent or answers received"
    }
  ]
}
Content-Type: application/xml

<?xml version="1.0" encoding="utf-8"?>
<response xmlns="http://api.esendex.com/ns/">
  <errors>
    <error>
      <code>mismatched_date_range</code>
      <description>Must supply matching pair of date times for either questions sent or answers received</description>
    </error>
  </errors>
</response>

If the date range provided spans more than 35 days, the following response will be receieved:

HTTP Status Code: 400

loading animation
JSON|XML
Content-Type: application/json

{
  "errors": [
    {
      "code": "date_range_too_long",
      "description": "Date range must be 35 days or fewer"
    }
  ]
}
Content-Type: application/xml

<?xml version="1.0" encoding="utf-8"?>
<response xmlns="http://api.esendex.com/ns/">
  <errors>
    <error>
      <code>date_range_too_long</code>
      <description>Date range must be 35 days or fewer</description>
    </error>
  </errors>
</response>

If the specified date range includes time in the future, the following response will be received:

HTTP Status Code: 400

loading animation
JSON|XML
Content-Type: application/json

{
  "errors": [
    {
      "code": "date_in_future",
      "description": "Cannot download report for dates in future"
    }
  ]
}
Content-Type: application/xml

<?xml version="1.0" encoding="utf-8"?>
<response xmlns="http://api.esendex.com/ns/">
  <errors>
    <error>
      <code>date_in_future</code>
      <description>Cannot download report for dates in future</description>
    </error>
  </errors>
</response>

If a date range is requested with the dates the wrong way around, the following response will be receieved:

HTTP Status Code: 400

loading animation
JSON|XML
Content-Type: application/json

{
  "errors": [
    {
      "code": "date_range_invalid",
      "description": "Start date must be before end date"
    }
  ]
}
Content-Type: application/xml

<?xml version="1.0" encoding="utf-8"?>
<response xmlns="http://api.esendex.com/ns/">
  <errors>
    <error>
      <code>date_range_invalid</code>
      <description>Start date must be before end date</description>
    </error>
  </errors>
</response>

If a date range is requested that contains either 3 or 4 date parameters, the following response will be receieved:

HTTP Status Code: 400

loading animation
JSON|XML
Content-Type: application/json

{
  "errors": [
    {
      "code": "invalid_number_of_dates",
      "description": "Must supply date times for only questions sent or answers received"
    }
  ]
}
Content-Type: application/xml

<?xml version="1.0" encoding="utf-8"?>
<response xmlns="http://api.esendex.com/ns/">
  <errors>
    <error>
      <code>invalid_number_of_dates</code>
      <description>Must supply date times for only questions sent or answers received</description>
    </error>
  </errors>
</response>

If any datetime parameters included in the request couldn't be parsed, the following response will be receieved:

HTTP Status Code: 400

loading animation
JSON|XML
Content-Type: application/json

{
  "errors": [
    {
      "code": "invalid_date",
      "description": "Could not parse datetime"
    }
  ]
}
Content-Type: application/xml

<?xml version="1.0" encoding="utf-8"?>
<response xmlns="http://api.esendex.com/ns/">
  <errors>
    <error>
      <code>invalid_date</code>
      <description>Could not parse datetime</description>
    </error>
  </errors>
</response>
HTTP Status Code Reason
401 Not Authorised No authentication header provided.
403 Forbidden Failed authentication or not authorised to access feature.
404 Not Found Survey doesn't exist.
413 Payload Too Large Request contains more than one recipient.
415 Unsupported Media Type Content type is not supported or unspecified.

SMS APIs

REST API

Authentication

Most of the Resources in the REST API are protected by security privileges granted to a specific user. Each HTTP request to a protected Resource in the REST API must be accompanied by one of the two supported Authentication methods.

Basic Authentication

Basic Authentication passes the user’s credentials of Esendex username and API password to the REST API in an ‘Authorization: Basic’ HTTP header with each request. If you don't yet have an API password, you can log in and generate one on your user profile. Be aware that if you're an existing user with Esendex, your API password may be defaulted to your web login password- we recommend generating an API password and updating any existing integrations if this is the case!

Warning: You can only have one API password, and each time you generate it, your previous password is lost. Before generating (or regnerating) your password, make sure you won't break your existing integrations!

The username and API password are concatenated with a colon (:) and the resulting string is then Base64 encoded. For example, with the username ‘[email protected]’ and the API password ‘59043dff-59cb-4ba9-93ce-ed4bc8650548’ the string to be Base64 encoded would be ‘[email protected]:59043dff-59cb-4ba9-93ce-ed4bc8650548’ which would result in dGVzdEBleGFtcGxlLmNvbTo1OTA0M2RmZi01OWNiLTRiYTktOTNjZS1lZDRiYzg2NTA1NDg=.

A sample HTTP header would look like the following:

GET /v1.0/inbox/messages HTTP/1.1
Authorization: Basic dGVzdEBleGFtcGxlLmNvbTo1OTA0M2RmZi01OWNiLTRiYTktOTNjZS1lZDRiYzg2NTA1NDg=

Session Authentication

Instead of passing the encoded Esendex username and API password in the HTTP Header of each request, users may prefer to use Session Authentication instead. Using a generated Session ID removes the need to disclose the user's credentials with each request made on the REST API which improves security.

Create Session

Request

Method: POST
Authentication: Basic
Content-Type: application/xml
Content-Length: 0

https://api.esendex.com/v1.0/session/constructor  
Successful Response

HTTP Status Code: 200 OK
Example Response Body

<?xml version="1.0" encoding="utf-8"?> 
<session> 
  <id>1183C73D-2E62-4F60-B610-30F160BDFBD5</id>
</session>
Error Responses
HTTP Status Code Reason
401 Not Authorised No authentication header provided.
403 Forbidden Failed authentication or not authorised to access feature.

Using Session Authentication

The Session Id returned from the Session Constructor resource can be used to make further requests on the REST API instead of using the Basic Authentication method each time. The returned Session Id must be Base64 encoded and appended to an 'Authorization: Basic' HTTP header in a similar way to the Basic Authentication method.

For example, if the Session Constructor returns an Id of 20108e1e-e519-4078-9046-b4f6c0c175a6, this transforms into Base64 as: MjAxMDhlMWUtZTUxOS00MDc4LTkwNDYtYjRmNmMwYzE3NWE2.

This would be added to an 'Authorization: Basic' HTTP header as

GET /v1.0/inbox/messages HTTP/1.1
Authorization: Basic MjAxMDhlMWUtZTUxOS00MDc4LTkwNDYtYjRmNmMwYzE3NWE2

Message Dispatcher

The Message Dispatcher resource can be used to send one or more SMS and Voice messages. These can be sent either straight away or scheduled for the future. The XML request object will contain the details of the message(s) to be sent and will generate a message batch response containing a URI to allow future queries to discover the status of the message(s).

Character sets and message parts

Messages can be sent in GSM or Unicode encoding.

GSM messages can be up to 612 characters in length. Messages over 160 characters are comprised of multiple 160-character SMS parts and charged at one SMS credit per part, costing up to four credits for a 612-character message.

Characters 0-160 161-306 307-460 461-612
Credits Required 1 2 3 4

GSM extended symbols are encoded as two characters each as sent: ^, {, }, \, [, ~, ], |, €.

Unicode messages take two bytes per character, so each message part can only contain 70 characters, but a much wider character set is available.

Messages sent through the REST API default to GSM encoding, but Unicode encoding can be selected using the characterset element in requests.

Send a message

Request

Method: POST
Authentication: Basic / Session

https://api.esendex.com/v1.0/messagedispatcher  

Example Request Body

loading animation
XML|JSON
Content-Type: `application/xml`

<?xml version='1.0' encoding='UTF-8'?>  
<messages>  
    <accountreference>EX0000000</accountreference>
    <message>
        <to>447700900123</to>
        <body>Every message matters!</body>
    </message>  
</messages>
Content-Type: `application/json`
Accept: `application/json`

{
  "accountreference":"EX0000000",
  "messages":[{
    "to":"447700900123",
    "body":"Every message matters!"
  }]
}
Successful Response

HTTP Status Code: 200 OK
Content-Type: application/xml

Example Response Body

loading animation
XML|JSON
<?xml version="1.0" encoding="utf-8"?> 
<messageheaders batchid="19aafc9c-b08a-400d-a9f1-afe3c46f0a25" xmlns="http://api.esendex.com/ns/"> 
 <messageheader uri="https://api.esendex.com/v1.0/MessageHeaders/72d91006-eb01-4e69-ae98-0e02c92c8e34" id="72d91006-eb01-4e69-ae98-0e02c92c8e34" /> 
</messageheaders>
{
  "batch": {
    "batchid": "19aafc9c-b08a-400d-a9f1-afe3c46f0a25",
    "messageheaders": [
      {
        "uri": "http://api.esendex.com/v1.0/messageheaders/72d91006-eb01-4e69-ae98-0e02c92c8e34",
        "id": "72d91006-eb01-4e69-ae98-0e02c92c8e34"
      }
    ]
  },
  "errors": null
}
Error Responses
HTTP Status Code Reason
400 Bad Request Invalid/Malformed request body or more than 50,000 messages in request.
401 Not Authorised No authentication header provided.
402 Payment Required Not enough message credits.
403 Forbidden Failed authentication or not authorised to access feature.
404 Not Found The specified contact or contact group doesn't exist.
406 Not Acceptable Empty message body provided.
415 Unsupported Media Type Content type is not supported or unspecified.

Structured responses If a request body is invalid, the following response will be received:

HTTP Status Code: 400

loading animation
XML|JSON
No messages were supplied
{
  "batch": null,
  "errors": [
    {
      "code": "request_invalid",
      "description": "No messages were supplied"
    }
  ]
}

If the account does not exist, the following response will be received:

HTTP Status Code: 400

loading animation
XML|JSON
Invalid Account Reference EX0000000
{
  "batch": null,
  "errors": [
    {
      "code": "accountreference_invalid",
      "description": "Invalid Account Reference EX0000000"
    }
  ]
}

If the body element/property is not provided, the following response will be received:

HTTP Status Code: 400

loading animation
XML|JSON
No message body was specified
{
  "batch": null,
  "errors": [
    {
      "code": "no_content",
      "description": "No message body was specified"
    }
  ]
}

If an invalid parameter is provided, the following response will be received:

HTTP Status Code: 400

loading animation
XML|JSON
Invalid [parameter name] parameter value
{
  "batch": null,
  "errors": [
    {
      "code": "parameter_invalid",
      "description": "Invalid [parameter name] parameter value"
    }
  ]
}

If the sendAt parameter provided is more than two years in the future, the following response will be received:

HTTP Status Code: 400

loading animation
XML|JSON
sendAt invalid in XML, cannot schedule a message more than two years in the future.
{
  "batch": null,
  "errors": [
    {
      "code": "parameter_invalid",
      "description": "sendAt invalid, cannot schedule a message more than two years in the future"
    }
  ]
}

If an invalid account reference is provided, the following response will be received:

HTTP Status Code: 400

loading animation
XML|JSON
Invalid Account Reference [account reference]
{
  "batch": null,
  "errors": [
    {
      "code": "accountreference_invalid",
      "description": "Invalid Account Reference [account reference]"
    }
  ]
}

If you attempt to send to a number that is not your own while on your free trial, the following response will be received:

HTTP Status Code: 400

loading animation
XML|JSON
During your free trial you can only send messages to [your phone number], the number you verified when you signed up. To remove this restriction and send messages to any number around the world, simply buy some message credits at https://www.esendex.com/secure/ecommerce or call us on UK: 0345 356 5758, Ireland: 01 631 9410, France: 01 70 99 35 52, Spain: 900 800 470, Germany: +49 (0) 211 – 417403640, Australia: 1300-764-946
{
  "batch": null,
  "errors": [
    {
      "code": "account_restricted",
      "description": "During your free trial you can only send messages to [your phone number], the number you verified when you signed up. To remove this restriction and send messages to any number around the world, simply buy some message credits at https://www.esendex.com/secure/ecommerce or call us on UK: 0345 356 5758, Ireland: 01 631 9410, France: 01 70 99 35 52, Spain: 900 800 470, Germany: +49 (0) 211 – 417403640, Australia: 1300-764-946"
    }
  ]
}

If you attempt to send more than 50,000 messages in the same request, the following response will be received:

HTTP Status Code: 400

loading animation
XML|JSON
Number of messages exceeds the maximum number allowed
{
  "batch": null,
  "errors": [
    {
      "code": "messagelimit_exceeded",
      "description": "Number of messages exceeds the maximum number allowed"
    }
  ]
}

If you attempt to send when your account has expired, the following response will be received:

HTTP Status Code: 400

loading animation
XML|JSON
Account Is Not Live
{
  "batch": null,
  "errors": [
    {
      "code": "account_not_live",
      "description": "Account Is Not Live"
    }
  ]
}

If you attempt to send a voice message with an invalid language, the following response will be received:

HTTP Status Code: 400

loading animation
XML|JSON
Unsupported language culture: [language], valid languages: en-GB,fr-FR,es-ES,en-AU,de-DE
{
  "batch": null,
  "errors": [
    {
      "code": "language_invalid",
      "description": "Unsupported language culture: [language], valid languages: en-GB,fr-FR,es-ES,en-AU,de-DE"
    }
  ]
}

If you attempt to send an empty body to multiple recipients, the following response will be received:

HTTP Status Code: 400

loading animation
XML|JSON
Can't send an empty body to multiple recipients
{
  "batch": null,
  "errors": [
    {
      "code": "messagebody_empty",
      "description": "Can't send an empty body to multiple recipients"
    }
  ]
}

Send multiple messages

Request

Method: POST
Authentication: Basic / Session
Content-Type: application/xml

https://api.esendex.com/v1.0/messagedispatcher  

Example Request Body

<?xml version='1.0' encoding='UTF-8'?>  
<messages>  
    <accountreference>EX0000000</accountreference>
    <message>
        <to>447700900123</to>
        <body>Every message matters!</body>
    </message>
    <message>
        <to>4477009912345</to>
        <body>This message matters too!</body>
    </message>
</messages>
Successful Response

HTTP Status Code: 200 OK
Content-Type: application/xml

Example Response Body

<?xml version="1.0" encoding="utf-8"?> 
<messageheaders batchid="19aafc9c-b08a-400d-a9f1-afe3c46f0a25" xmlns="http://api.esendex.com/ns/"> 
 <messageheader uri="https://api.esendex.com/v1.0/MessageHeaders/72d91006-eb01-4e69-ae98-0e02c92c8e34" id="72d91006-eb01-4e69-ae98-0e02c92c8e34" /> 
 <messageheader uri="https://api.esendex.com/v1.0/MessageHeaders/0ed72db5-3934-41c6-b7ff-191bc056cee8" id="0ed72db5-3934-41c6-b7ff-191bc056cee8" /> 
</messageheaders>
Error Responses
HTTP Status Code Reason
400 Bad Request Invalid/Malformed request body or more than 50,000 messages in request.
401 Not Authorised No authentication header provided.
402 Payment Required Not enough message credits.
403 Forbidden Failed authentication or not authorised to access feature.
404 Not Found The specified contact or contact group doesn't exist.
406 Not Acceptable Empty message body provided.
415 Unsupported Media Type Content type is not supported or unspecified.

Request Elements

The following elements are available for use within 'messages':

Element Name Description
<accountreference> Required: The Esendex account reference that the messages should be sent from.
<from> The default alphanumeric originator that the message appears to originate from. Can be overridden on a per message basis. This must be either a valid phone number or an alphanumeric value with a maximum length of 11 characters, that may contain letters, numbers and the following special characters: * $ ? ! ” # % & _ - , @ ' +. Special characters may not work for all networks in France.
<type> The default type of all messages to be sent: either SMS or Voice. Can be overridden on a per-message basis.
<lang> Voice only: The default language to use for all Voice messages in this request. Currently supports: en-GB (English UK), en-AU (English-Australian), fr-FR (French), es-ES (Spanish) and de-DE (German).
<retries> Voice only: The default number of times for all messages in this request to attempt to call and deliver a Voice message.
<validity> SMS only: The default validity period in hours for all messages in this request (defaults to 0 which indicates the MAX allowed). The maximum allowed validity period is 72 hours.
<sendat> The scheduled time to send the messages in this request. It cannot be overridden on a per-message basis. The format is yyyy-MM-ddThh:mm:ssZ where y=year, M=month, d=day, T=separator, h=hour, m=min and s=seconds. The value is treated as per ISO 8601 semantics, e.g. without time zone information the value is assumed to be the local time of the server, otherwise as an offset from UTC with Z representing a UTC time.
<characterset> The default character set of the messages to be used when not specified within each message. Valid values are: GSM, Unicode and Auto. When using Auto the most appropriate character set is automatically detected. The default value is GSM. When using auto, if unicode characters are detected, the number of characters available in a message will change from 160 to 70.

The following elements are available for use within 'message':

Element Name Description
<from> The alphanumeric originator for the message to appear to originate from. This will override any value set in the section. This must be either a valid phone number or an alphanumeric value with a maximum length of 11 characters, that may contain letters, numbers and the following special characters: * $ ? ! ” # % & _ - , . @ ' +. Special characters may not work for all networks in France.
<to> Required: The telephone number or numbers to send this message to. Multiple telephone numbers must be comma separated.
<type> The type of the message to be sent: either SMS or Voice. If no type is specified, the default is SMS.
<body> Required: The message content.
<lang> Required for Voice only: The language to use for this Voice message. Currently supports: en-GB (English UK), en-AU (English Australian), fr-FR (French), es-ES (Spanish) and de-DE (German).
<retries> Voice only: The number of times to attempt to call and deliver a Voice message.
<validity> SMS only: The validity period for this message in hours (default to 0 which indicates the MAX allowed). The maximum allowed validity period is 72 hours.
<characterset> The character set of the message to be used. Valid values are: GSM, Unicode and Auto. When using Auto the most appropriate character set is automatically detected. The default value is GSM. When using auto, if unicode characters are detected, the number of characters available in a message will change from 160 to 70.

Message Information

The Message Information resource can be used to obtain information for one or more messages to help understand the costs involved in sending those messages.

Retrieve Message Information

This request will return analysed message information for one or more messages. The character represented by the codepoint &#x1F433; is the spouting whale character. This will be replaced with two spaces for GSM and counted as two character spaces in Unicode messages.

Request

Method: POST
Authentication: Basic / Session
Content-Type: application/xml

https://api.esendex.com/v1.0/messages/information

Example Request Body

<?xml version="1.0" encoding="utf-8"?>
<messages xmlns="http://api.esendex.com/ns/">
 <characterset>Auto</characterset>
 <message elementat="0">
  <body>Every message matters!</body>
 </message>
 <message elementat="1">
  <body>Every message matters!</body>
  <characterset>GSM</characterset>
 </message>
 <message elementat="2">
  <body>Every message matters!</body>
  <characterset>Unicode</characterset>
 </message>
</messages>
Successful Response

HTTP Status Code: 200 OK
Content-Type: application/xml

Example Response Body

<?xml version="1.0" encoding="utf-8"?>
<response xmlns="http://api.esendex.com/ns/">
 <messages>
  <message elementat="0">
   <parts>1</parts>
   <characterset>Unicode</characterset>
   <availablecharactersinlastpart>45</availablecharactersinlastpart>
  </message>
  <message elementat="1">
   <parts>1</parts>
   <characterset>GSM</characterset>
   <availablecharactersinlastpart>135</availablecharactersinlastpart>
  </message>
  <message elementat="2">
   <parts>1</parts>
   <characterset>Unicode</characterset>
   <availablecharactersinlastpart>45</availablecharactersinlastpart>
  </message>
 </messages>
 <errors />
</response>
Error Responses
HTTP Status Code Reason
400 Bad Request Invalid/Malformed request body.
401 Not Authorised No authentication header provided.
403 Forbidden Failed authentication or not authorised to access feature.
413 Request Too Large Too many messages in request.
415 Unsupported Media Type Content type is not supported or unspecified.

Request Elements

The following elements are available for use within 'messages':

Element Name Description
<characterset> The default character set to be used when analysing message information. Valid values are: GSM, Unicode or Auto. When using Auto the character set is detected automatically, and analysis is performed using the detected character set.

The following elements are available for use within 'message':

Element Name Description
<body> Required: The message body to be analysed.
<characterset> The character set to be used when analysing this message. Valid values are: GSM, Unicode or Auto. When using Auto the character set is detected automatically, and analysis is performed using the detected character set. This element is required if characterset is not specified in the messages element.

Response Elements

The following elements will be returned in 'message':

Element Name Description
elementat (attribute) Specifies the index of the request message element which this response element references.
<parts> The calculated number of parts the message will consume, based upon the character set.
<characterset> The character set used when analysing the message.
<availablecharactersinlastpart> The number of characters that are available for use in the last part.

Inbox

The Inbox resource can be used to query messages which have been received by an Esendex account. The most common use of the Inbox resource is to retrieve the inbound messages and delete those messages after they have been processed.

Get All Inbox Messages

Request

Method: GET
Authentication: Basic / Session

https://api.esendex.com/v1.0/inbox/messages  
Successful Response

HTTP Status Code: 200 OK
Content-Type: application/xml

Example Response Body

<?xml version="1.0" encoding="utf-8"?> 
<messageheaders startindex="0" count="15" totalcount="200" xmlns="http://api.esendex.com/ns/"> 
 <messageheader id="50305f2a-06ac-4bfb-8553-b929766e9c2b"> 
  <reference>EX0000000</reference> 
  <status>Submitted</status> 
  <receivedat>2012-01-01T00:00:00</receivedat> 
  <type>SMS</type> 
  <to> 
   <phonenumber>447700900123</phonenumber> 
  </to>
  <from> 
   <phonenumber>447700900654</phonenumber> 
  </from> 
  <summary>Testing REST API</summary> 
  <body id="50305f2a-06ac-4bfb-8553-b929766e9c2b" uri="https://api.esendex.com/v1.0/messageheaders/50305f2a-06ac-4bfb-8553-b929766e9c2b/body"/> 
  <direction>Inbound</direction> 
  <parts>1</parts> 
  <readat>2012-01-01T00:00:10</readat> 
  <readby>[email protected]</readby> 
 </messageheader> 
...(Additional message headers)... 
</messageheaders>
Error Responses
HTTP Status Code Reason
401 Not Authorised No authorisation header provided.
403 Forbidden Failed authentication or not authorised to access feature.

Retrieve Inbox Messages for Date Range

This operation will return a paged response of all inbound messages that were received within the requested date range to any account that the user has permission to view.

Request

Method: GET
Authentication: Basic / Session

https://api.esendex.com/v1.0/inbox/messages?start=2013-03-01T00:00:00Z&finish=2013-03-02T00:00:00Z
Successful Response

HTTP Status Code 200 OK
Content-Type: application/xml

Example Response Body

<?xml version=”1.0 encoding=”utf-8”?> 
<messageheaders startindex="0" count="15" totalcount="200" xmlns="http://api.esendex.com/ns/"> 
 <messageheader id="e2b699bc-a36c-4180-9f8a-99e3eef4acd5"> 
  <reference>EX0000000</reference> 
  <status>Submitted</status> 
  <receivedat>2012-01-01T00:00:00</receivedat> 
  <type>SMS</type> 
  <to> 
   <phonenumber>447700900123</phonenumber> 
  </to>
  <from> 
   <phonenumber>447700900654</phonenumber> 
  </from> 
  <summary>Testing REST API</summary> 
  <body id="e2b699bc-a36c-4180-9f8a-99e3eef4acd5" uri="https://api.esendex.com/v1.0/messageheaders/e2b699bc-a36c-4180-9f8a-99e3eef4acd5/body"/> 
  <direction>Inbound</direction> 
  <parts>1</parts> 
  <readat>2012-01-01T00:00:10</readat> 
  <readby>[email protected]</readby> 
 </messageheader> 
...(Additional message headers)... 
</messageheaders>
Error Responses
HTTP Status Code Reason
400 Bad Request Malformed date, date range is greater than 366 days or finish date is before start date.
401 Not Authorised No authorisation header provided.
403 Forbidden Failed authentication or not authorised to access feature.

Retrieve Inbox Messages for one account

This operation will return a paged response of all inbound messages to one account that the user has permission to view. The account is specified by adding the reference to the URI.

Request

Method: GET
Authentication: Basic / Session

https://api.esendex.com/v1.0/inbox/EX0000000/messages
Successful Response

HTTP Status Code: 200 OK
Content-Type: application/xml

Example Response Body

<?xml version=”1.0 encoding=”utf-8”?> 
<messageheaders startindex="0" count="15" totalcount="200" xmlns="http://api.esendex.com/ns/"> 
 <messageheader id="7581f4d9-ce64-45c9-b1d6-c9c883a75c4f"> 
  <reference>EX0000000</reference> 
  <status>Submitted</status> 
  <receivedat>2012-01-01T00:00:00</receivedat> 
  <type>SMS</type> 
  <to> 
   <phonenumber>447700900123</phonenumber> 
  </to>
  <from> 
   <phonenumber>447700900654</phonenumber> 
  </from> 
  <summary>Testing REST API</summary> 
  <body id="7581f4d9-ce64-45c9-b1d6-c9c883a75c4f" uri="https://api.esendex.com/v1.0/messageheaders/7581f4d9-ce64-45c9-b1d6-c9c883a75c4f/body"/> 
  <direction>Inbound</direction> 
  <parts>1</parts> 
  <readat>2012-01-01T00:00:10</readat> 
  <readby>[email protected]</readby> 
 </messageheader> 
...(Additional message headers)... 
</messageheaders>
Error Responses
HTTP Status Code Reason
401 Not Authorised No authorisation header provided.
403 Forbidden Failed authentication or not authorised to access feature.

Update Read/Unread status for an Inbox Message

This operation will mark an individual inbox message as having been read or unread. The PUT request does not require the message header object to be included in the request body.

Request

Method: PUT
Authentication: Basic / Session

https://api.esendex.com/v1.0/inbox/messages/7a87f50b-94d3-4bfa-83c5-a9168cae7ad7?action=read
https://api.esendex.com/v1.0/inbox/messages/7a87f50b-94d3-4bfa-83c5-a9168cae7ad7?action=unread
Successful Response

HTTP Status Code: 200 OK

Error Responses
HTTP Status Code Reason
400 Bad Request Action is missing or malformed.
401 Not Authorised No authorisation header provided.
403 Forbidden Failed authentication or not authorised to access feature.
404 Not Found The specified message doesn't exist.

Delete Inbox Message

This operation will remove an individual message from an inbox. As the message is identified by its ID there is no additional need to specify which account the message belongs to. This operation cannot be undone!

Request

Method: DELETE
Authentication: Basic / Session

https://api.esendex.com/v1.0/inbox/messages/9fbd10fc-2915-4bdb-863e-2a392b781624
Successful Response

HTTP Status Code: 200 OK

Error Responses
HTTP Status Code Reason
401 Not Authorised No authorisation header provided.
403 Forbidden Failed authentication or not authorised to access feature.
404 Not Found The specified message doesn't exist or is already deleted.

Response Elements

The following elements will be returned in a successful response

Element Name Description
id (attribute) The unique identifier for the message header. Each message header returned will include a non-empty ID value. It will be a stable ID that will not change.
uri (attribute) The URI field represents the path to follow to return the individual message header resource.
<reference> The Esendex account reference that the message was received by.
<status> For inbound messages, this will only be Submitted.
<receivedat> The date/time that the message was received.
<type> For inbound messages, this will only be SMS.
<to> Contains the telephone number that the message was sent to e.g.
<to><phonenumber>44123456789</phonenumber></to>
<from> Contains the telephone number that the message has been sent from. If the telephone number is not in your list of contacts, the telephone number will look like:
<from> <phonenumber>447700900123</phonenumber> </from> If the telephone number can be matched to one of your contacts, a more detailed response will be returned:
<from id="7037ab8b-e5ed-417b-99f6-5dbbecba36c2" uri="https://api.esendex.com/v1.0/contacts/7037ab8b-e5ed-417b-99f6-5dbbecba36c2"> <displayname>Test Contact</displayname> <phonenumber>447700900753</phonenumber> </from>
<summary> The shortened version of the message will only return the first few characters of a message as a preview of the contents held within the message body.
<body> Provides the ID and URL to follow which will return the complete content of the message rather than just the summary.
<direction> For inbound messages, this will only be 'Inbound'.
<parts> The number of SMS parts that make up the message.
<readat> The date when the message was marked as having been read.
<readby> The username that marked the message as read.

Message Batch

The Message Batch resource can be used to query the batches of messages which have been sent from an Esendex account. A common use of the message batch resource is to retrieve a summary of the status codes for the messages in a batch which indicates the delivery progress. Any message batches scheduled to be sent in the future can also be cancelled.

Retrieve Message Batches

This operation will return a paged response of all messages batches for all accounts that the user has permission to view.

Request

Method: GET
Authentication: Basic / Session

https://api.esendex.com/v1.1/messagebatches
Successful Response

HTTP Status Code: 200 OK
Content-Type: application/xml

Example Response Body

<?xml version="1.0" encoding="utf-8"?> 
<messagebatches startindex="0" count="15" totalcount="15" xmlns="http://api.esendex.com/ns/"> 
 <messagebatch id="c2a48c53-280e-4ae8-933c-4484710b7f3b" uri="https://api.esendex.com/v1.1/messagebatches/c2a48c53-280e-4ae8-933c-4484710b7f3b"> 
  <createdat>2012-01-01T12:00:00.000Z</createdat> 
  <batchsize>1</batchsize> 
  <persistedbatchsize>1</persistedbatchsize> 
  <status> 
   <acknowledged>0</acknowledged> 
   <authorisationfailed>0</authorisationfailed> 
   <connecting>0</connecting> 
   <delivered>0</delivered> 
   <failed>0</failed> 
   <partiallydelivered>0</partiallydelivered> 
   <rejected>0</rejected> 
   <scheduled>0</scheduled> 
   <sent>0</sent> 
   <submitted>1</submitted> 
   <validityperiodexpired>0</validityperiodexpired> 
   <cancelled>0</cancelled> 
  </status> 
  <accountreference>EX0000000</accountreference> 
  <createdby>[email protected]</createdby> 
  <name/> 
 </messagebatch> 
…(Additional message batches)… 
</messagebatches>
Error Responses
HTTP Status Code Reason
401 Not Authorised No authorisation header provided.
403 Forbidden Failed authentication or not authorised to access feature.
Retrieve Message Batches for One Account

This operation will return a paged response of all message batches for one account.

Request

Method: GET
Authentication: Basic / Session

https://api.esendex.com/v1.1/messagebatches?filterBy=account&filterValue=EX000000
Successful Response

HTTP Status Code: 200 OK
Content-Type: application/xml

Example Response Body

<?xml version="1.0" encoding="utf-8"?> 
<messagebatches startindex="0" count="15" totalcount="15" xmlns="http://api.esendex.com/ns/"> 
 <messagebatch id="f38dde63-5240-4134-9b35-81f665d3eddd" uri="https://api.esendex.com/v1.1/messagebatches/f38dde63-5240-4134-9b35-81f665d3eddd"> 
  <createdat>2012-01-01T12:00:00.000Z</createdat> 
  <batchsize>1</batchsize> 
  <persistedbatchsize>1</persistedbatchsize> 
  <status> 
   <acknowledged>0</acknowledged> 
   <authorisationfailed>0</authorisationfailed> 
   <connecting>0</connecting> 
   <delivered>0</delivered> 
   <failed>0</failed> 
   <partiallydelivered>0</partiallydelivered> 
   <rejected>0</rejected> 
   <scheduled>0</scheduled> 
   <sent>0</sent> 
   <submitted>1</submitted> 
   <validityperiodexpired>0</validityperiodexpired> 
   <cancelled>0</cancelled> 
  </status> 
  <accountreference>EX0000000</accountreference> 
  <createdby>[email protected]</createdby> 
  <name/> 
 </messagebatch> 
…(Additional message batches)… 
</messagebatches>
Error Responses
HTTP Status Code Reason
401 Not Authorised No authorisation header provided.
403 Forbidden Failed authentication or not authorised to access feature.
Retrieve a Single Message Batch

This operation will return a single message batch response identified by its ID.

Request

Method: GET
Authentication: Basic / Session

https://api.esendex.com/v1.1/messagebatches/10d13dc0-c464-4c8f-b4b6-cac40c21fc4d
Successsful Response

HTTP Status Code: 200 OK
Content-Type: application/xml

Example Response Body

<?xml version="1.0" encoding="utf-8"?>
<messagebatch xmlns="http://api.esendex.com/ns/" id="10d13dc0-c464-4c8f-b4b6-cac40c21fc4d" uri="https://api.esendex.com/v1.1/messagebatches/10d13dc0-c464-4c8f-b4b6-cac40c21fc4d">
 <createdat>2012-01-01T12:00:00.000Z</createdat> 
 <batchsize>1</batchsize> 
 <persistedbatchsize>1</persistedbatchsize> 
 <status> 
  <acknowledged>0</acknowledged> 
  <authorisationfailed>0</authorisationfailed> 
  <connecting>0</connecting> 
  <delivered>0</delivered> 
  <failed>0</failed> 
  <partiallydelivered>0</partiallydelivered> 
  <rejected>0</rejected> 
  <scheduled>0</scheduled> 
  <sent>0</sent> 
  <submitted>1</submitted> 
  <validityperiodexpired>0</validityperiodexpired> 
  <cancelled>0</cancelled> 
 </status> 
 <accountreference>EX0000000</accountreference> 
 <createdby>[email protected]</createdby> 
 <name/> 
 <link rel="cancel" href="https://api.esendex.com/v1.1/messagebatches/10d13dc0-c464-4c8f-b4b6-cac40c21fc4d/schedule" /> 
</messagebatch>
Cancelling a Scheduled Batch

This operation will cancel a message batch that has been scheduled to be sent in the future. This operation cannot be undone!

Request

Method: DELETE
Authentication: Basic / Session

https://api.esendex.com/v1.1/messagebatches/6f06e45b-745c-4606-81aa-7744894e7565/schedule
Successful Response

HTTP Status Code: 204 No Content

Error Responses
HTTP Status Code Reason
401 Not Authorised No authorisation header provided.
403 Forbidden Failed authentication or not authorised to access feature.
404 Not Found The specified message batch doesn't exist.
410 Gone The time limit for cancellation has been reached. Cancellations cannot be applied if the scheduled batch will be sent within the next 5 minutes.
Naming a Message Batch

This operation will name a message batch and supports ETag concurrency checking.

Request

Method: PUT
Authentication: Basic / Session
Content-Type: application/xml

https://api.esendex.com/v1.1/messagebatches/c8866696-64f7-4335-87e6-b4a3ca8cd527

Optional HTTP Headers:
If-Match: "{ETag}"
If-None-Match: "{ETag}"
Example Request Body

<?xml version='1.0' encoding='utf-8'?>
 <messagebatch xmlns="http://api.esendex.com/ns/">
  <name>My Batch Name</name>
 </messagebatch>
Successful Response

HTTP Status Code: 204 No Content

Error Responses
HTTP Status Code Reason
400 Bad Request The specified name is invalid.
401 Not Authorised No authorisation header provided.
403 Forbidden Failed authentication or not authorised to access feature.
404 Not Found The specified message batch doesn't exist.
412 Precondition Failed. The concurrency check has failed. (See below)

Concurrency checking using ETag

When retrieving a single message batch, the HTTP Header contains an ETag value representing the current concurrency value. The ETag value is randomly generated each time an update is made and is not simply the Batch Id. If you make a PUT request to update the Batch name, you can choose whether to check if the message batch has been updated since you retrieved it.

Overwrite
  • If you do not add an If-Match: "{ETag}" or If-None-Match: "{ETag}" HTTP header to the PUT request then the Batch name in the request will overwrite any current value.
Overwrite if Match
  • If you add an If-Match: "{ETag}" HTTP header to the PUT request then the Batch name will be updated if the ETag value matches the current concurrency value of the stored Batch. A 412 Precondition Failed will be returned if
    • the ETag value doesn't match the Batch's current concurrency value
    • an asterisk is used instead of an ETag value. This behaviour is not supported.
Overwrite if None Match
  • If you add an If-None-Match: "{ETag}" HTTP header to the PUT request then the Batch name will be updated if the ETag value does not match the current concurrency value of the stored Batch. A 412 Precondition Failed will be returned if
    • the ETag value matches a Batch's current concurrency value
    • an asterisk is used instead of an ETag value. This behaviour is not supported.

Response Elements

The following elements will be returned in a successful response:

Element name Description
<createdat> The date/time the batch was created.
<batchsize> The number of messages that were submitted in the batch.
<status> This details the counts for the statuses of the messages in the batch. These statuses can be:
Acknowledged
Voice message has been acknowledged by the recipient.
Authorisation Failed
Premium message could not be authorised to this recipient.
Connecting
Voice message is currently being delivered to the recipient.
Delivered
Message has been delivered to the recipient.
Failed
Message could not be delivered.
Partially Delivered
Voice message has been partially delivered to the recipient.
Rejected
Voice message has been rejected by the recipient.
Scheduled
Message has been scheduled for future delivery.
Sent
Message has been passed on to the mobile networks.
Submitted
Message is being processed by Esendex.
Validity Period Expired
Message could not be delivered within the validity period.
Cancelled
Indicates when a scheduled message batch is cancelled.
<accountreference> The Esendex account reference that the messages have been sent from.
<createdby> The username that submitted the message batch.
<name> The optional name set on an individual message batch.
<link rel="cancel"> If present, this indicates that this is a scheduled message batch and it can be cancelled. See cancelling scheduled batch for more information.

Message Header

The Message Header resource can be used to query messages which have been sent from an Esendex account. It also allows individual messages to be queried for more details.

Retrieve Sent Messages

This request will return a paged response of all the sent messages from accounts that the user has permission to view.

Request

Method: GET
Authentication: Basic / Session

https://api.esendex.com/v1.0/messageheaders
Successful Response

HTTP Status Code: 200 OK
Content-Type: application/xml

Example Response Body

<?xml version="1.0" encoding="utf-8"?> 
<messageheaders startindex="0" count="15" totalcount="200" xmlns="http://api.esendex.com/ns/"> 
 <messageheader id="1ca25e65-f224-4460-bc88-9e455b83b4a3" uri="https://api.esendex.com/v1.0/messageheaders/1ca25e65-f224-4460-bc88-9e455b83b4a3/">
  <reference>EX0000000</reference> 
  <status>Delivered</status> 
  <laststatusat>2012-01-01T12:00:05.000</laststatusat> 
  <submittedat>2012-01-01T12:00:02.000</submittedat> 
  <type>SMS</type> 
  <to> 
    <phonenumber>447700900123</phonenumber> 
  </to>
  <from> 
   <phonenumber>447700900654</phonenumber> 
  </from> 
  <summary>Testing REST API</summary> 
  <body uri="https://api.esendex.com/v1.0/messageheaders/1ca25e65-f224-4460-bc88-9e455b83b4a3/body"/> 
  <direction>Outbound</direction> 
  <parts>1</parts> 
  <username>[email protected]</username> 
  <batch id="e84ccbdc-732f-1485-0b03-0aa56519e001" uri="https://api.esendex.com/v1.0/messagebatches/e84ccbdc-732f-1485-0b03-0aa56519e001" /> 
 </messageheader> 
...(Additional message headers)...
</messageheaders>
Error Responses
HTTP Status Code Reason
401 Not Authorised No authorisation header provided.
403 Forbidden Failed authentication or not authorised to access feature.

Retrieve a Single Message

This request will return a message header response for a single message. This request will support queries for both inbound and outbound messages.

Request

Method: GET
Authentication: Basic / Session

https://api.esendex.com/v1.0/messageheaders/d0d5d7a7-ac69-4860-84cc-d34aeebe5d74
Successful Response

HTTP Status Code: 200 OK
Content-Type: application/xml

Example Response Body

<?xml version="1.0" encoding="utf-8"?>  
<messageheader id="d0d5d7a7-ac69-4860-84cc-d34aeebe5d74" uri="https://api.esendex.com/v1.0/messageheaders/d0d5d7a7-ac69-4860-84cc-d34aeebe5d74/" xmlns="http://api.esendex.com/ns/">  
 <status>Delivered</status> 
 <laststatusat>2010-01-01T12:00:05.000</laststatusat> 
 <submittedat>2010-01-01T12:00:02.000</submittedat> 
 <type>SMS</type> 
 <to> 
  <phonenumber>447700900123</phonenumber> 
 </to>
 <from> 
  <phonenumber>447700900654</phonenumber> 
 </from> 
 <summary>Testing REST API</summary> 
 <body uri="https://api.esendex.com/v1.0/messageheaders/d0d5d7a7-ac69-4860-84cc-d34aeebe5d74/body"/> 
 <direction>Outbound</direction> 
 <parts>1</parts> 
 <username>[email protected]</username> 
 <batch id="e84ccbdc-732f-1485-0b03-0aa56519e001" uri="https://api.esendex.com/v1.0/messagebatches/e84ccbdc-732f-1485-0b03-0aa56519e001" /> 
</messageheader>
Error Responses
HTTP Status Code Reason
400 Bad Request The specified ID is not a valid GUID.
401 Not Authorised No authorisation header provided.
403 Forbidden Failed authentication or not authorised to access feature.
404 Not Found The specified message header doesn't exist.

Retrieve Messages Sent to a Recipient

This request will return a paged response of all messages sent to a recipient.

Request

Method: GET
Authentication: Basic / Session

https://api.esendex.com/v1.0/messageheaders?to=447700900123
Successful Response

HTTP Status Code: 200 OK
Content-Type: application/xml

Example Response Body

<?xml version="1.0" encoding="utf-8"?> 
<messageheaders startindex="0" count="15" totalcount="200" xmlns="http://api.esendex.com/ns/"> 
 <messageheader id="84963df6-6cbf-45b9-9fd5-d1b03c330010" uri="https://api.esendex.com/v1.0/messageheaders/84963df6-6cbf-45b9-9fd5-d1b03c330010/">
  <reference>EX0000000</reference> 
  <status>Delivered</status> 
  <laststatusat>2012-01-01T12:00:05.000</laststatusat> 
  <submittedat>2012-01-01T12:00:02.000</submittedat> 
  <type>SMS</type> 
  <to> 
    <phonenumber>447700900123</phonenumber> 
  </to>
  <from> 
   <phonenumber>447700900654</phonenumber> 
  </from> 
  <summary>Testing REST API</summary> 
  <body uri="https://api.esendex.com/v1.0/messageheaders/84963df6-6cbf-45b9-9fd5-d1b03c330010/body"/> 
  <direction>Outbound</direction> 
  <parts>1</parts> 
  <username>[email protected]</username> 
  <batch id="e84ccbdc-732f-1485-0b03-0aa56519e001" uri="https://api.esendex.com/v1.0/messagebatches/e84ccbdc-732f-1485-0b03-0aa56519e001" /> 
 </messageheader> 
...(Additional message headers)...
</messageheaders>
Error Responses
HTTP Status Code Reason
401 Not Authorised No authorisation header provided.
403 Forbidden Failed authentication or not authorised to access feature.

Retrieve Messages for a Date Range

This request will return a paged response of all messages sent within a specified date range.

Request

Method: GET
Authentication: Basic / Session

https://api.esendex.com/v1.0/messageheaders?start=2013-03-01T00:00:00Z&finish=2013-03-02T00:00:00Z
Successful Response

HTTP Status Code: 200 OK
Content-Type: application/xml

Example Response Body

<?xml version="1.0" encoding="utf-8"?> 
<messageheaders startindex="0" count="15" totalcount="200" xmlns="http://api.esendex.com/ns/"> 
 <messageheader id="84963df6-6cbf-45b9-9fd5-d1b03c330010" uri="https://api.esendex.com/v1.0/messageheaders/84963df6-6cbf-45b9-9fd5-d1b03c330010/">
  <reference>EX0000000</reference> 
  <status>Delivered</status> 
  <laststatusat>2013-03-01T12:00:05.000</laststatusat> 
  <submittedat>2013-03-01T12:00:02.000</submittedat> 
  <type>SMS</type> 
  <to> 
    <phonenumber>447700900123</phonenumber> 
  </to>
  <from> 
   <phonenumber>447700900654</phonenumber> 
  </from> 
  <summary>Testing REST API</summary> 
  <body uri="https://api.esendex.com/v1.0/messageheaders/84963df6-6cbf-45b9-9fd5-d1b03c330010/body"/> 
  <direction>Outbound</direction> 
  <parts>1</parts> 
  <username>[email protected]</username> 
  <batch id="e84ccbdc-732f-1485-0b03-0aa56519e001" uri="https://api.esendex.com/v1.0/messagebatches/e84ccbdc-732f-1485-0b03-0aa56519e001" /> 
 </messageheader> 
...(Additional message headers)...
</messageheaders>
Error Responses
HTTP Status Code Reason
401 Not Authorised No authorisation header provided.
403 Forbidden Failed authentication or not authorised to access feature.
Retrieve Messages Sent From an Originator

This request will return a paged response of all messages sent from an originator.

Request

Method: GET
Authentication: Basic / Session

https://api.esendex.com/v1.0/messageheaders?from=44123456789
Successful Response

HTTP Status Code: 200 OK
Content-Type: application/xml

Example Response Body

<?xml version="1.0" encoding="utf-8"?> 
<messageheaders startindex="0" count="15" totalcount="200" xmlns="http://api.esendex.com/ns/"> 
 <messageheader id="65d8da07-9314-4807-b1bc-06a02c455fbc" uri="https://api.esendex.com/v1.0/messageheaders/65d8da07-9314-4807-b1bc-06a02c455fbc/">
  <reference>EX0000000</reference> 
  <status>Delivered</status> 
  <laststatusat>2012-01-01T12:00:05.000</laststatusat> 
  <submittedat>2012-01-01T12:00:02.000</submittedat> 
  <type>SMS</type> 
  <to> 
    <phonenumber>447700900123</phonenumber> 
  </to>
  <from> 
   <phonenumber>44123456789</phonenumber> 
  </from> 
  <summary>Testing REST API</summary> 
  <body uri="https://api.esendex.com/v1.0/messageheaders/65d8da07-9314-4807-b1bc-06a02c455fbc/body"/> 
  <direction>Outbound</direction> 
  <parts>1</parts> 
  <username>[email protected]</username> 
  <batch id="e84ccbdc-732f-1485-0b03-0aa56519e001" uri="https://api.esendex.com/v1.0/messagebatches/e84ccbdc-732f-1485-0b03-0aa56519e001" /> 
 </messageheader> 
...(Additional message headers)...
</messageheaders>
Error Responses
HTTP Status Code Reason
401 Not Authorised No authorisation header provided.
403 Forbidden Failed authentication or not authorised to access feature.

Retrieve Sent Messages by Status

This request will return a paged response of all messages sent by status.

Request

Method: GET
Authentication: Basic / Session

https://api.esendex.com/v1.0/messageheaders?status=Delivered

Status Filters

Acknowledged
Authorised
Connecting
Delivered
Dispatched
Expired
Failed
FailedAuthorisation
PartiallyDelivered
Processing
Queued
Rejected
Scheduled
Sent
Submitted
Successful Response

HTTP Status Code: 200 OK

Error Responses
HTTP Status Code Reason
400 Bad Request The specified status is invalid.
401 Not Authorised No authorisation header provided.
403 Forbidden Failed authentication or not authorised to access feature.
Retrieving Failed Sent Messages

This request will return a paged response of all messages the user has permission to view. If a message has failed an additional element FailureReason will be present.

Request

Method: GET
Authentication: Basic / Session

https://api.esendex.com/v1.0/messageheaders
Successful Response

HTTP Status Code: 200 OK
Content-Type: application/xml

Example Response Body

<?xml version="1.0" encoding="utf-8"?> 
<messageheaders startindex="0" count="15" totalcount="200" xmlns="http://api.esendex.com/ns/"> 
 <messageheader id="e4031138-9ad8-492b-9b09-d646e99e49ed" uri="https://api.esendex.com/v1.0/messageheaders/e4031138-9ad8-492b-9b09-d646e99e49ed/">
  <reference>EX0000000</reference> 
  <status>Failed</status> 
  <laststatusat>2012-01-01T12:00:05.000</laststatusat> 
  <submittedat>2012-01-01T12:00:02.000</submittedat> 
  <type>SMS</type> 
  <to> 
    <phonenumber>447700900123</phonenumber> 
  </to>
  <from> 
   <phonenumber>44123456789</phonenumber> 
  </from> 
  <summary>Testing REST API</summary> 
  <body uri="https://api.esendex.com/v1.0/messageheaders/e4031138-9ad8-492b-9b09-d646e99e49ed/body"/> 
  <direction>Outbound</direction> 
  <parts>1</parts> 
  <username>[email protected]</username>
  <FailureReason>
   <Code>200</Code>
   <Detail>Temporary recipient issue (absent/error)</Detail>
   <PermanentFailure>false</PermanentFailure>
  </FailureReason>
  <batch id="e84ccbdc-732f-1485-0b03-0aa56519e001" uri="https://api.esendex.com/v1.0/messagebatches/e84ccbdc-732f-1485-0b03-0aa56519e001" /> 
 </messageheader> 
...(Additional message headers)...
</messageheaders>

Failure Reasons
The following failure reasons could be returned for a failed message:

Code Error Description Permanent Failure
7 No route available We were unable to find a network to handle the destination of this message. False
12 No recipient specified There is no recipient specified to whom we can send this message. True
4 No valid subscription In order to send this message to this recipient, the recipient needs to have subscribed and no such subscription exists. True
13 Network submission error We received a message from the network when trying to send it to them and we were unable to retry or send it through another network False
999 Other network issue An unspecified error has occurred when the network was processing the message False
101 Recipient invalid The recipient of this message was not valid True
16 Recipient blacklisted The recipient has a blockage in place which prevents receipt of this message True
102 Handset incompatible The recipient's handset cannot support receipt of this message True
199 Temporary issue An unknown temporary issue has occurred after submitting this message to the network False
200 Temporary recipient issue (absent/error) The recipient is temporarily unable to receive this message False
6 Insufficient credit You do not have enough credit to send this message False
8 Daily message limit You have exceeded the maximum number of messages you can send per day through your account False
17 Message content issue The network is blocking delivery of this message due to its content False
0 No failure reason available The failure reason is unavailable to us False

Retrieve Message Headers for a Single Message Batch

This request will return a paged response of all messages for one message batch. Method: GET
Authentication: Basic / Session

https://api.esendex.com/v1.0/messagebatches/b94d3d15-ce48-4d73-8b30-38c5498b1dc4/messages
Successful Response

HTTP Status Code: 200 OK
Content-Type: application/xml

Example Response Body

<?xml version="1.0" encoding="utf-8"?> 
<messageheaders startindex="0" count="15" totalcount="200" xmlns="http://api.esendex.com/ns/"> 
 <messageheader id="d1ccc728-18a2-46cd-ba27-800eb251dd5d"> 
  <reference>EX0000000</reference> 
  <status>Delivered</status> 
  <receivedat>2010-01-01T00:00:00</receivedat> 
  <type>SMS</type> 
  <to> 
    <phonenumber>44987654321</phonenumber> 
  </to>
  <from> 
   <phonenumber>44123456789</phonenumber> 
  </from> 
  <summary>Testing REST API</summary> 
  <body uri="https://api.esendex.com/v1.0/messageheaders/d1ccc728-18a2-46cd-ba27-800eb251dd5d/body"/> 
  <direction>Outbound</direction> 
  <parts>1</parts> 
  <username>[email protected]</username> 
 </messageheader> 
 ...(Additional message headers)... 
</messageheaders>
Error Responses
HTTP Status Code Reason
401 Not Authorised No authorisation header provided.
403 Forbidden Failed authentication or not authorised to access feature.
404 Not Found The specified message batch doesn't exist.
Response Elements

The following elements can be used in 'messageheader':

Element name Description
id (attribute) The unique identifier for the message header. Each message header returned will include a non-empty ID value. It is a stable GUID that does not change.
uri (attribute) The URI field represents the path to follow to return the individual message header resource.
<reference> The Esendex account that the message was sent or received by.
<status> The status code refers to the current state of the message. The possible values are:
Submitted
Message is being processed by Esendex.
Sent
Message has been passed on to the mobile networks.
Delivered
Message has been delivered to the recipient.
Expired
Message could not be delivered within the validity period.
Failed
Message could not be delivered.
Failed Authorisation
Premium message could not be authorised to this recipient.
Acknowledged
Voice message has been acknowledged by the recipient.
Connecting
Voice message is currently being delivered to the recipient.
<laststatusat> The most recent date/time the status of this message was updated.
<submittedat> The date that the message was submitted to Esendex.
<type> The type of message can be SMS or Voice.
<from> Contains the telephone number that the message has been sent to. If the telephone number is not in your list of contacts, the telephone number will look like:
<from> <phonenumber>447700900123</phonenumber> </from>
If the telephone number can be matched to one of your contacts, a more detailed response will be returned:
<from id="06970C0B-FBC6-40B1-BA45-B193377821D5" uri="https://api.esendex.com/v1.0/Contacts/06970C0B-FBC6-40B1-BA45-B193377821D5"> <displayname>Test Contact</displayname> <phonenumber>447700900753</phonenumber> </from>.
<to> Contains the telephone number or alphanumeric alias that the message was sent from e.g.
<to> <phonenumber>447700900123</phonenumber></to>.
<summary> The summary will only return the first few characters of a message.
<body> Provides the ID and URL to follow which will return the complete content of the message.
<direction> This will always be outbound for the message headers collection.
<parts> The number of SMS parts that make up the message.
<username> The username that sent the messages.

Conversation

The Conversation resource can be used to retrieve the most recent 15 messages for a specified telephone number that has been sent to and received from. This includes messages for all Esendex accounts the user is authorised to view.

View Conversation

This operation will return a response of all the messages sent to and received from accounts that the user has permission to view.

Request

Method: GET
Authentication: Basic / Session

https://api.esendex.com/v1.0/conversation/447700900123/messages
Successful Response

HTTP Status Code: 200 OK
Content-Type: application/xml

Example Response Body

<?xml version="1.0" encoding="utf-8"?> 
<messageheaders xmlns="http://api.esendex.com/ns/"> 
 <messageheader id="1a694cbb-3245-4c8d-8f2f-da5c1565b949" uri="https://api.esendex.com/v1.0/messageheaders/1a694cbb-3245-4c8d-8f2f-da5c1565b949/">
  <reference>EX0000000</reference> 
  <status>Delivered</status> 
  <laststatusat>2012-01-01T12:00:05.000</laststatusat> 
  <submittedat>2012-01-01T12:00:02.000</submittedat> 
  <type>SMS</type> 
  <to> 
    <phonenumber>447700900123</phonenumber> 
  </to>
  <from> 
   <phonenumber>447700900654</phonenumber> 
  </from> 
  <summary>Testing REST API</summary> 
  <body uri="https://api.esendex.com/v1.0/messageheaders/1a694cbb-3245-4c8d-8f2f-da5c1565b949/body"/> 
  <direction>Outbound</direction> 
  <parts>1</parts> 
  <username>[email protected]</username> 
 </messageheader> 
...[Up to 14 additional message headers]...
</messageheaders>

View Conversation for Date Range

This operation will return a response of all the messages sent to and received from accounts within the specified time that the user has permission to view.

Request

Method: GET
Authentication: Basic / Session

https://api.esendex.com/v1.0/conversation/447700900123/messages?start=2015-03-01T00:00:00Z&finish=2015-04-01T00:00:00Z
Successful Response

HTTP Status Code: 200 OK
Content-Type: application/xml

Example Response Body

<?xml version="1.0" encoding="utf-8"?> 
<messageheaders xmlns="http://api.esendex.com/ns/"> 
 <messageheader id="1a694cbb-3245-4c8d-8f2f-da5c1565b949" uri="https://api.esendex.com/v1.0/messageheaders/1a694cbb-3245-4c8d-8f2f-da5c1565b949/">
  <reference>EX0000000</reference> 
  <status>Delivered</status> 
  <laststatusat>2012-01-01T12:00:05.000</laststatusat> 
  <submittedat>2012-01-01T12:00:02.000</submittedat> 
  <type>SMS</type> 
  <to> 
    <phonenumber>447700900123</phonenumber> 
  </to>
  <from> 
   <phonenumber>447700900654</phonenumber> 
  </from> 
  <summary>Testing REST API</summary> 
  <body uri="https://api.esendex.com/v1.0/messageheaders/1a694cbb-3245-4c8d-8f2f-da5c1565b949/body"/> 
  <direction>Outbound</direction> 
  <parts>1</parts> 
  <username>[email protected]</username> 
 </messageheader> 
...[Up to 14 additional message headers]...
</messageheaders>
Error Responses
HTTP Status Code Reason
401 Not Authorised No authorisation header provided.
403 Forbidden Failed authentication or not authorised to access feature.
404 Not Found No messages for specified recipient.

Response Elements

The following elements will be returned in 'messageheader':

Element name Description
id (attribute) The unique identifier for the message header. Each message header returned will include a non-empty ID value. It is a stable GUID that does not change.
uri (attribute) The URI field represents the path to follow to return the individual message header resource.
<reference> The Esendex account that the message was sent or received by.
<status> The status code refers to the current state of the message. The possible values are:
Submitted
Message is being processed by Esendex.
Sent
Message has been passed on to the mobile networks.
Delivered
Message has been delivered to the recipient.
Expired
Message could not be delivered within the validity period.
Failed
Message could not be delivered.
Failed Authorisation
Premium message could not be authorised to this recipient.
Acknowledged
Voice message has been acknowledged by the recipient.
Connecting
Voice message is currently being delivered to the recipient.
<laststatusat> The most recent date/time the status of this message was updated.
<submittedat> The date that the message was submitted to Esendex.
<type> The type of message can be SMS or Voice.
<to> Contains the telephone number or alphanumeric alias that the message was sent from e.g.
<to> <phonenumber>447700900123</phonenumber></to>.
<summary> The summary will only return the first few characters of a message.
<body> Provides the ID and URL to follow which will return the complete content of the message.
<direction> This will always be outbound for the message headers collection.
<parts> The number of SMS parts that make up the message.
<username> The username that sent the messages.

Accounts

The Accounts resource can be used to retrieve or update details on the Esendex account or accounts that the user has access to.

Retrieve Accounts

This operation will return a response containing summary information on all of the Esendex accounts that the user has permissions to use.

Request

Method: GET
Authentication: Basic / Session

https://api.esendex.com/v1.0/accounts
Successful Response

HTTP Status Code: 200 OK
Content-Type: application/xml

Example Response Body

<?xml version="1.0" encoding="utf-8"?> 
<accounts xmlns="http://api.esendex.com/ns/"> 
 <account id="b5c17927-74ba-466e-a80b-7435cc688f5d" uri="https://api.esendex.com/v1.0/accounts/b5c17927-74ba-466e-a80b-7435cc688f5d"> 
  <reference>EX0000000</reference> 
  <label>EX0000000</label> 
  <address>447700900654</address> 
  <type>Professional</type> 
  <messagesremaining>2000</messagesremaining> 
  <expireson>2999-02-25T00:00:00</expireson> 
  <role>PowerUser</role> 
  <settings uri="https://api.esendex.com/v1.0/accounts/b5c17927-74ba-466e-a80b-7435cc688f5d/settings" /> 
 </account> 
</accounts>
Error Responses
HTTP Status Code Reason
401 Not Authorised No authorisation header provided.
403 Forbidden Failed authentication or not authorised to access feature.

Create Account

This operation will create an account, optionally with a label, and then return the created account.

Request

Method: POST
Authentication: Basic / Session

https://api.esendex.com/v1.0/accounts
loading animation
JSON|XML
Content-Type: application/json

{
    "customerid": "a94f6b03-b557-49bb-9739-658e08f9dc91",
    "label": "Marketing"
}
Content-Type: application/xml

<?xml version="1.0" encoding="UTF-8" ?>
<account xmlns="http://api.esendex.com/ns/">
  <customerid>a94f6b03-b557-49bb-9739-658e08f9dc91</customerid>
  <label>Marketing</label>
</account>
Successful Response

HTTP Status Code: 200 OK
Content-Type: application/json

Example Response Body

loading animation
JSON|XML
Content-Type: application/json

{
    "account": {
        "-id": "b5c17927-74ba-466e-a80b-7435cc688f5d",
        "-uri": "https://api.esendex.com/v1.0/accounts/b5c17927-74ba-466e-a80b-7435cc688f5d",
        "reference": "EX0000000",
        "label": "Marketing",
        "type": "Professional",
        "messagesremaining": "0",
        "expireson": "2999-02-25T00:00:00",
        "role": "PowerUser",
        "settings": { "-uri": "https://api.esendex.com/v1.0/accounts/3d3f1fc4-10e2-4c62-8477-01349cc4757a/settings" }
    }
}

Content-Type: application/xml

<?xml version="1.0" encoding="UTF-8" ?>
 <account id="b5c17927-74ba-466e-a80b-7435cc688f5d" uri="https://api.esendex.com/v1.0/accounts/b5c17927-74ba-466e-a80b-7435cc688f5d"> 
  <reference>EX0000000</reference> 
  <label>Marketing</label> 
  <type>Professional</type> 
  <messagesremaining>0</messagesremaining> 
  <expireson>2999-02-25T00:00:00</expireson> 
  <role>PowerUser</role> 
  <settings uri="https://api.esendex.com/v1.0/accounts/b5c17927-74ba-466e-a80b-7435cc688f5d/settings" /> 
 </account> 
Error Responses
HTTP Status Code Reason
400 Bad Request Too many accounts or malformed POST body
401 Not Authorised No authorisation header provided.
403 Forbidden Failed authentication or not authorised to access feature.

Retrieve Account

This option will return an account response for an individual Esendex account that the user has permission to use.

Request

Method: GET
Authentication: Basic / Session

https://api.esendex.com/v1.0/accounts/3d3f1fc4-10e2-4c62-8477-01349cc4757a
Successful Response

HTTP Status Code: 200 OK
Content-Type: application/xml

Example Response Body

<?xml version="1.0" encoding="utf-8"?> 
<account id="3d3f1fc4-10e2-4c62-8477-01349cc4757a" uri="https://api.esendex.com/v1.0/accounts/3d3f1fc4-10e2-4c62-8477-01349cc4757a" xmlns="http://api.esendex.com/ns/"> 
 <reference>EX0000000</reference> 
 <label>EX0000000</label> 
 <address>447700900654</address> 
 <type>Professional</type> 
 <messagesremaining>2000</messagesremaining> 
 <expireson>2999-02-25T00:00:00</expireson> 
 <role>PowerUser</role> 
 <settings uri="https://api.esendex.com/v1.0/accounts/3d3f1fc4-10e2-4c62-8477-01349cc4757a/settings" /> 
</account>
Error Responses
HTTP Status Code Reason
401 Not Authorised No authorisation header provided.
403 Forbidden Failed authentication or not authorised to access feature.
404 Not Found Account doesn't exist.

Update Account Details

This operation allows changes to be made to one or more account settings. Currently, the only field that can be updated is the account Label.

Request

Method: PUT
Authentication: Basic / Session
Content-Type: application/xml

https://api.esendex.com/v1.0/accounts/258ae156-6c7e-4cae-b642-2b38a4f78b59

Example Request Body

<?xml version="1.0" encoding="utf-8"?> 
<account xmlns="http://api.esendex.com/ns/"> 
  <label>My Label</label>
</account>
Successful Response

HTTP Status Code: 200 OK

Error Responses
HTTP Status Code Reason
400 Bad Request Invalid/Malformed request body.
401 Not Authorised No authorisation header provided.
403 Forbidden Failed authentication or not authorised to access feature.
404 Not Found Account doesn't exist.
415 Unsupported Media Type Content type is not supported or unspecified.

Response Elements

The following elements will be returned within 'account':

Element Name Description
id (attribute) The unique identifier for the account. Each account returned will include a non-empty Id value. It is a stable GUID that does not change.
uri (attribute) The URI field represents the path to follow to return an individual account object.
<reference> The short name to identify an account.
<address> The telephone number which is used to send and receive messages.
<alias> The alias MAY be set to change the default telephone number which outbound messages appear to come from. By default it will mirror the address value. If changed, the new alias must be either a valid phone number or an alphanumeric value with a maximum length of 11 characters, that may contain letters, numbers and the following special characters: * $ ? ! ” # % & _ - , . @ ' +.
<label> A text label for the account. This will appear in Esendex applications and can be used to give the account a human friendly name. Can be from 0 to 50 characters long.
<type> The type of Esendex account. Values include: Professional, Trial and Broadcast.
<messagesremaining> The number of SMS credits remaining to be used on an individual account.
<expireson> The date that the account will cease to be live.
<role> A string representation of the security permission assigned to the User making the request for the account.

Account Settings

The Account Settings resource can be used to retrieve and update settings for an Esendex account that the user has access to.

Retrieve Account Settings

This operation returns an account settings response detailing the current state of certain settings on an Esendex account.

Request

Method: GET
Authentication: Basic / Session

https://api.esendex.com/v1.0/accounts/182847d7-d572-4a02-aa5e-bbfdc582b669/settings
Successful Response

HTTP Status Code: 200 OK
Content-Type: application/xml

Example Response Body

<?xml version="1.0" encoding="utf-8"?> 
<accountsettings xmlns="http://api.esendex.com/ns/">
<concurrencyid>ems:00000000-0000-0000-0000-000000000000, options:9df5070b-b941-4165-a22a-1f13375a8bd1</concurrencyid> <outbound> 
  <defaultaliasenabled>true</defaultaliasenabled> 
  <defaultalias>MyAlias</defaultalias> 
  <defaultvalidity>24</defaultvalidity> 
 </outbound> 
 <autoresponse> 
  <enabled>false</enabled> 
  <message>this is my auto response</message> 
  <type>SMS</type> 
 </autoresponse> 
 <emailforwarding> 
  <enabled>false</enabled> 
  <emailaddress /> 
  <omitfooter>false</omitfooter> 
  <hideoriginator>false</hideoriginator> 
 </emailforwarding> 
 <emailnotification> 
  <deliveryenabled>false</deliveryenabled> 
  <failedenabled>false</failedenabled> 
 </emailnotification> 
 <emailgeneral> 
  <directreplyenabled>false</directreplyenabled> 
  <directreplyincludeoriginalmessage>false</directreplyincludeoriginalmessage> 
  <signaturemarker/> 
 </emailgeneral> 
</accountsettings>
Error Responses
HTTP Status Code Reason
401 Not Authorised No authorisation header provided.
403 Forbidden Failed authentication or not authorised to access feature.
404 Not Found Account doesn't exist.
Update Account Settings

This operation allows updates to be performed on one or more account settings. The Concurrency ID element is required, and can be obtained by making a GET request to the account settings resource.

Request

Method: PUT
Authentication: Basic / Session
Content-Type: application/xml

https://api.esendex.com/v1.0/accounts/cfba8241-d467-477c-afbb-d54dfa797cb7/settings

Example Request Body

<?xml version="1.0" encoding="utf-8"?> 
<accountsettings xmlns="http://api.esendex.com/ns/">
 <concurrencyid>ems:00000000-0000-0000-0000-000000000000, options:eddb6ef8-97ce-47f8-93a3-e4849ff3f52a</concurrencyid> 
 <outbound> 
  <defaultaliasenabled>true</defaultaliasenabled> 
  <defaultalias>MyAlias</defaultalias> 
  <defaultvalidity>24</defaultvalidity> 
 </outbound> 
 <autoresponse> 
  <enabled>false</enabled> 
  <message>this is my auto response</message> 
  <type>SMS</type> 
 </autoresponse> 
</accountsettings>
Successful Response

HTTP Status Code: 200 OK

Error Responses
HTTP Status Code Reason
400 Bad Request Invalid/Malformed request body.
401 Not Authorised No authorisation header provided.
403 Forbidden Failed authentication or not authorised to access feature.
409 Conflict Invalid concurrency ID.
415 Unsupported Media Type Content type is not supported or unspecified.

Response Elements

The following elements will be returned in 'accountsettings':

Element Name
Description
<concurrencyid>
A unique identifying string to prevent update conflicts, which will have a new value when the account settings have changed.
<outbound>
This XML element contains an account’s default outbound values. The number of elements within it will vary depending on the type of account, e.g. `Professional`, `Broadcast`, `Evaluation` etc.
<defaultaliasenabled>
This optional element indicates whether a default alias (used as the `From` value when sending) will be used, if set (see below). It can be set to either `true` or `false`.
This setting is only applicable to `Professional`, `Broadcast` and `Trial` accounts.
<defaultalias>
This optional element indicates the default alias value that will be used as the `From` value when sending `SMS` messages.
This must be either a valid phone number or an alphanumeric value with a maximum length of 11 characters, that may contain letters, numbers and the following special characters: `* $ ? ! ” # % & _ - , . @ ' +`.
This setting is only applicable to `Professional`, `Broadcast` and `Trial` accounts.
<defaultvalidity>
This optional element indicates the number of hours that networks will attempt to retry `SMS` messages for in the event that a message cannot be delivered immediately.
A value of 0 indicates the system default (usually 72 hours).
<autoresponse>
This XML element allows the `User` to set a predefined message content and type which will be sent out each time an inbound message reaches the account.
<enabled>
Indicates if the auto response settings are currently active.
<message>
The message text which will be sent out if auto response is enabled.
<type>
The type of message to be sent: `SMS` or `Voice`.
<emailforwarding>
<enabled>
Indicates if the email forwarding settings are currently active.
<emailaddress>
The email address that any incoming messages are forwarded to.
<omitfooter>
Indicates if the Esendex email footer should be left off any forwarded emails.
<hideoriginator>
Indicates if the telephone number of the incoming message should be hidden from email recipients.
<emailnotification>
<deliveryenabled>
Indicates if an email should be sent to the email forwarding email address when an outbound message has been delivered.
<failedenabled>
Indicates if an email should be sent to the email forwarding email address when an outbound message has failed.
<failedenabled>
Indicates if an email should be sent to the email forwarding email address when an outbound message has failed.
<emailgeneral>
<directreplyenabled>
Indicates if an email reply to a forwarded email message should be sent to the telephone number of the inbound message.
<directreplyincludeoriginalmessage>
Indicates if the original inbound message content should be included in the direct reply.
<signaturemarker>
Email forwarding will remove any text after a match with this value to allow email signatures to not be included in any message.

Opt-Outs

The Opt-Outs endpoint allows you to query the recipients who have opted to not receive messages from you. Requests can return as either JSON or XML.

Retrieve All Opt-Outs

Method: GET
Authentication: Basic / Session

https://api.esendex.com/v1.0/optouts

Optional Parameters

Parameter Description
accountreference=EX0000000 Show Opt-Outs for the given account reference.
from=447000000000 Show Opt-Outs for the given phone number.

Response

HTTP Status Code: 200 OK
Example Response Body

loading animation
JSON|XML
Content-Type: application/json

{
  "startindex": 0,
  "count": 2,
  "totalcount": 6,
  "optouts": [{
    "id": "95814a7d-1c25-4cf5-a848-d016348319bb",
    "accountreference": "EX0000000",
    "receivedat": "2015-11-09T15:18:19.033Z",
    "from": {"phonenumber": "447728693893"},
    "links": {"self": "https://api.esendex.com/v1.0/optouts/95814a7d-1c25-4cf5-a848-d016348319bb"}
  },{
    "id": "34cf245f-d05f-44b0-a806-0dcb3a731d9f",
    "accountreference": "EX0000000",
    "receivedat": "2015-11-10T15:00:19.033Z",
    "from": {"phonenumber": "447213654888"},
    "links": {"self": "https://api.esendex.com/v1.0/optouts/34cf245f-d05f-44b0-a806-0dcb3a731d9f"}
  }],
  "links": {"self": "https://api.esendex.com/v1.0/optouts?accountReference=EX0000000&startIndex=0&count=2"}
}
Content-Type: application/xml

<?xml version="1.0" encoding="utf-8"?>
<optouts startindex="0" count="2" totalcount="6" xmlns="http://api.esendex.com/ns/">
  <optout id="43ccbc8f-2fe4-4833-9918-db361b7e41a5">
    <accountreference>EX0000000</accountreference>
    <receivedat>2015-11-09T15:18:19.033Z</receivedat>
    <from>
      <phonenumber>447728693893</phonenumber>
    </from>
    <link rel="self" href="https://api.esendex.com/v1.0/optouts/43ccbc8f-2fe4-4833-9918-db361b7e41a5" />
  </optout>
  <optout id="15500e2e-0239-48fe-8016-f12e6512a217">
    <accountreference>EX0000000</accountreference>
    <receivedat>2015-11-10T15:00:19.033Z</receivedat>
    <from>
      <phonenumber>447213654888</phonenumber>
    </from>
    <link rel="self" href="https://api.esendex.com/v1.0/optouts/15500e2e-0239-48fe-8016-f12e6512a217" />
  </optout>
  <link rel="self" href="https://api.esendex.com/v1.0/optouts?accountReference=EX0000000&startIndex=0&count=2" />
</optouts>
Error Responses
HTTP Status Code Reason
401 Not Authorised No authorisation header provided.
403 Forbidden Failed authentication or not authorised to access feature.

Retrieve a Single Opt-Out

Retrieves an opt-out specified by ID.

Request

Method: GET
Authentication: Basic / Session

https://api.esendex.com/v1.0/optouts/436332c6-8755-41bf-abde-cc48eafacba0
Response

HTTP Status Code: 200 OK

Example Response Body

loading animation
JSON|XML
Content-Type: application/json

{
  "id": "436332c6-8755-41bf-abde-cc48eafacba0",
  "accountreference": "EX0000000",
  "receivedat": "2015-11-09T15:18:19.033Z",
  "from": {"phonenumber": "447728693893"},
  "links": {"self": "https://api.esendex.com/v1.0/optouts/436332c6-8755-41bf-abde-cc48eafacba0"}
}
Content-Type: application/xml

<?xml version="1.0" encoding="utf-8"?>
<optout id="436332c6-8755-41bf-abde-cc48eafacba0" xmlns="http://api.esendex.com/ns/">
  <accountreference>EX0000000</accountreference>
  <receivedat>2015-11-09T15:18:19.033Z</receivedat>
  <from>
    <phonenumber>447728693893</phonenumber>
  </from>
  <link rel="self" href="https://api.esendex.com/v1.0/optouts/436332c6-8755-41bf-abde-cc48eafacba0" />
</optout>
Error Responses
HTTP Status Code Reason
401 Not Authorised No authorisation header provided.
403 Forbidden Failed authentication or not authorised to access feature.
404 Not Found Account doesn't exist.

Response Elements

The following elements will be returned within 'optout':

Element name Description
id *(attribute)* The unique identifier for the opt-out. Each opt-out returned will include an ID which does not change.
<accountreference> The account reference of the account which contains this opt-out.
<receivedat> The datetime that the opt-out was received.
<from> Contains the address that has opted out.
<phonenumber> The phone number that has opted out of sends.

Add Opt-Out

The Add Opt-Out resource allows you to specify an address you do not wish to send to. Requests can be made in either JSON or XML.

Request

Method: POST
Authentication: Basic / Session

https://api.esendex.com/v1.0/optouts

Example Request Body

loading animation
JSON|XML
Content-Type: application/json

{
  "accountreference": "EX0000000",
  "from": 
  {
    "phonenumber": "447000000123"
  }
}
Content-Type: application/xml

<?xml version="1.0" encoding="utf-8"?>
<optout xmlns="http://api.esendex.com/ns/">
  <accountreference>EX0000000</accountreference>
  <from>
    <phonenumber>447000000123</phonenumber>
  </from>
</optout>
Successful Response
loading animation
JSON|XML
Content-Type: application/json

{
  "id": "c3cc18f9-001b-4f0b-a77c-222d231e44c3",
  "accountreference": "EX0000000",
  "receivedat": "2016-01-01T00:00:00.0000000Z",
  "from": 
  {
    "phonenumber": "447000000123"
  },
  "links": 
  {
    "self": "https://api.esendex.com/v1.0/optouts/c3cc18f9-001b-4f0b-a77c-222d231e44c3"
  }
}
Content-Type: application/xml

<?xml version="1.0" encoding="utf-8"?>
<response xmlns="http://api.esendex.com/ns/">
  <optout id="65854194-df68-423d-aa0a-8a2dcaea1532"/>
    <accountreference>EX0000000</accountreference>
    <receivedat>2016-01-01T00:00:00.0000000Z</receivedat>
    <from>
      <phonenumber>447000000123</phonenumber>
    </from>
    <link rel="self" href="https://api.esendex.com/v1.0/optouts/65854194-df68-423d-aa0a-8a2dcaea1532" />
  </optout>
</response>

Error Responses

If a request contains an invalid or non-international format phone number, the following response will be received:

loading animation
JSON|XML
Content-Type: application/json

{
  "optout":null,
  "errors": [
    {
      "code":"phonenumber_invalid",
      "description":"Phone number must be valid and in international format"
    }
  ]
}
Content-Type: application/xml

<?xml version="1.0" encoding="utf-8"?>
<response xmlns="http://api.esendex.com/ns/">
  <errors>
    <error>
      <code>phonenumber_invalid</code>
      <description>Phone number must be valid and in international format</description>
    </error>
  </errors>
</response>

If a request does not have a phone number, the following response will be received:

loading animation
JSON|XML
Content-Type: application/json

{
  "optout":null,
  "errors": [
    {
      "code": "phonenumber_missing",
      "description": "Phone number is missing"
    }
  ]
}
Content-Type: application/xml

<response xmlns="http://api.esendex.com/ns/">
  <errors>
    <error>
      <code>phonenumber_missing</code>
      <description>Phone number is missing</description>
    </error>
  </errors>
</response>

If the account reference is missing, the following response will be received:

loading animation
JSON|XML
Content-Type: application/json

{
  "optout":null,
  "errors": [
    {
      "code": "accountreference_missing",
      "description": "Account reference is missing"
    }
  ]
}
Content-Type: application/xml

<response xmlns="http://api.esendex.com/ns/">
  <errors>
    <error>
      <code>accountreference_missing</code>
      <description>Account reference is missing</description>
    </error>
  </errors>
</response>
HTTP Status Code Reason
400 Bad Request Invalid/Malformed request body.
401 Not Authorised No authorisation header provided.
403 Forbidden Failed authentication or not authorised to access feature.
409 Confict Opt-Out already exists.
415 Unsupported Media Type Content type is not supported or unspecified.

SOAP API

Esendex provides a SOAP API to enable developers to integrate SMS functionality into their applications. All services are accessible using HTTPS.

There are two versions of the SOAP API:

  • The primary interface makes use of SOAP Headers to carry authentication information (account, username and API password).
  • Alternatively, the SOAP API - No Headers service incorporates the authentication information in the arguments to each method call.

Sending

Service Description
SendService Methods to send SMS messages individually and in Batches URI, WSDL
ScheduledSendService Submits a message to Esendex that is scheduled to be sent at a later date/time URI, WSDL

Notes

The service aliasing feature within the SendMessageFull and SendMessageMultipleRecipientsFull methods of SendService is not available with Evaluation or Premium accounts. When using these methods, you must set the Originator parameter to your account reference or you will receive an error when attempting to send a message.

Receiving

Service Description
InboxService Manage incoming messages queued in the account inbox URI, WSDL

Notes

Please see Push Notifications for receiving messages

Other

Service Description
AccountService Account management functionality URI, WSDL
SubscriptionService Subscription management functionality URI, WSDL
ContactService Contact management URI, WSDL

Errors

If an error occurs when you are submitting a request to a web service you will receive a SOAP error that describes what the problem was. This information is in the Detail section of the XML, and consists of two nodes ErrorCode and ErrorMessage.

Error Codes

Code Description Reason
0 Unknown Send the full exception details to Esendex for more info.
1 Unexpected Send the full exception details to Esendex for more info.
2 Authentication Failed The username/password is invalid, or you are not permitted to access the account you specified.
3 Missing Header The SOAP XML you posted was missing the SOAP Header when one was expected.
4 Recipient Missing There was no recipient to send the message to.
5 Account Not Live Your account has not started, or has expired.
6 Method Not Enabled The method you called is not enabled.
7 Feature Not Supported You tried to put a service alias on an message that doesn't support it.
8 Message Not Found A message with the ID you specified could not be found.
9 Recipient Invalid The recipient you entered was not a valid mobile number.
10 Message Limit Exceeded You do not have enough credits to send the messages submitted.
11 Message ID Format Invalid The ID you specified is not a valid GUID.
12 Username Already Exists Reserved.
13 Contact Already Exists You attempted to add a Contact with a name that already exists.
14 Contact Group Already Exists You attempted to add a Contact Group with a name that already exists.
15 Contact Or Group Already Exists You attempted to add a Contact Group and/or Contact with a name that already exists.
16 Not Authorised You are not authorised to carry out the request submitted.
17 Validation Error The contact or group you tried to create contains a field with invalid details. You will receive information on the field in error.
18 No Active Subscription You attempted to send a premium rate message to a recipient who doesn't have an active subscription (someone who has not texted in, or has stopped their subscription).
19 Invalid SubmitAt Error You attempted to submit a scheduled message at an invalid date/time. You cannot schedule a message more than two years in the future.
20 Subscription Not Found A subscription for the mobile number does not exist for this account.
21 Invalid ESM / DCS value The ESM and/or DCS values specified are invalid. Please see the SMPP specification for allowed values.
22 Unverified recipient During your free trial, you can only send messages to the number you verified when you signed up.
23 Cannot schedule with Zero PID Scheduling services are unavailable due to your account having a zero PID (personally identifiable data) policy.

SOAP API - No Headers

In some development/runtime environments support for SOAP headers is either complex to implement (e.g. MS SOAP Toolkit) or not provided for (e.g. ColdFusion). Some environments also do not have support for enumerated types.

Due to these limitations, we provide this alternative service implementation that does not require SOAP Headers or use enumerated types.

The SOAP API - No Headers API provides functionality through the following services:

Sending

Service Description
SendServiceNoHeader Methods to send SMS messages individually and in Batches URI, WSDL
ScheduledSendServiceNoHeader Submits a message to Esendex that is scheduled to be sent at a later date/time URI, WSDL

Notes

The service aliasing feature within the SendMessageFull and SendMessageMultipleRecipientsFull methods of SendService is not available with Evaluation or Premium accounts. When using these methods, you must set the Originator parameter to your account reference or you will receive an error when attempting to send a message.

Receiving

Service Description
InboxServiceNoHeader Manage Incoming messages queued in the account inbox URI, WSDL

Notes

Please see Push Notifications for receiving messages

Other

Service Description
AccountServiceNoHeader Account management functionality URI, WSDL
SubscriptionServiceNoHeader Subscription management functionality URI, WSDL
ContactServiceNoHeader Contact management URI, WSDL

Errors

If an error occurs when you are submitting a request to a web service you will receive a SOAP error that describes what the problem was. This information is in the Detail section of the XML, and consists of two nodes ErrorCode and ErrorMessage.

Error Codes

Code Description Reason
0 Unknown Send the full exception details to Esendex for more info.
1 Unexpected Send the full exception details to Esendex for more info.
2 Authentication Failed The username/password is invalid, or you are not permitted to access the account you specified.
3 Missing Header The SOAP XML you posted was missing the SOAP Header when one was expected.
4 Recipient Missing There was no recipient to send the message to.
5 Account Not Live Your account has not started, or has expired.
6 Method Not Enabled The method you called is not enabled.
7 Feature Not Supported You tried to put a service alias on an message that doesn't support it.
8 Message Not Found A message with the ID you specified could not be found.
9 Recipient Invalid The recipient you entered was not a valid mobile number.
10 Message Limit Exceeded You do not have enough credits to send the messages submitted.
11 Message ID Format Invalid The ID you specified is not a valid GUID.
12 Username Already Exists Reserved.
13 Contact Already Exists You attempted to add a Contact with a name that already exists.
14 Contact Group Already Exists You attempted to add a Contact Group with a name that already exists.
15 Contact Or Group Already Exists You attempted to add a Contact Group and/or Contact with a name that already exists.
16 Not Authorised You are not authorised to carry out the request submitted.
17 Validation Error The contact or group you tried to create contains a field with invalid details. You will receive information on the field in error.
18 No Active Subscription You attempted to send a premium rate message to a recipient who doesn't have an active subscription (someone who has not texted in, or has stopped their subscription).
19 Invalid SubmitAt Error You attempted to submit a scheduled message at an invalid date/time. You cannot schedule a message more than two years in the future.
20 Subscription Not Found A subscription for the mobile number does not exist for this account.
21 Invalid ESM / DCS value The ESM and/or DCS values specified are invalid. Please see the SMPP specification for allowed values.
22 Unverified recipient During your free trial, you can only send messages to the number you verified when you signed up.
23 Cannot schedule with Zero PID Scheduling services are unavailable due to your account having a zero PID (personally identifiable data) policy.

API Access

In order to allow you to manage what your users can do on their account, access to the API is restricted to users with Admin and Standard roles on an account (in most cases this shouldn't be an issue as Admin is the default role of new users).

To manage the roles of users on an account, once you've signed up:

  • Log in to Echo
  • Go to Settings -> User Management

FormPost API

Esendex provides a FormPost API to enable developers to integrate SMS functionality into their applications. All services are accessible using HTTPS.

The FormPost API provides functionality through the following services:

Sending

Service Description
SendSMS SMS message sending functionality URI
SendWapPushSMS Send a WAP Push SMS to a handset URI
ScheduledSendSMS Submits a message to Esendex that is scheduled to be sent at a later date/time URI
QueryStatus Find out the status of sent messages URI

Notes

The service aliasing feature within the SendSMS service is not available with Evaluation or Premium accounts. When using these methods, you must set the Originator parameter to your account reference or you will receive an error when attempting to send a message.

Configuring your software to send SMS by accessing a URL

If you are trying to send messages via software that only allows a URL to be specified please try the following replacing the xxx’s as required.

https://www.esendex.com/secure/messenger/formpost/[email protected]&account=ex000xxxx&password=xxx&recipient=xxx&body=xxx&plaintext=1

Please be aware that each time you access this URL an attempt to send a message will be made which will debit your Esendex account. This feature is provided to help you to integrate with software that cannot use an API in any other way.

Receiving

Service Description
GetInboxMessage Retrieve Inbox Messages URI
DeleteInboxMessage Delete Inbox Messages URI
GetLatestInboxMessages Retrieves the messages that were received after a specified message Id URI
Notes

Please see Push Notifications for receiving messages

Subscription Management

Service Description
StopSubscription Stops a subscription for a telephone number to a premum service URI

API Access

In order to allow you to manage what your users can do on their account, access to the API is restricted to users with Admin and Standard roles on an account (in most cases this shouldn't be an issue as Admin is the default role of new users).

To manage the roles of users on an account, once you've signed up:

  • Log in to Echo
    • Go to Settings -> User Management

Admin API

Get Credits

Esendex's Admin API supports the ability to get a list of your current credit balance.

It will return all of your accounts and a list of the available credits and their expiry dates.

Request

Method: GET
Authentication: Basic / Session
Content-Type: application/json

https://admin.api.esendex.com/v1.0/credits

Query Parameters

Element Name Description
expiresafter Optional Returns credits expiring after this date.
expiresbefore Optional Returns credits expiring before this date.
allocatedto Optional Returns credits available to this account reference. Use 'shared' to return credits available to all accounts.

Example with query parameters

https://admin.api.esendex.com/v1.0/credits?expiresAfter=2018-01-01&expiresBefore=2020-12-31&allocatedTo=EX0000001
Successful Response

HTTP Status Code: 200 OK
Content-Type: application/json

{
    "PrepayCredits": [
        {
            "AllocatedTo": "EX000001",
            "Total": 50,
            "Expirations": [
                {
                    "Quantity": 20,
                    "ExpiresAt": "2019-12-31T00:00:00Z"
                },
                {
                    "Quantity": 30,
                    "ExpiresAt": "2020-12-31T00:00:00Z"
                }
            ]
        },
        {
            "AllocatedTo": "EX0000002",
            "Total": 0,
            "Expirations": []
        },
        {
            "AllocatedTo": "Shared",
            "Total": 1000,
            "Expirations": [
                {
                    "Quantity": 1000,
                    "ExpiresAt": "2018-10-14T00:00:00Z"
                }
            ]
        }
    ],
    "Total": 1050
}
Error Responses
HTTP Status Code Reason
403 Forbidden Failed authentication or not authorised to access feature.

Move Credits

This endpoint allows you to move credits between accounts.

Request

Method: POST
Authentication: Basic / Session
Content-Type: application/json

https://admin.api.esendex.com/v1.0/credits/move

Example Request Body

{
  "from":"EX0087809",
  "to":"EX0087810",
  "quantity":"1",
  "expiresafter":"2017-04-20",
  "expiresbefore":"2020-04-20",   
  "orderby" : "expiry_asc"
}

Request Parameters:

Element Name Description
from Required The reference of the account to move messages from.
to Required The reference of the account to move messages to.
quantity Required The amount of credits to move.
expiresafter Optional A filter to only move credits that expire after the supplied date.
expiresbefore Optional A filter to only move credits that expire before the supplied date.
orderby Optional The order in which expiring credits will be moved. There are two options for this:
expiry_asc (default)
Credits expiring soonest will be moved first.
expiry_desc
Credits expiring latest will be moved first.

Successful Response

HTTP Status Code: 200 OK

Error Responses
HTTP Status Code Reason
400 Bad Request Malformed POST body.
403 Forbidden Failed authentication or not authorised to access feature.
Sample Error Response

HTTP Status Code: 400

Content-Type: application/json

{
  "errors": [
    {
      "code": "invalid_expiresbefore",
      "description": "ExpiresBefore is invalid, please check the value provided"
    }
  ]
}

Voice Messaging

Sending

Esendex's REST API supports the ability to send voice messages. This option is specified in the request body when using the Message Dispatcher endpoint.

Message Dispatcher

The Message Dispatcher endpoint can be used to send a Voice message by setting the Type of the message to Voice.

Request

Method: POST
Authentication: Basic / Session
Content-Type: application/xml

https://api.esendex.com/v1.0/messagedispatcher

Example Request Body

<?xml version='1.0' encoding='UTF-8'?>  
<messages>  
 <accountreference>EX0000000</accountreference> 
 <message>  
  <to>0123456789</to>  
  <type>Voice</type>  
  <body>This is a Voice message</body>  
  <lang>en-GB</lang>  
  <retries>3</retries>  
 </message> 
</messages>
Successful Response

HTTP Status Code: 200 OK
Content-Type: application/xml

<?xml version="1.0" encoding="utf-8"?> 
<messageheaders batchid="84261d6d-762e-4382-b5fe-de6c2975758d" xmlns="http://api.esendex.com/ns/"> 
 <messageheader uri="https://api.esendex.com/v1.0/MessageHeaders/8c341523-b34b-415d-af93-8bfe41430bd2" id="8c341523-b34b-415d-af93-8bfe41430bd2" /> 
</messageheaders>
Error Responses
HTTP Status Code Reason
400 Bad Request Invalid/Malformed request body.
401 Not Authorised No authentication header provided.
402 Payment Required Not enough message credits.
403 Forbidden Failed authentication or not authorised to access feature.
404 Not Found The specified contact group doesn't exist.
406 Not Acceptable Empty message body provided.
415 Unsupported Media Type Content type is not supported or unspecified.

Contacts API

Contacts

The Contacts resource allows the management of named contacts and telephone numbers. Contacts are associated with an account and must be unique by both quick name and phone number. The quick name must also not conflict with any contact groups associated with the same account.

Retrieve All Contacts

Retrieves a paged response of contacts within the specified account.

Request

Method: GET
Authentication: Basic / Session

https://api.esendex.com/v2.0/contacts?accountreference=EX0000000
Successful Response

HTTP Status Code: 200 OK
Content-Type: application/xml

Example Response Body

<?xml version="1.0" encoding="utf-8"?>
<contacts startindex="0" count="1" totalcount="1118790" xmlns="http://api.esendex.com/ns/">
  <contact id="5f552b6a-d162-477b-b10e-0046d44c132b">
    <firstname>John</firstname>
    <lastname>Smith</lastname>
    <quickname>John's Work Phone</quickname>
    <phonenumber>447000000000</phonenumber>
    <accountreference>EX0000000</accountreference>
    <link rel="self" href="https://api.esendex.com/v2.0/contacts/5f552b6a-d162-477b-b10e-0046d44c132b" />
    <link rel="account" href="https://api.esendex.com/v1.0/accounts/f6462f9d-87a2-4cac-97a6-5a2d9cb81997" />
  </contact>
  <link rel="self" href="https://api.esendex.com/v2.0/contacts?accountReference=EX0000000&amp;startIndex=0" />
</contacts>
Error Responses
HTTP Status Code Reason
401 Not Authorised No authentication header provided.
403 Forbidden Failed authentication or not authorised to access feature.

Retrieve a Single Contact

Retrieves a contact identified by ID.

Request

Method: GET
Authentication: Basic / Session

https://api.esendex.com/v2.0/contacts/5f552b6a-d162-477b-b10e-0046d44c132b
Successful Response

HTTP Status Code: 200 OK
Content-Type: application/xml

Example Response Body

<?xml version="1.0" encoding="utf-8"?>
<contact id="5f552b6a-d162-477b-b10e-0046d44c132b" xmlns="http://api.esendex.com/ns/">
  <firstname>John</firstname>
  <lastname>Smith</lastname>
  <quickname>John's Work Phone</quickname>
  <phonenumber>447000000000</phonenumber>
  <accountreference>EX0000000</accountreference>
  <link rel="self" href="https://api.esendex.com/v2.0/contacts/5f552b6a-d162-477b-b10e-0046d44c132b" />
  <link rel="account" href="https://api.esendex.com/v1.0/accounts/f6462f9d-87a2-4cac-97a6-5a2d9cb81997" />
</contact>
Error Responses
HTTP Status Code Reason
401 Not Authorised No authentication header provided.
403 Forbidden Failed authentication or not authorised to access feature.
404 Not Found Contact doesn't exist.
410 Gone Contact previously deleted.

Create a Contact

Creates a new contact and returns the created contact in the response.

Request

Method: POST
Authentication: Basic / Session
Content-Type: application/xml

https://api.esendex.com/v2.0/contacts

Example Request Body

<?xml version="1.0" encoding="utf-8"?>
<contact xmlns="http://api.esendex.com/ns/">
  <firstname>John</firstname>
  <lastname>Smith</lastname>
  <quickname>John's Home Phone</quickname>
  <phonenumber>447000000001</phonenumber>
  <accountreference>EX0000000</accountreference>
</contact>
Successful Response

HTTP Status Code: 201 Created
Content-Type: application/xml

Example Response Body

<?xml version="1.0" encoding="utf-8"?>
<response xmlns="http://api.esendex.com/ns/">
  <contact id="5f552b6a-d162-477b-b10e-0046d44c132b">
    <firstname>John</firstname>
    <lastname>Smith</lastname>
    <quickname>John's Home Phone</quickname>
    <phonenumber>447000000001</phonenumber>
    <accountreference>EX0000000</accountreference>
    <link rel="self" href="https://api.esendex.com/v2.0/contacts/5f552b6a-d162-477b-b10e-0046d44c132b" />
    <link rel="account" href="https://api.esendex.com/v1.0/accounts/f6462f9d-87a2-4cac-97a6-5a2d9cb81997" />
  </contact>
</response>
Error Responses
HTTP Status Code Reason
400 Bad Request Invalid/Malformed request body.
401 Not Authorised No authorisation header provided.
403 Forbidden Failed authentication or not authorised to access feature.
409 Confict Contact already exists.
415 Unsupported Media Type Content type is not supported or unspecified.

Update a Contact

Amends an existing contact.

Request

Method: PUT
Authentication: Basic / Session
Content-Type: application/xml

https://api.esendex.com/v2.0/contacts/5f552b6a-d162-477b-b10e-0046d44c132b

Example Request Body

<?xml version="1.0" encoding="utf-8"?>
<contact xmlns="http://api.esendex.com/ns/">
  <firstname>John</firstname>
  <lastname>Smith</lastname>
  <quickname>John's Second Phone</quickname>
  <phonenumber>447000000001</phonenumber>
</contact>
Successful Response

HTTP Status Code: 200 OK
Content-Type: application/xml

Example Response Body

<?xml version="1.0" encoding="utf-8"?>
<contact id="5f552b6a-d162-477b-b10e-0046d44c132b" xmlns="http://api.esendex.com/ns/">
  <firstname>John</firstname>
  <lastname>Smith</lastname>
  <quickname>John's Second Phone</quickname>
  <phonenumber>447000000001</phonenumber>
  <accountreference>EX0000000</accountreference>
  <link rel="self" href="https://api.esendex.com/v2.0/contacts/5f552b6a-d162-477b-b10e-0046d44c132b" />
  <link rel="account" href="https://api.esendex.com/v1.0/accounts/f6462f9d-87a2-4cac-97a6-5a2d9cb81997" />
</contact>
Error Responses
HTTP Status Code Reason
400 Bad Request Invalid/Malformed request body.
401 Not Authorised No authentication header provided.
403 Forbidden Failed authentication or not authorised to access feature.
404 Not Found The specified contact group doesn't exist.
409 Confict Contact quickname/mobile number already exists or the quickname conflicts with a contact group name.
410 Gone Contact previously deleted.
412 Precondition Failed Invalid concurrency ID.
415 Unsupported Media Type Content type is not supported or unspecified.

Delete a Contact

Deletes an existing contact. This operation cannot be undone!

Request

Method: DELETE
Authentication: Basic / Session

https://api.esendex.com/v2.0/contacts/5f552b6a-d162-477b-b10e-0046d44c132b
Successful Response

HTTP Status Code: 204 No Content

Error Responses
HTTP Status Code Reason
400 Bad Request Invalid/Malformed request body.
401 Not Authorised No authentication header provided.
403 Forbidden Failed authentication or not authorised to access feature.
415 Unsupported Media Type Content type is not supported or unspecified.

Request Elements

The following elements are available for use within 'contact':

Element Name Description
<firstname> The first name of this contact. Limited to 50 characters.
<lastname> The last name of this contact. Limited to 50 characters.
<quickname> Required: The quick name of this contact. This must be unique per account, and must not be the same as a contact group name. Limited to 50 characters.
<phonenumber> Required: The phone number for this contact. This must be international E.164 format excluding the '+' sign and without any white space, e.g. 447900000000.
<accountreference> Required: The account reference of the account which will contain the contact.

Response Elements

The following elements will be returned within 'contact':

Element Name Description
id (attribute) The unique identifier for the contact. Each contact returned will include an ID which does not change.
<firstname> The first name of this contact.
<lastname> The last name of this contact.
<quickname> The quick name of this contact.
<phonenumber> The phone number of this contact.
<accountreference> The account reference of the account which contains this contact group.
<link> Each link element defines the location of related resources such as the account or contact. The self link always links back to the resource being represented. The rel attribute describes which resource the link relates to, and the href attribute contains the location of the resource.

Contact Groups

The Contact Groups resource allows the management of named groups which can be used to collect together one or more contacts. Contact Groups are associated with an account and must be unique by name. The name must also not conflict with any contact quick names associated with the same account.

Retrieve All Contact Groups

Retrieves a paged response of contact groups within the specified account.

Request

Method: GET
Authentication: Basic / Session

https://api.esendex.com/v2.0/contactgroups/?accountreference=EX0000000
Successful Response

HTTP Status Code: 200 OK
Content-Type: application/xml

Example Response Body

<?xml version="1.0" encoding="utf-8"?>
<contactgroups startindex="0" count="1" totalcount="14" xmlns="http://api.esendex.com/ns/">
  <contactgroup id="d49f774b-c1bd-48d3-a718-8ee3d926ec25" contactcount="2">
    <accountreference>EX0000000</accountreference>
    <name>Friends</name>
    <link rel="self" href="https://api.esendex.com/v2.0/contactgroups/d49f774b-c1bd-48d3-a718-8ee3d926ec25" />
    <link rel="contacts" href="https://api.esendex.com/v2.0/contactgroups/d49f774b-c1bd-48d3-a718-8ee3d926ec25/contacts" />
    <link rel="account" href="https://api.esendex.com/v1.0/accounts/f6462f9d-87a2-4cac-97a6-5a2d9cb81997" />
  </contactgroup>
  <link rel="self" href="https://api.esendex.com/v2.0/contactgroups?accountReference=EX0000000&amp;startIndex=0" />
</contactgroups>
Error Responses
HTTP Status Code Reason
401 Not Authorised No authentication header provided.
403 Forbidden Failed authentication or not authorised to access feature.

Retrieve a Single Contact Group

Retrieves a contact group identified by ID.

Request

Method: GET
Authentication: Basic / Session

https://api.esendex.com/v2.0/contactgroups/d49f774b-c1bd-48d3-a718-8ee3d926ec25
Successful Response

HTTP Status Code: 200 OK
Content-Type: application/xml

Example Response Body

<?xml version="1.0" encoding="utf-8"?>
<contactgroup id="d49f774b-c1bd-48d3-a718-8ee3d926ec25" contactcount="2" xmlns="http://api.esendex.com/ns/">
  <accountreference>EX0000000</accountreference>
  <name>Friends</name>
  <link rel="self" href="https://api.esendex.com/v2.0/contactgroups/d49f774b-c1bd-48d3-a718-8ee3d926ec25" />
  <link rel="contacts" href="https://api.esendex.com/v2.0/contactgroups/d49f774b-c1bd-48d3-a718-8ee3d926ec25/contacts" />
  <link rel="account" href="https://api.esendex.com/v1.0/accounts/f6462f9d-87a2-4cac-97a6-5a2d9cb81997" />
</contactgroup>
Error Responses
HTTP Status Code Reason
401 Not Authorised No authentication header provided.
403 Forbidden Failed authentication or not authorised to access feature.
404 Not Found The specified contact group doesn't exist.
410 Gone Contact group previously deleted.

Create a Contact Group

Creates a new contact group and returns the created contact group in the response.

Request

Method: POST
Authentication: Basic / Session
Content-Type: application/xml

https://api.esendex.com/v2.0/contactgroups

Example Request Body

<?xml version="1.0" encoding="utf-8"?>
<contactgroup xmlns="http://api.esendex.com/ns/">
  <name>Relatives</name>
  <accountreference>EX0000000</accountreference>
</contactgroup>
Successful Response

HTTP Status Code: 201 Created
Content-Type: application/xml

Example Response Body

<?xml version="1.0" encoding="utf-8"?>
<contactgroup id="1ee544e3-8255-442b-b5fb-900d1ccce906" contactcount="0" xmlns="http://api.esendex.com/ns/">
  <accountreference>EX0000000</accountreference>
  <name>Relatives</name>
  <link rel="self" href="https://api.esendex.com/v2.0/contactgroups/1ee544e3-8255-442b-b5fb-900d1ccce906" />
  <link rel="contacts" href="https://api.esendex.com/v2.0/contactgroups/1ee544e3-8255-442b-b5fb-900d1ccce906/contacts" />
  <link rel="account" href="https://api.esendex.com/v1.0/accounts/f6462f9d-87a2-4cac-97a6-5a2d9cb81997" />
</contactgroup>
Error Responses
HTTP Status Code Reason
400 Bad Request Invalid/Malformed request body.
401 Not Authorised No authentication header provided.
403 Forbidden Failed authentication or not authorised to access feature.
409 Confict Contact group name already exists or conflicts with a contact quickname.
415 Unsupported Media Type Content type is not supported or unspecified.

Update a Contact Group

Amends an existing contact group.

Request

Method: PUT
Authentication: Basic / Session
Content-Type: application/xml

https://api.esendex.com/v2.0/contactgroups/d49f774b-c1bd-48d3-a718-8ee3d926ec25

Example Request Body

<?xml version="1.0" encoding="utf-8"?>
<contactgroup xmlns="http://api.esendex.com/ns/">
  <name>Distant Relatives</name>
</contactgroup>
Successful Response

HTTP Status Code: 200 OK
Content-Type: application/xml

Example Response Body

<?xml version="1.0" encoding="utf-8"?>
<contactgroup id="d49f774b-c1bd-48d3-a718-8ee3d926ec25" contactcount="0" xmlns="http://api.esendex.com/ns/">
  <accountreference>EX0000000</accountreference>
  <name>Distant Relatives</name>
  <link rel="self" href="https://api.esendex.com/v2.0/contactgroups/d49f774b-c1bd-48d3-a718-8ee3d926ec25" />
  <link rel="contacts" href="https://api.esendex.com/v2.0/contactgroups/d49f774b-c1bd-48d3-a718-8ee3d926ec25/contacts" />
  <link rel="account" href="https://api.esendex.com/v1.0/accounts/f6462f9d-87a2-4cac-97a6-5a2d9cb81997" />
</contactgroup>
Error Responses
HTTP Status Code Reason
400 Bad Request Invalid/Malformed request body.
401 Not Authorised No authentication header provided.
403 Forbidden Failed authentication or not authorised to access feature.
404 Not Found The specified contact group doesn't exist.
409 Conflict Contact group name already exists or conflicts with a contact quickname.
410 Gone Contact group previously deleted.
412 Precondition Failed Invalid concurrency ID.
415 Unsupported Media Type Content type is not supported or unspecified.

Delete a Contact Group

Deletes an existing contact group. This operation cannot be undone!

Request

Method: DELETE
Authentication: Basic / Session

https://api.esendex.com/v2.0/contactgroups/d49f774b-c1bd-48d3-a718-8ee3d926ec25
Successful Response

HTTP Status Code: 204 No Content

Error Responses
HTTP Status Code Reason
401 Not Authorised No authentication header provided.
403 Forbidden Failed authentication or not authorised to access feature.
404 Not Found The specified contact group doesn't exist.
415 Unsupported Media Type Content type is not supported or unspecified.

Retrieve Contacts in a Contact Group

Retrieves a paged response of contacts within the specified contact group. See the contacts documentation for details of the elements returned when getting contacts in a contact group.

Request

Method: GET
Authentication: Basic / Session

https://api.esendex.com/v2.0/contactgroups/d49f774b-c1bd-48d3-a718-8ee3d926ec25/contacts
Successful Response

HTTP Status Code: 200 OK
Content-Type: application/xml

Example Response Body

<?xml version="1.0" encoding="utf-8"?>
<contacts startindex="0" count="2" totalcount="2" xmlns="http://api.esendex.com/ns/">
  <contact id="7d6501c7-b5d0-40d1-8907-9053ec7d2616">
    <firstname>John</firstname>
    <lastname>Smith</lastname>
    <quickname>John's Home Phone</quickname>
    <phonenumber>447000000001</phonenumber>
    <accountreference>EX0064044</accountreference>
    <link rel="self" href="https://api.esendex.com/v2.0/contacts/7d6501c7-b5d0-40d1-8907-9053ec7d2616" />
    <link rel="account" href="https://api.esendex.com/v1.0/accounts/f6462f9d-87a2-4cac-97a6-5a2d9cb81997" />
  </contact>
  <contact id="5f552b6a-d162-477b-b10e-0046d44c132b">
    <firstname>John</firstname>
    <lastname>Smith</lastname>
    <quickname>John's Work Phone</quickname>
    <phonenumber>447000000000</phonenumber>
    <accountreference>EX0064044</accountreference>
    <link rel="self" href="https://api.esendex.com/v2.0/contacts/5f552b6a-d162-477b-b10e-0046d44c132b" />
    <link rel="account" href="https://api.esendex.com/v1.0/accounts/f6462f9d-87a2-4cac-97a6-5a2d9cb81997" />
  </contact>
  <link rel="self" href="https://api.esendex.com/v2.0/contactgroups/d49f774b-c1bd-48d3-a718-8ee3d926ec25/contacts?count=2&amp;startIndex=0" />
  <link rel="contactgroup" href="https://api.esendex.com/v2.0/contactgroups/d49f774b-c1bd-48d3-a718-8ee3d926ec25" />
</contacts>
Error Responses
HTTP Status Code Reason
401 Not Authorised No authentication header provided.
403 Forbidden Failed authentication or not authorised to access feature.
404 Not Found The specified contact group doesn't exist.

Add a Contact to a Contact Group

Adds a contact to the specified contact group.

Request

Method: POST
Authentication: Basic / Session
Content-Type: application/xml

https://api.esendex.com/v2.0/contactgroups/d49f774b-c1bd-48d3-a718-8ee3d926ec25/contacts

Example Request Body

<?xml version="1.0" encoding="utf-8"?>
<contacts xmlns="http://api.esendex.com/ns/">
  <contactid>c41a7329-27bb-46b8-9b19-9e92d292a06a</contactid>
</contacts>
Response

HTTP Status Code: 204 No Content

Error Responses
HTTP Status Code Reason
400 Bad Request Invalid/Malformed request body.
401 Not Authorised No authentication header provided.
403 Forbidden Failed authentication or not authorised to access feature.
404 Not Found The specified contact group doesn't exist.
409 Conflict The contact has already been added to the group.
415 Unsupported Media Type Content type is not supported or unspecified.

Request Elements

The following elements are available for use within 'contactgroup':

Element Name Description
<name> Required: The name of this contact group. This must be unique per account, and must not be the same as a contact quick name. Limited to 50 characters.
<accountreference> Required: The account reference of the account which will contain the contact group.

The following elements are available for use within 'contacts':

Element Name Description
<contactid> Required: The identifier of the contact to be added to the contact group.

Response Elements

The following elements will be returned within 'contactgroup':

Element Name Description
id (attribute) The unique identifier for the contact group. Each contact group returned will include an ID which does not change.
contactgroup (attribute) Describes the number of contacts within the contact group.
<accountreference> The account reference of the account which contains this contact group.
<name> The name of this contact group.
<link> Each link element defines the location of related resources such as the account or contact. The self link always links back to the resource being represented. The rel attribute describes which resource the link relates to, and the href attribute contains the location of the resource.

Push Notifications

Push notifications is a feature of our messaging platform that can notify your applications of activity on your account e.g. the arrival of new messages in your inbox or a message has been delivered. It requires a publicly accessible web page or web service that you host which Esendex posts information about the notification to.

Push notifications can optionally be signed so that your receiving service can verify that any notifications it received came from Esendex.

Setting Up

Step 1: Host a Push Notifications Handler on Your Web Server

Our push notifications are delivered across the internet as HTTP POST requests so you'll need to host your push notifications handler code on a publicly accessible web server. This could be your own server or one provided by a hosting company.
In order to receive Notifications you will need to write a handler to process the XML that is sent by Esendex and respond with an HTTP Status Code of 200. If an HTTP Status Code of 200 is not received (e.g. if your handler is unavailable for any reason) then a notification will be retried again for the next 72 hours). All inbound messages are delivered to the account inbox regardless of whether the push notification has been successfully handled by your push notifications handler.

Step 2: Configure the Push Notifications Handler URL

To configure the public URL to access your push notifications handler on your account:

  • Log-in to developer tools
  • If you have more than one account with us, select the account you wish to configure the notification for.
  • Decide which of the notifications you wish to setup and click the corresponding configure button.
  • Enter the valid public URL for your push notifications handler.
  • If you wish, you may enter optional notes for the notification you are setting up. These notes are for your reference and do not affect the way in which push notifications work.

Step 3: Test your push notifications handler

You can test the three types of push notification in the following ways:

  • Message received push notification
    • Send an SMS to your Esendex account's virtual mobile number. You'll be able to check that the message arrives in your inbox in Echo and that a message received notification is pushed to your push notifications handler.
  • Message delivered push notification
    • Send a message from your Esendex account to a mobile phone that you have access to and is able to receive messages. Once the SMS has arrived on the mobile phone, the mobile phone networks inform us of the delivery of the message and you should receive a message delivered push notification.
  • Message failed push notification
    • Send a message from your Esendex account to a known bad telephone number (like 1). The attempt to send will fail and you should receive a message failed push notification.

Note: Any outbound activity from your account, including failed messages, will incur a message charge.

Types of Notification

Message Received

When an account's message received notification is setup with a valid public URL, Esendex will HTTP POST the following XML to your push notifications handler:
Method: POST
Content-Type: application/xml

<InboundMessage>
 <Id>6eb2a830-595b-42e5-99a3-57d87e63db36</Id>
 <MessageId>607bc5ed-0e33-4491-88f5-b7c3982d5bdc</MessageId>
 <AccountId>f6462f9d-87a2-4cac-97a6-5a2d9cb81997</AccountId>
 <MessageText>Message text of inbound message</MessageText>
 <From>447791234567</From>
 <To>447791234567</To>
 <ReceivedAt>2017-12-18T13:22:14.9754957+00:00</ReceivedAt>
</InboundMessage>
Expected Response

HTTP Status Code: 200 OK

Message Delivered

When an account's message delivered notification is setup with a valid public URL, Esendex will HTTP POST the following XML to your push notifications handler:
Method: POST
Content-Type: application/xml

<MessageDelivered>
 <Id>6eb2a830-595b-42e5-99a3-57d87e63db36</Id>
 <MessageId>607bc5ed-0e33-4491-88f5-b7c3982d5bdc</MessageId>
 <AccountId>f6462f9d-87a2-4cac-97a6-5a2d9cb81997</AccountId>
 <OccurredAt>
  2016-02-09T13:54:04.202221Z
 </OccurredAt>
</MessageDelivered>
Expected Response

HTTP Status Code: 200 OK

Message Failed

When an account's message failed notification is setup with a valid public URL, Esendex will HTTP POST the following XML to your push notifications handler:
Method: POST
Content-Type: application/xml

<MessageFailed>
 <Id>6eb2a830-595b-42e5-99a3-57d87e63db36</Id>
 <MessageId>607bc5ed-0e33-4491-88f5-b7c3982d5bdc</MessageId>
 <AccountId>f6462f9d-87a2-4cac-97a6-5a2d9cb81997</AccountId>
 <OccurredAt>
  2016-02-09T13:51:00Z
 </OccurredAt>
 <FailureReason>
    <Code>200</Code>
    <Detail>Temporary recipient issue (absent/error)</Detail>
    <PermanentFailure>false</PermanentFailure>
  </FailureReason>
</MessageFailed>
Failure Reasons

The following failure reasons could be returned for a failed message:

Code Error Description Permanent Failure
7 No route available We were unable to find a network to handle the destination of this message. False
12 No recipient specified There is no recipient specified to whom we can send this message. True
4 No valid subscription In order to send this message to this recipient, the recipient needs to have subscribed and no such subscription exists. True
13 Network submission error We received a message from the network when trying to send it to them and we were unable to retry or send it through another network False
999 Other network issue An unspecified error has occurred when the network was processing the message False
101 Recipient invalid The recipient of this message was not valid True
16 Recipient blacklisted The recipient has a blockage in place which prevents receipt of this message True
102 Handset incompatible The recipient's handset cannot support receipt of this message True
199 Temporary issue An unknown temporary issue has occurred after submitting this message to the network False
200 Temporary recipient issue (absent/error) The recipient is temporarily unable to receive this message False
6 Insufficient credit You do not have enough credit to send this message False
8 Daily message limit You have exceeded the maximum number of messages you can send per day through your account False
17 Message content issue The network is blocking delivery of this message due to its content False
0 No failure reason available The failure reason is unavailable to us False

Expected Response

HTTP Status Code: 200 OK

Opt-Out

When a subscriber to your service opts out from receiving more traffic:
Method: POST
Content-Type: application/xml

<OptOut>
  <Id>436332c6-8755-41bf-abde-cc48eafacba0</Id>
  <AccountId>f6462f9d-87a2-4cac-97a6-5a2d9cb81997</AccountId>
  <AccountReference>EX0014523</AccountReference>
  <ReceivedAt>2015-11-09T15:18:19Z</ReceivedAt>
  <From>
     <PhoneNumber>447728693893</PhoneNumber>
  </From>
  <Link rel="optout" href="https://api.esendex.com/v1.0/optouts/436332c6-8755-41bf-abde-cc48eafacba0" />
</OptOut>
Expected Response

HTTP Status Code: 200 OK

Security

Our messaging platform supports, and we encourage the use of, SSL encrypted communication between it and your push notifications handler through the use of a certificate certified by one of the well known root authorities, e.g. VeriSign, Thawte, etc.

Signing

Our messaging platform can add a signature to the HTTP headers of push notification requests to allow additional verification that the notification came from Esendex. The signatures are an HMAC-SHA256 hash of the request body, combined with a known token as the key. These tokens can be configured and accessed in Esendex developer tools. We provide primary and secondary tokens, and the signature is computed using each token and placed in the X-Primary-Signature and X-Secondary-Signature HTTP headers, respectively. Signatures are binary data, so in the request headers they are encoded with BASE64.

Either signature can be used for validation; two are provided so that if it becomes necessary to change your signature tokens they can be changed one at a time and the receiving system can continue validating using the unchanged token to avoid an interruption in service.

Validating the signature requires re-computing it. The validating system will need the primary and/or secondary signature tokens, the bytes from the message body and an implementation of the HMAC-SHA256 algorithm. It can then compute the hash and compare it to that provided in the signature headers.

The code below demonstrates one way to validate a signature in C#. We assume that the requestBody parameter is the exact bytes from the incoming HTTP request's body, that providedSignature is the value of the X-Primary-Signature header from the request, and that signatureToken is the primary signature token matching that shown on the developer tools site. This would also work unchanged if passing in the secondary header and token.

using System.Security.Cryptography;

public static bool ValidateSignature(
  byte[] requestBody,
  string providedSignature,
  byte[] signatureToken)
{
  using (var hasher = new HMACSHA256(signatureToken))
  {
    var calculatedSignature = hasher.ComputeHash(requestBody);
    var providedSignatureBytes =
      Convert.FromBase64String(providedSignature);

    return calculatedSignature.SequenceEqual(providedSignatureBytes);
  }
}

A Java equivalent, using the same parameters as the C# version, could look as follows:

public static final boolean validatePrimarySignature(
  byte[] requestBody,
  String providedSignature,
  byte[] signatureToken)
{
  Key key = new SecretKeySpec(
    signatureToken, 0, signatureToken.length, "HMACSHA256");

  Mac mac = Mac.getInstance("HMACSHA256");
  mac.init(key);
  mac.update(requestBody);
  byte[] calculatedSignature = mac.doFinal();

  byte[] providedSignatureBytes =
    Base64.getDecoder().decode(providedSignature);

  return Arrays.equals(calculatedSignature, providedSignatureBytes)
}

HMAC-SHA256 implementations are available for many languages, either provided in the standard library as for Java and .NET, or as third-party libraries.

Mobile Journeys API

Prerequisites

Your account must be allowed to use the Mobile Journeys API
Please ask your account manager to give you access to the Mobile Journeys API.

Authentication

First time setup

  1. Access the Esendex developer console https://console.esendex.com
  2. Sign in using your normal Esendex credentials.
  3. Ensure your user has a subscription to the Mobile Journeys Product
  4. Retrieve your Mobile Journeys Primary Key from your Developer Profile

Creating links

Requests

Request sample

POST https://connect.esendex.com/mobilejourneys/v1/journey/instance

Authorization: YOUR_PRIMARY_KEY
Content-Type: application/json

Request Body

{
  "journeyId": "{JOURNEY_ID}",
  "links": [
    {
      "customerReference": "AX-12345",
      "parameters": [
        {
          "name": "DateOfBirth",
          "value": "10/11/1986"
        },
        {
          "name": "FirstName",
          "value": "John"
        },
        {
          "name": "LastName",
          "value": "Smith"
        }
      ]
    },
    {
      "customerReference": "AX-12346",
      "parameters": [
        {
          "name": "DateOfBirth",
          "value": "26/02/1999"
        },
        {
          "name": "FirstName",
          "value": "Mary"
        },
        {
          "name": "LastName",
          "value": "House"
        }
      ]
    },
    {
      "customerReference": "AX-12347",
      "parameters": [
        {
          "name": "DateOfBirth",
          "value": "10/05/2001"
        },
        {
          "name": "FirstName",
          "value": "Jason"
        },
        {
          "name": "LastName",
          "value": "Forest"
        }
      ]
    }
  ]
}

Request Body Elements

Property Description
journeyId (Required) The journeyId that you will be generating links for. This should be provided by your account manager.
activeFrom Date/Time that the link will be active from. Default: Links will be enabled as soon as they have been processed. ISO 8601 format.
activeTo Date/Time that the link will be active to Default: ActiveFrom + 14 days. ISO 8601 format.
vanityText Text to display in the vanity section of the generated url e.g. https://{baseUrl}/{vanityText}_{uniqueLinkId}. Alphanumeric only.
links.customerReference (Required) A reference to identify a link request/response. This reference will be returned on the matching response for the provided parameters. This field should be unique for every link request. Maximum length of 50 characters.
links.parameters (Required) Parameters to customise the Mobile Journey for the individual recipient. For a list of supported parameters for your Mobile Journey talk to your account manager. Parameters on an individual Mobile Journey may be mandatory or optional.

Responses

Successful Response

HTTP Status Code: 207 Multi-Status

Multi status responses will be returned for complete successes, partial successes and complete failures on individual links. In the following example two links were generated successfully and one failed to generate with the reason specified in the failureReasons property.

Example Response Body

Content-Type: application/json

[
    {
        "statusCode": 200,
        "value": {
            "customerReference": "AX-12345",
            "correlationId": "f4987d96-1d60-430a-a207-f9212d56d8cc",
            "link": "https://ems.ese.pm/VanityText_A-ABcd",
            "outcome": "success",
            "failureReasons": []
        }
    },
    {
        "statusCode": 400,
        "value": {
            "customerReference": "AX-12346",
            "correlationId": null,
            "link": null,
            "outcome": "failure",
            "failureReasons": [
                {
                    "errorCode": "parameter_not_specified",
                    "reason": "Missing parameter: LastName"
                }
            ]
        }
    },
    {
        "statusCode": 200,
        "value": {
            "customerReference": "AX-12347",
            "correlationId": "3b79e793-983a-427b-8350-963829097939",
            "link": "https://ems.ese.pm/VanityText_A-ABzx",
            "outcome": "success",
            "failureReasons": []
        }
    }
]

Response Body Elements

Property Description
statusCode The status of the link being generated. e.g. 200 will indicate a successful link creation, 400 will indicate a failure to create a link.
value.customerReference The unique reference provided in the request customerReference property.
value.correlationId A unique identifier for the generated link. In future this field will be provided in webhooks to enable correlation from the created link through to activity events from that link.
value.outcome Whether the link was generated successfully or not. Values: success, failure.
value.link The generated link. Only populated on 'success' outcome.
value.failureReasons The reason why a link failed to generate. Only populated on 'failure' outcome. Can contain 1 or more reasons.

Error Responses
HTTP Status Codes Reason
400 Bad Request Your request must contain the expected properties with acceptable data.
Will include an error message explaining the problem.
401 Unauthorized Your request must contain a valid subscription key.
You must have access to the Mobile Journey.
403 Forbidden Failed authentication or not authorised to access feature.

Webhooks

Esendex's Webhooks system delivers events directly to your applications, letting you know when something has happened, such as a customer using a mobile journey. They can be used to create conversational experiences for your customers and advanced reports on customer engagement.

Prerequisites

Webhooks has restricted access. Please contact your account manager if you wish to use this feature.

First time setup

  1. Navigate to https://console.esendex.com/products
  2. Sign in using your normal Esendex credentials.
  3. Check that you have a subscription to the Webhooks Product
  4. Retrieve your Webhooks Subscription Key from your Developer Profile

Create a subscription

Request sample

POST https://connect.esendex.com/webhooks/v1/accounts/{accountReference}/subscriptions

Authorization: Your webhooks subscription key

Body

Content-Type: application/json

{
    "productId": "mobilejourneys",
    "eventId": "linkcreated",
    "endpoints": [
      {
        "type": "HTTP",
        "uri": "https://example.com/callback"
      }
    ],
    "notificationEmails": ["[email protected]"]
}
Property Description
productId The product containing the event you wish to receive.
eventId The specific event you wish to receive.
endpoints An array of endpoints to receive events
endpoints[...].type Must be "HTTP"
endpoints[...].uri The publicly accessible web address for webhooks to send events to
Successful Response

HTTP Status Code: 200 OK

Example Response Body

Content-Type: application/json

{
    "productId": "mobilejourneys",
    "eventId": "linkcreated",
    "version": "1",
    "endpoints": [{
        "type": "HTTP",
          "status": 0,    
        "uri": "https://example.com/callback"
    }],
    "notificationEmails": ["[email protected]"]
}

List existing subscriptions

GET https://connect.esendex.com/webhooks/v1/accounts/{accountReference}/subscriptions

Authorization: Your webhooks subscription key
Content-Type: application/json

Response body

[
    {
        "productId": "mobilejourneys",
        "eventId": "linkcreated",
        "version": "1",
        "endpoints": [
            {
                "type": "default",
                "status": 0,
                "uri": "https://example.com/callback"
            }
        ],
        "notificationEmails": [
            "[email protected]"
        ]
    },
    {
        "productId": "richcontentapi",
        "eventId": "delivered",
        "version": "1",
        "endpoints": [
            {
                "type": "default",
                "status": 0,
                "uri": "https://example.com/callback"
            }
        ],
        "notificationEmails": [
            "[email protected]"
        ]
    }
]

Remove a subscription

https://connect.esendex.com/webhooks/v1/accounts/{accountReference}/subscriptions/{productId}/{eventId}

Authorization: Your Webhooks Subscription Key

Path parameters

Property Description
accountReference Esendex account reference. E.g. EX0001234.
productId The product containing the event you are subscribed to.
eventId The specific event you no longer wish to receive

Successful Response
200 OK

Mobile Journeys events

productId: mobilejourneys

Mobile Journeys provides webhooks for events triggered by different actions in the Journey.

General guidance for integrating with Mobile Journeys webhooks:

  • The events can be delivered in any order.
  • Events will be delivered at least once. However, it is possible that events are delivered multiple times.
  • The order of fields on an event can change.
  • Additional fields on an event are not considered a breaking change. This prevents excessive version changes.

Standard Data

When your application receives a webhook it will receive an array containing one or more events. The following is the standard webhook structure for a Mobile Journeys event:

[{
    "productId": "mobilejourneys", 
    "eventId": "<eventType>", 
    "eventVersion": "1", 
    "eventTime": "2021-06-11T12:01:45Z", 
    "data": {
        "occurredAt": "2021-06-11T12:01:35Z", 
        "journeyId": "2",
        "correlationId": "91daa348-0eb0-4062-b4b6-61fd467562b0",
        "customerReference": "AX-123456",
        "sessionId": "654321"
    }
}]
Property Description
productId This will always be 'mobilejourneys' for these events
eventId The specific event type as per each
eventVersion Provides the version number of the event. This is used to enable migrations between versions of events when needed
eventTime Time of processing event, this may be slightly later than the time the actual activity took place
data Contains the custom structure for each event type - see specifics for each event in the sections below
data.journeyId Id for the journey the activity took place against
data.correlationId Unique identifier for a specific instance/link. This helps associate all events for a given instance/link
data.customerReference Customer reference associated to the instance/link (not guaranteed to be unique - this is based on the data provided)
data.sessionId When an event relates to a session the session ID will be provided
Link Created

Triggers when a link is created via calling the mobile journeys API, and for any instances created by Esendex (this may be used occasionally for testing and verifying the journey).

{
    "productId": "mobilejourneys", 
    "eventId": "linkcreated",
    "eventVersion": "1", 
    "eventTime": "2021-06-11T12:01:45Z", 
    "data": {
        "occurredAt": "2021-06-11T12:01:35Z", 
        "journeyId": "2",
        "correlationId": "91daa348-0eb0-4062-b4b6-61fd467562b0",
        "customerReference": "AX-123456",
        "url" : "https://examplelink.com/CompanyName_abc",
        "parameters": {
            "accountReference": "123456",
            "balance": "18.56",
            "name": "Mr Smith"
        }
    }
}

In addition to the standard data fields the following are provided;

Property Description
data.url Fully qualified URL for the instance/link
data.parameters Parameters provided to customise the Mobile Journey for the individual recipient/link
Session Created

Triggers when a link is clicked which results in a session being created. A link may get multiple sessions as a user may visit multiple times, or it may be a shared link. Sessions can also be created due to previews by applications prior to a user clicking on a link.

{
    "productId": "mobilejourneys", 
    "eventId": "sessioncreated", 
    "eventVersion": "1", 
    "eventTime": "2021-06-11T12:01:45Z", 
    "data": {
        "occurredAt": "2021-06-11T12:01:35Z", 
        "journeyId": "2",
        "correlationId": "91daa348-0eb0-4062-b4b6-61fd467562b0",
        "customerReference": "AX-123456",
        "sessionId": "654321"
    }
}

This event only provides the standard data fields.

Payment Attempt

Triggers when a payment has been attempted by the user and indicates whether the payment was successful or not.

{
    "productId": "mobilejourneys", 
    "eventId": "paymentattempt", 
    "eventVersion": "1",
    "eventTime": "2021-06-11T12:01:45Z", 
    "data": {
        "occurredAt": "2021-06-11T12:01:35Z", 
        "journeyId": "2",
        "correlationId": "91daa348-0eb0-4062-b4b6-61fd467562b0",
        "customerReference": "AX-123456",
        "sessionId": "654321",
        "paymentDetail": {
            "transactionId": "664855f2-076b-448b-8058-41a72ee9608f",
            "transactionTime": "2020-11-27T13:46:31Z", 
            "authorised": true,
            "amount": 5.56,
            "currency": "GBP",
            "cardNumber": "0001",
            "authorisationCode": "test/4321",
            "cardType": "DEBIT",
            "cardholderName": "John Smith"
        }
    }
}

In addition to the standard data fields the following are provided;

Property Description
data.transactionId Unique identifier for the transaction
data.transactionTime Actual time the transaction was processed
data.authorised Indicates if the transaction was authorised or not
data.amount Value of the transaction (decimal)
data.currency ISO 4217 standard currency code
data.cardNumber Last four digits of the card number
data.authorisationCode Authorisation code for the transaction - only present if the transaction was authorised
data.cardType Indicates if the card is debit or credit, if known
data.cardholderName Name on card
Document Generated

Triggers when a user clicks the generate option for a document and therefore will have started to request the associated document.

{
    "productId": "mobilejourneys", 
    "eventId": "documentgenerated", 
    "eventVersion": "1", 
    "eventTime": "2021-06-11T12:01:45Z", 
    "data": {
        "occurredAt": "2021-06-11T12:01:35Z", 
        "journeyId": "2",
        "correlationId": "91daa348-0eb0-4062-b4b6-61fd467562b0",
        "customerReference": "AX-123456",
        "sessionId": "654321",
        "templateId": "cf80f9b3-22da-42d9-94a0-285518264677",
        "documentId": "77a3b1e3-cdec-40ca-9543-7685a24120c6",
        "documentCategory": "Invoice-Type1"
    }
}

In addition to the standard data fields the following are provided;

Property Description
data.templateId Identifies the template used to generate the document. If the journey supports multiple version of a document this can be used to determine which format was used
data.documentId Unique identifier for the generated document
data.documentCategory If the journey supports multiple documents this can be used to determine the type of document the user generated
Stage

Triggers when a user submits a page that is configured as a ‘stage event’. What stages are available depends on the individual journey and are typically used for tracking key progress within a journey or important data capture points. These are configurable so talk to your account manager if you need an additional stage configured.

{
    "productId": "mobilejourneys", 
    "eventId": "stage", 
    "eventVersion": "1", 
    "eventTime": "2021-06-11T12:01:45Z", 
    "data": {
        "occurredAt": "2021-06-11T12:01:35Z", 
        "journeyId": "2",
        "correlationId": "91daa348-0eb0-4062-b4b6-61fd467562b0",
        "customerReference": "AX-123456",
        "sessionId": "654321",
        "stageName": "journeyEnd",
        "generatedDocumentIds":[
            "77a3b1e3-cdec-40ca-9543-7685a24120c6",
            "87a3b1e3-cdec-40ca-9543-7685a24120c6"
        ],
        "downloadedDocumentIds":[
            "77a3b1e3-cdec-40ca-9543-7685a24120c6"
        ],
        "uploadedDocumentIds":[
            "772dc40f-ae5a-487b-b9a2-372918dc8ae3"
        ],
        "transactionIds":[
            "664855f2-076b-448b-8058-41a72ee9608f"
        ],
        "sessionData": {            
            "accountReference": "123456",
            "balance": "13.00",
            "name": "Mr Smith",
            "dateOfBirth": "01-01-1980",
            "addressLine1": "1 Somewhere Place",
            "addressLine2": "A Town",
            "addressLine3": "",
            "addressCity": "A City",
            "postcode": "AA1 1AA",
            "portalName": "DemoPortal"
        }
    }
}

In addition to the standard data fields the following are provided;

Property Description
data.stageName If the journey supports multiple stage events this can be used to identify the specific stage that has been reached
data.generatedDocumentIds List of all generated document Ids. Can be used to synchronise data between events, especially as the order of events is not guaranteed
data.downloadedDocumentIds List of all downloaded document Ids. Can be used to synchronise data between events, especially as the order of events is not guaranteed. Note: document download events are not yet supported
data.uploadedDocumentIds List of all uploaded document Ids. Can be used to synchronise data between events, especially as the order of events is not guaranteed
data.transactionIds List of all transaction Ids. Can be used to synchronise data between events, especially as the order of events is not guaranteed
data.sessionData Data available on the session at the time this stage event is triggered. This is a combination of any original parameters on the link, entered and processed data that has been recorded within the session. The data may not be the same as originally entered if values have been replaced as a result of formatting or calculations
Esendex UK & Ireland
[email protected] 0345 356 5758

20 Wollaton Street
Nottingham
NG1 5FW

Esendex Europe
[email protected] 900 800 470

Av. Diagonal, 534
08006 Barcelona
Spain

Esendex Australia & USA
[email protected] 1300 764 946

Level 10, 60 Albert Road
South Melbourne
VIC 3205

Support
View Status Support Terms of use Privacy Cookie policy Blog LinkedIn

Commify UK Ltd 2023 | Registered company number: 04217280

21.09.07.b-54.css-1391
UK
OSZAR »