In this article:
You’re asking yourself what exactly is the API? No, it’s not the name of a droid in the new Star Wars movie. The API allows an external system to interact with Cyberimpact (For example: Your website, a CRM etc.) and to achieve some functions by programming. Once the API is in place, you can, among other things, add or unsubscribe contacts automatically.
This tool allows you, among other things, to:
- Retrieve, unsubscribe, create* or delete contacts;
- Add contacts to a group or update their current groups;
- Retrieve, create, edit or delete groups;
- Remove contacts from groups;
- Retrieve, create or cancel mailings;
- Retrieve, create, replace or delete templates;
- Retrieve, import or unsubscribe many contacts simultaneously.
* If you use the API to add contacts to your account by using the “double opt-in” (when the contact receives a confirmation email and clicks the link to confirm their subscription), you could use the “New subscriber” marketing automation rule to automatically send them an email confirmation for their new subscription. For example, you could send them a Thank You email for subscribing to your list.
* You won't be able to delete a group interacting with the API. You will need to change your request before deleting your group.
Please note that this feature requires technical knowledge in programming.
To obtain documentation on the API, click here.
To use the API, we need to activate the function in your account for you. To activate the function, send us a request by email at the following address: firstname.lastname@example.org.
The request must come from either the technical or billing contact of your account. Don’t forget to include your business and/or account name in your request.
To authenticate to the API, we invite you to use the API tokens. To create an API token, follow these steps:
- Connect to your Cyberimpact account.
- With your mouse, point the “settings” menu and choose “API tokens”
- Click on “Create a new API token”
- Click on the “view” button situated on the right of your token.
- Copy the content of your token. Use this token in the HTTP authorization header for your calls to the API.
- The option to create API tokens will only be found in the user file if the option allowing you to use the API was activated beforehand in your account.
- Each API token is valid for a ten year period. To prevent a token from working before the end of that period, connect to your Cyberimpact account, then go to your “settings” menu, API tokens. Click on the “Delete” button on the right of the token to delete.
- An API token does not allow you to authenticate to the application.
- If you use our previous authentication method to the API (Username and password) we strongly recommend that you switch to our new method that uses the API tokens. This will lower considerably the time needed to make your calls to the API. Additionally, it will prevent connection errors due to a password change from the user. The authentication by token works with the JWT (JSON Web Token) standard. We invite you to learn more on the subject.
Exemples in PHP:
- Previous method:
curl_setopt($curl_handle, CURLOPT_USERPWD, 'my_username' . ':' . 'my_password');
-New method :
curl_setopt($curl_handle, CURLOPT_HTTPHEADER, array('Authorization: Bearer token-content'));
· To ensure a good continuity of your API programming:
-When you use the API token authentication method, it is important to not delete the token used in your programming. Please note that if you delete the user that created the API token with this authentication method, the token will still work even if the user no longer exists.
-When you use the username and password authentication method, it is important that you don’t delete the user or change the access codes of this user.
You have questions regarding the API? Click here to send us a help request. When you send us your question, make sure to give us the full request from where your question origins as well as the response from the API so our developers can recreate your case in its integrality.
We also invite you to take a look at our different examples available in our API documentation.