Get your API key

You will need an account to get API key. If you are not yet a user, sign up for a free account on our homepage. Follow the instructions and become a user so you can start using everything we have to offer.

You need a key to start working with API. You can obtain it in 2 ways:

  1. Use the web interface,
  2. Authenticate by using the API function login() (see Search for API key for details).

Getting a key from web interface

You can find the key in your account drop-down menu - API Keys section. To get there:

  1. Log in to your account
  2. Go to your account settings
  3. Click the API Keys section.

It will show a list of API keys.

Api keys

Choose a valid (active) key, which you will use in your application to work with our API. If the list does not contain any keys, you can create a new one by clicking on the "Add a key" button.

Getting a key by using API function login()

By using the login() function and inputting your username and password, you can obtain a valid key as well. If your account is not associated with a key or all keys are inactive, a new valid key will be created. For more information about using this function, please see "Search for API key".

Example of usage

Below, is a simple PHP example, which demonstrates how to find out if the key is valid.

ping();
 
if ($api->errorCode) {
    echo "There was an error!\n";
    echo "Code: " . $api->errorCode . "\n";
    echo "Message: " . $api->errorMessage . "\n";
} else {
    print_r($response);
} 
2nd line shows the PHP API wrapper library file that contains all the necessary functions for working with the API.

3rd line shows your active API key as input.

4th line, API instance is created which you can later use to refer to our system.

5th line, an API function which checks the key is executed (see also Ping). 

7th line checks whether or not an error has occurred while executing the ping () function. If there has been an error, then lines 9 and 10 show the error code and description to the user.

12th line shows the result obtained by the function if no error has occurred. If the API key is valid, you will get a message saying, "Everything is ok!"

 

© 2010-2017 Mailigen. All rights reserved.