Getting Started#
Welcome to the API! This guide will walk you through the basics of integrating with our platform.
Base URL#
All API requests are made to your tenant's domain:
https://{your-domain}/api/v1/
Authentication#
Every API request must include your secret key in the Authorization header:
curl -X GET https://{your-domain}/api/v1/me \
-H "Authorization: Bearer sk_live_your_secret_key"Note: Never expose your secret key in client-side code. Use it only on your server.
Your First Request#
Let's verify your API key works. GET /me returns your account and, importantly, tells
you which environment the key belongs to:
curl -X GET https://{your-domain}/api/v1/me \
-H "Authorization: Bearer sk_live_your_secret_key" \
-H "Accept: application/json"const response = await fetch("https://{your-domain}/api/v1/me", {
headers: {
Authorization: "Bearer sk_live_your_secret_key",
Accept: "application/json",
},
});
const data = await response.json();
console.log(data);import requests
response = requests.get(
"https://{your-domain}/api/v1/me",
headers={
"Authorization": "Bearer sk_live_your_secret_key",
"Accept": "application/json",
},
)
print(response.json())$response = Http::withToken('sk_live_your_secret_key')
->get('https://{your-domain}/api/v1/me');
$data = $response->json();A successful response looks like:
{
"id": "01HQ...",
"name": "My Business",
"status": "active",
"environment": "live",
"api_key_prefix": "sk_live_a1b2c3",
"tier": { "name": "Standard", "slug": "standard" }
}tier is always present; its name and slug are null if no tier is assigned.
environment reflects the key you just sent, not a setting on your account. If you meant
to be testing and this says live, stop and swap the key — every subsequent call in this
guide moves real money.
Key Concepts#
| Concept | Description |
|---|---|
| Secret Key | Server-side key for authenticated requests (sk_live_... or sk_test_...) |
| Test Mode | Use your sk_test_ key to test without real charges |
| Idempotency | Send an Idempotency-Key header (or an idempotency_key body field) with each purchase so a retry never buys twice — see Idempotency |
| Amounts | Integers in the smallest unit of the currency — see below |
Amounts & Currency#
The platform is multi-currency. Every monetary value — request amounts, response amounts, and catalog prices — is an integer in the smallest unit of the transaction's currency. There are no decimal points on the wire, so there's no floating-point rounding to worry about.
What "smallest unit" means depends on the currency's minor unit (ISO 4217):
| Currency | Smallest unit | Factor | Example value | Means |
|---|---|---|---|---|
| NGN | kobo | 100 | 500000 | ₦5,000.00 |
| USD | cent | 100 | 500000 | $5,000.00 |
| KES | cent | 100 | 500000 | KSh 5,000.00 |
| JPY | yen (no minor unit) | 1 | 5000 | ¥5,000 |
Do the conversion at your edge:
- Sending an amount: multiply the major amount by the currency's factor. ₦5,000 →
500000. - Displaying a returned amount: divide by the factor.
500000→ ₦5,000.00.
Every amount in a response is paired with a currency_code. Don't assume NGN or a factor of 100 — read the currency_code and use that currency's minor unit, so your integration works for any tenant's currency.
There are no exceptions: airtime, data, bills, SMS and VoIP all take and return the smallest unit. To buy ₦500 of airtime, send "amount": 50000.
Idempotency#
Every purchase endpoint takes an idempotency key, so a request you retry after a timeout or a dropped connection never buys — or charges — twice. Send it as the Idempotency-Key header or as the idempotency_key field in the JSON body; they are the same key.
curl -X POST https://{your-domain}/api/v1/airtime/networks/mtn/purchase \
-H "Authorization: Bearer sk_live_your_secret_key" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Idempotency-Key: order-7f3a9c" \
-d '{ "phone_number": "2348012345678", "amount": 50000 }'- Re-sending a key returns the original purchase with
200instead of buying again. The key alone identifies the purchase, so use one per order (your own order ID works well) and reuse it on every retry of that order. - At most 64 characters.
- Header and body together must carry the same key. Two different keys are refused with
422(errors.idempotency_key) and nothing is charged. - A failed purchase stays failed: its key replays the failure (
400,PURCHASE_FAILED). To try again, use a new key. - Test and live share one key space. A key already used with your
sk_test_key is refused with409(IDEMPOTENCY_KEY_REUSED) on yoursk_live_key, and the other way round.
Environments#
| Environment | Key Prefix | Description |
|---|---|---|
| Live | sk_live_ | Real transactions, real money |
| Test | sk_test_ | Simulated transactions, no charges |
A test purchase answers exactly what the same live purchase answers — the same fields and status codes — with "is_test": true (live answers carry false). Code you write against your test key works unchanged with your live key.
Error Handling#
The API uses standard HTTP status codes. Errors include a JSON body:
{
"message": "Insufficient wallet balance",
"errors": {
"amount": ["The amount exceeds your available balance"]
}
}| Status | Meaning |
|---|---|
200 | Success |
400 | Bad request — check your parameters |
401 | Unauthorized — check your API key |
422 | Validation error — see errors object |
429 | Rate limited — slow down |
500 | Server error — retry or contact support |
Next Steps#
- Authentication — Deep dive into API keys and auth flows
- Airtime API — Purchase airtime programmatically
- Data Bundles — Subscribe to data plans
- Webhooks — Receive real-time notifications