Authentication
To use our API, you must include your Secret-Key in the request header. You can find your key in your Profile settings on the dashboard.
HEADER
Authorization: Bearer YOUR_API_KEY
All API responses are returned in JSON format.
1. Check Balance
Retrieve the current wallet balance for your account.
GET
https://albanidata.com/api/v1/wallet/balance
Request Sample
curl -X GET "https://albanidata.com/api/v1/wallet/balance" \
-H "Authorization: Bearer YOUR_API_KEY"
Response Sample
{
"status": true,
"user": "John Doe",
"balance": 25000.50,
"currency": "NGN"
}
2. Buy Airtime
Purchase airtime for any Nigerian network (MTN, GLO, Airtel, 9Mobile).
POST
https://albanidata.com/api/v1/airtime/purchase
| Parameter | Type | Description |
|---|---|---|
network | String | MTN, GLO, AIRTEL, 9MOBILE REQUIRED |
amount | Float | Amount in NGN (Min ₦50) REQUIRED |
phone | String | Recipient Phone Number REQUIRED |
Request Sample
curl -X POST "https://albanidata.com/api/v1/airtime/purchase" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"network": "MTN",
"amount": 500,
"phone": "08012345678"
}'
3. Buy Data
Purchase high-speed data plans instantly.
POST
https://albanidata.com/api/v1/data/purchase
| Parameter | Type | Description |
|---|---|---|
plan_id | String | ID of the data plan (See Plan List) REQUIRED |
phone | String | Recipient Phone Number REQUIRED |
5. Code Examples
Ready-to-use code snippets in popular languages.
PHP Example
Error:
JavaScript (Node.js) Example
const axios = require('axios');
const API_KEY = 'YOUR_API_KEY';
const BASE_URL = 'https://albanidata.com/api/v1';
async function buyAirtime(network, amount, phone) {
try {
const response = await axios.post(
`${BASE_URL}/airtime/purchase`,
{ network, amount, phone },
{
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
}
}
);
if (response.data.status) {
console.log('Success!', response.data);
} else {
console.error('Error:', response.data.message);
}
} catch (error) {
console.error('Request failed:', error.message);
}
}
// Usage
buyAirtime('MTN', 500, '08012345678');
Python Example
import requests
import json
API_KEY = 'YOUR_API_KEY'
BASE_URL = 'https://albanidata.com/api/v1'
def buy_airtime(network, amount, phone):
headers = {
'Authorization': f'Bearer {API_KEY}',
'Content-Type': 'application/json'
}
data = {
'network': network,
'amount': amount,
'phone': phone
}
response = requests.post(
f'{BASE_URL}/airtime/purchase',
headers=headers,
json=data
)
result = response.json()
if result['status']:
print(f"Success! Ref: {result['reference']}")
else:
print(f"Error: {result['message']}")
# Usage
buy_airtime('MTN', 500, '08012345678')
6. Error Handling
All API responses include a status field. If false, check the message field for details.
Common Error Codes
| Code | Message | Solution |
|---|---|---|
401 | Invalid API Key | Check your API key in Profile settings |
402 | Insufficient Balance | Fund your wallet |
400 | Invalid Parameters | Check request format |
429 | Rate Limit Exceeded | Slow down requests (max 60/min) |
500 | Server Error | Contact support |
Error Response Example
{
"status": false,
"message": "Insufficient wallet balance",
"code": 402,
"required": 500.00,
"available": 250.00
}
7. Rate Limits & Best Practices
Rate Limits
- Maximum 60 requests per minute
- Maximum 1000 requests per hour
- Burst limit: 10 requests per second
Best Practices
- ✓ Store your API key securely (environment variables)
- ✓ Implement retry logic with exponential backoff
- ✓ Cache data plan lists (they rarely change)
- ✓ Use webhooks for async transaction updates
- ✓ Log all API calls for debugging
- ✗ Never expose your API key in client-side code
- ✗ Don't make parallel requests for the same transaction
4. Query Status
Check the status of a previously executed transaction.
GET
https://albanidata.com/api/v1/transaction/status/{reference}