Data Bundles API#
Purchase internet data bundles for any supported network. Data bundles are deducted from your wallet balance.
List Available Networks#
GET /api/v1/data/networks
Returns all networks that have data bundle plans available:
curl -X GET https://{your-domain}/api/v1/data/networks \
-H "Authorization: Bearer sk_live_your_secret_key"const response = await fetch(
"https://{your-domain}/api/v1/data/networks",
{
headers: { Authorization: "Bearer sk_live_your_secret_key" },
}
);
const data = await response.json();Response#
{
"networks": [
{ "slug": "mtn", "name": "MTN" },
{ "slug": "glo", "name": "Glo" },
{ "slug": "airtel", "name": "Airtel" },
{ "slug": "9mobile", "name": "9mobile" }
]
}List Plans for a Network#
GET /api/v1/data/networks/{network}/plans
Fetch all available data plans for a specific network:
curl -X GET https://{your-domain}/api/v1/data/networks/mtn/plans \
-H "Authorization: Bearer sk_live_your_secret_key"const response = await fetch(
"https://{your-domain}/api/v1/data/networks/mtn/plans",
{
headers: { Authorization: "Bearer sk_live_your_secret_key" },
}
);
const plans = await response.json();import requests
response = requests.get(
"https://{your-domain}/api/v1/data/networks/mtn/plans",
headers={"Authorization": "Bearer sk_live_your_secret_key"},
)
print(response.json())$response = Http::withToken('sk_live_your_secret_key')
->get('https://{your-domain}/api/v1/data/networks/mtn/plans');Response#
{
"plans": [
{
"slug": "mtn-1gb-30d",
"name": "1GB - 30 Days",
"network": "mtn",
"amount": 30000,
"data_size": "1GB",
"validity": "30 days"
},
{
"slug": "mtn-5gb-30d",
"name": "5GB - 30 Days",
"network": "mtn",
"amount": 150000,
"data_size": "5GB",
"validity": "30 days"
}
]
}Note: The
amountis an integer in the smallest unit of the plan's currency (kobo for NGN, so30000= ₦300.00). The platform is multi-currency — use the plan'scurrency_codeand that currency's minor unit rather than assuming a factor of 100. See Amounts & Currency.
Purchase Data Bundle#
POST /api/v1/data/networks/{network}/plans/{plan}/purchase
Both {network} and {plan} are slugs from the endpoints above.
curl -X POST https://{your-domain}/api/v1/data/networks/mtn/plans/mtn-1gb-30d/purchase \
-H "Authorization: Bearer sk_live_your_secret_key" \
-H "Content-Type: application/json" \
-d '{
"phone_number": "2348012345678"
}'const response = await fetch(
"https://{your-domain}/api/v1/data/networks/mtn/plans/mtn-1gb-30d/purchase",
{
method: "POST",
headers: {
Authorization: "Bearer sk_live_your_secret_key",
"Content-Type": "application/json",
},
body: JSON.stringify({
phone_number: "2348012345678",
}),
}
);
const result = await response.json();import requests
response = requests.post(
"https://{your-domain}/api/v1/data/networks/mtn/plans/mtn-1gb-30d/purchase",
headers={"Authorization": "Bearer sk_live_your_secret_key"},
json={
"phone_number": "2348012345678",
},
)
print(response.json())$response = Http::withToken('sk_live_your_secret_key')
->post('https://{your-domain}/api/v1/data/networks/mtn/plans/mtn-1gb-30d/purchase', [
'phone_number' => '2348012345678',
]);Parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
phone_number | string | Yes | Recipient phone number in international format (must start with 234) |
idempotency_key | string | No | Unique key (max 64 chars) to prevent duplicate purchases. You can send it as the Idempotency-Key header instead — the same key; see Idempotency. |
Note: The amount is determined by the plan — you don't need to specify it.
Response#
200, whether this request made the purchase or replayed it. The same shape as an airtime purchase, and the same in test mode (with "is_test": true):
{
"id": "01kw463z1czwnst3yknbkzczn2",
"title": null,
"amount": 30000,
"fee": 0,
"amount_paid": 30000,
"currency_code": "NGN",
"status": "success",
"is_test": false,
"created_at": 1751270400
}status is success, or processing while the network confirms the bundle; the purchase.success / purchase.failed webhook, or GET /api/v1/purchases/{id}, gives the final state.
Error Codes#
| Code | Error Code | Description |
|---|---|---|
402 | INSUFFICIENT_BALANCE | Wallet balance too low |
404 | NETWORK_NOT_FOUND | Network slug not recognized |
404 | PLAN_NOT_FOUND | Plan slug not found for this network |
422 | Validation error | Invalid phone number format |
429 | DAILY_LIMIT_REACHED | Daily transaction limit exceeded |
429 | LIMIT_EXCEEDED | The amount is below a minimum, above a per-transaction limit, or above what is left of a daily or monthly limit. Nothing was charged. The limit object says which bound (source, bound, limit_minor, currency_code, and for daily/monthly the remaining_minor and resets_at); see the API reference. Earlier releases answered this with HTTP 500 |
409 | LIMIT_CHECK_BUSY | Another purchase on your account was being checked against its daily or monthly limit. Nothing was charged; retry the same request, with the same idempotency key |
400 | PROVIDER_REJECTED | The network provider rejected the request |
500 | ERROR | Internal server error |
Error Response Format#
{
"success": false,
"message": "Plan not found for this network",
"code": "PLAN_NOT_FOUND"
}