Authenticate with API Keys
Getting Started
Learn how to generate your Aircall API keys and use them to authenticate requests to the Aircall Public API. Before you start make sure you have the following:
- You must have an Aircall account. Sign up as a customer here or if you qualify to be a tech partner you can then sign up for a developer account here.
- An App or a tool for making API requests, such as curl, Postman, or your preferred HTTP client.
Get your API credentials
Never expose your API token in client-side code.
Anyone who can access it can make requests on your behalf.
All requests to the Aircall Public API must use
https://.
- Go to your Aircall Dashboard's Integrations & API page . In the top right corner
- Click Generate an API key.
- Aircall will generate two strings: an API ID and an API token, which act as your username and password.
- Copy and store both values somewhere safe. You will only be able to see the API token once — after closing the window it will no longer be accessible. If you lose them, you can always generate a new pair from the same page.
🎥 Demo → Create API Keys
Create a Base64 encoded string with your API credentials
API key authentication works by sending your credentials in the Authorization header of each request, encoded in Base64. The format is api_id:api_token.
For example, if your api_id is 1234ABCD5678EFGH and your api_token is 9876LMNO5432PQRS, the string to encode is 1234ABCD5678EFGH:9876LMNO5432PQRS. The resulting header looks like this:
Authorization: Basic MTIzNEFCQ0Q1Njc4RUZHSDo5ODc2TE1OTzU0MzJQUVJT
To generate the encoded string in JavaScript:
const apiId = YOUR_API_ID;
const apiToken = YOUR_API_TOKEN;
let encodedCredentials = Buffer.from(`${apiId}:${apiToken}`).toString('base64');Make your first authenticated request
Now that you have your encoded credentials, you can include them in your API requests. The example below uses the /v1/ping endpoint to verify that your credentials are valid.
const https = require('https');
// 1. Encoding credentials:
const apiId = YOUR_API_ID;
const apiToken = YOUR_API_TOKEN;
let encodedCredentials = Buffer.from(apiId + ':' + apiToken).toString('base64');
// 2. Specifying HTTP Headers
let headers = {
'Authorization': 'Basic ' + encodedCredentials
};
let options = {
host: 'api.aircall.io',
path: '/v1/ping',
port: 443,
headers: headers
};
// 3. Sending the HTTP request
https.get(
options,
(res) => {
let body = '';
res.on('data', (data) => { body += data; });
res.on('end', () => {
console.log(body);
});
res.on('error', (e) => {
console.log('Error: ', e.message);
});
}
);✅ A successful response looks like this:
{
"ping": "pong"
}❌ If your credentials are missing or incorrect, you’ll receive
{
"error": "Unauthorized",
"troubleshoot": "Check your API key"
}Updated 3 days ago
What’s Next
And that's it! You just made your first Public API request using Basic Authentication 👏 You are now ready to build on top of Aircall Public API