(499) 346-0344

UniSender API methods

General description

API is available for free for all accounts. By default it's turned off and you need to turn it on. API key is available in account too. The key is confidential and it's prohibited to distribute it, otherwise anyone can access your account and the personal data of your subscribers.

API may work in both test and live modes. In a test mode all actions which may change data or debit your account report about success, but actually do not make any changes. We recommend to use test mode for debugging. Later you may switch to the live mode in your account.

Method call

To call a API method you need make an HTTP request as below:

http://api.unisender.com/en/api/METHOD?format=json&api_key=KEY&arg1=ARG_1&argN=ARG_N
where:

METHOD
method name
KEY
API key
ARG_1 ... ARG_N
method parameters

All parameters must be UTF-8 encoded. In the sample above we used GET request, but POST is also available. Moreover, POST is preferred because it will not leave your API key in firewall and proxy server logs.

The return value is in JSON format.

Success on method call

If a method call successes, the return value contains a field "result", which content depends on the method. Also, there's no "error" field.

In some cases a "warning" field may be added to the return value too.

A sample of a successful method call return value:

{
  "result":523514,
  "warnings":[
    {"warning":"probably not a mobile phone"}
  ]
}

Error on Method Call

If a return value contains an "error" field, method call has failed. The field contains HTML-encoded message describing the error. Also, the field "code" will contain a string value with the error code. "Result" field must be ignored.

Standard error codes::

unspecified
No error code is provided. Read a message for details.
invalid_api_key
Incorrect API key is provided. Please check if api_key matched the value provided in your account.
access_denied
Access denied. Please check if API is enabled in your account and you do not attempt to call the method which is not available for you.
unknown_method
Incorrect method name
not_enough_money
Not enough money on your account for performing the action

Other error codes are available for specific methods. The above error codes are standard for all API methods.

A sample of a failed method call return value:

{"error":"AK100310-02","code":"invalid_api_key"}