---
updatedAt: 2026-07-28T15:11:59.000Z
---

Fetch the complete documentation index at: https://developer.aircall.io/llms.txt. Use this file to discover all available pages before exploring further. Append .md to any documentation page URL to get its markdown version.

# 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. <Anchor target="_blank" href="https://aircall.io/get-started/">Sign up as a customer here</Anchor> or [if you qualify to be a tech partner](/docs/how-to-publish-an-app#requirements) you can then <Anchor target="_blank" href="https://aircall.io/partners/technology/">sign up for a developer account here</Anchor>.
* An App or a tool for making API requests, such as curl, Postman, or your preferred HTTP client.

## Get your API credentials

<Callout icon="❗️" theme="error">
  **Never expose your API token in client-side code.**<br />Anyone who can access it can make requests on your behalf.
</Callout>

<Callout icon="🚧" theme="warn">
  All requests to the Aircall Public API must use`https://`.
</Callout>

1. Open your Aircall Dashboard > Integrations > <Anchor target="_blank" href="https://dashboard.aircall.io/integrations/api-keys">API keys</Anchor>.
2. In the top right corner, click **Generate API key**.
3. Aircall will generate two strings: an `API ID `and an `API token`, which act as your username and password.
4. 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

<Video url="https://fast.wistia.com/embed/medias/hpe0o2bzon/" />

## 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:

```javascript app.js
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.

```javascript app.js
// 1. Encode credentials
const apiId = "YOUR_API_ID";
const apiToken = "YOUR_API_TOKEN";

const encodedCredentials = Buffer.from(`${apiId}:${apiToken}`).toString("base64");

// 2. Send the HTTP request
try {
  const response = await fetch("https://api.aircall.io/v1/ping", {
    headers: {
      Authorization: `Basic ${encodedCredentials}`,
    },
  });

  if (!response.ok) {
    throw new Error(`HTTP ${response.status}: ${response.statusText}`);
  }

  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error("Error:", error.message);
}
```

✅ A successful response looks like this:

```json
{
  "ping": "pong"
}
```

❌ If your credentials are missing or incorrect, you’ll receive

```json
{ 
  "error": "Unauthorized",
  "troubleshoot": "Check your API key" 
}
```

<br />