Authentication
Authenticate V2 API requests using API keys generated from the Enterprise Portal.
Authentication
The V2 API uses API key authentication. No login endpoints, no token refresh — just a single key in every request.
Getting Your API Key
- Log in to the Enterprise Portal
- Navigate to Settings → API Keys
- Click Generate New Key
- Copy the key immediately — it won't be shown again
Store your API key securely. If compromised, revoke it immediately from the Enterprise Portal and generate a new one.
Using Your API Key
Include the key as a Bearer token in the Authorization header:
curl -X GET https://api.clickairtime.com/v2/balance \
-H "Authorization: Bearer ce_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"const response = await fetch('https://api.clickairtime.com/v2/balance', {
headers: {
'Authorization': 'Bearer ce_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
},
});
const data = await response.json();import requests
response = requests.get(
'https://api.clickairtime.com/v2/balance',
headers={
'Authorization': 'Bearer ce_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
}
)
data = response.json()$ch = curl_init('https://api.clickairtime.com/v2/balance');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ce_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = json_decode(curl_exec($ch));Key Format
All API keys follow this format:
ce_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- Prefix:
ce_live_(8 characters) - Random body: 32 characters (alphanumeric)
- Total length: 40 characters
Key Permissions
Each API key can be scoped with specific permissions:
| Permission | Description |
|---|---|
airtime.read | Read product catalog and network info |
airtime.write | Create topup transactions |
airtime.transactions.read | View transaction history and status |
wallets.read | View wallet balances |
Key Expiry
API keys do not expire unless you set an expiry date when creating the key in the Enterprise Portal. After that date, requests with the key return 401 EXPIRED_API_KEY. Any key can be revoked at any time from the Enterprise Portal (401 REVOKED_API_KEY).
Rate Limits
Each API key is limited to 60 requests per minute and 100 requests per second by default; limits can be raised on request. See Rate Limits.
IP Restrictions
You can restrict API keys to specific IP addresses from the Enterprise Portal for additional security.
Error Responses
| Error Code | HTTP Status | Description |
|---|---|---|
INVALID_API_KEY | 401 | Key is missing, malformed, or not found |
EXPIRED_API_KEY | 401 | Key has passed the expiry date set when it was created |
REVOKED_API_KEY | 401 | Key has been revoked from the portal |
IP_NOT_ALLOWED | 403 | Request from an unauthorized IP address |
INSUFFICIENT_PERMISSIONS | 403 | Key lacks required permission for this endpoint |
