#
Authentication
To authenticate, you first need to create an api key pair. The key pair is composed of an api key id and an api key secret
Those are both required for every request unless specified otherwise in the reference document.
Go ahead an create an Api Key Pair in your account on the Sofy dashboard in your account menu (Top Right of the page). Beware that once created, you will not be able to see the api secret again. This is both to encourage users to create distinctive api keys for different services and to provide additional security.
Please keep in mind that one api key pair is restricted to one location. So if you want to manage multiple locations, you will have to use the correct api keys for the corresponding location.
#
Provide your api key pair
The Api Key pair must be transmitted using http headers.
To test the api using the Api Explorer, click on the authorize button on the top right, then provide both headers. Once this is done you can call any endpoint
#
Example
curl -X 'POST' \
'https://api.sofy.fr/v1/webhooks' \
-H 'accept: application/json' \
-H 'X-API-KEY-ID: xxxxx' \
-H 'X-API-KEY-SECRET: yyyyy' \
-H 'Content-Type: application/json' \
...
import axios from 'axios';
// Axios GET has headers in the second parameter
axios.get('https://api.sofy.fr/v1/webhooks', {
headers: {
'X-API-KEY-ID': 'xxxxx',
'X-API-KEY-SECRET': 'yyyyy',
},
});
// Axios POST has headers in the third parameter
axios.post(
'https://api.sofy.fr/v1/webhooks',
{
...
},
{
headers: {
'X-API-KEY-ID': 'xxxxx',
'X-API-KEY-SECRET': 'yyyyy',
},
}
);
$ID = getenv('SOFY_API_KEY_ID');
$SECRET = getenv('SOFY_API_KEY_SECRET');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.sofy.fr/v1/webhooks");
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"X-API-KEY-ID: " . $ID,
"X-API-KEY-SECRET: " . $SECRET,
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
Awesome ! You're now authenticated to the Sofy API. Let's send an SMS !