← Developer Guides

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
curl -X GET https://{your-domain}/api/v1/data/networks \
  -H "Authorization: Bearer sk_live_your_secret_key"
JavaScript
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#

JSON
{
  "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
curl -X GET https://{your-domain}/api/v1/data/networks/mtn/plans \
  -H "Authorization: Bearer sk_live_your_secret_key"
JavaScript
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();
Python
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())
PHP
$response = Http::withToken('sk_live_your_secret_key')
    ->get('https://{your-domain}/api/v1/data/networks/mtn/plans');

Response#

JSON
{
  "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 amount is an integer in the smallest unit of the plan's currency (kobo for NGN, so 30000 = ₦300.00). The platform is multi-currency — use the plan's currency_code and 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
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"
  }'
JavaScript
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();
Python
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())
PHP
$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#

ParameterTypeRequiredDescription
phone_numberstringYesRecipient phone number in international format (must start with 234)
idempotency_keystringNoUnique 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):

JSON
{
  "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#

CodeError CodeDescription
402INSUFFICIENT_BALANCEWallet balance too low
404NETWORK_NOT_FOUNDNetwork slug not recognized
404PLAN_NOT_FOUNDPlan slug not found for this network
422Validation errorInvalid phone number format
429DAILY_LIMIT_REACHEDDaily transaction limit exceeded
429LIMIT_EXCEEDEDThe 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
409LIMIT_CHECK_BUSYAnother 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
400PROVIDER_REJECTEDThe network provider rejected the request
500ERRORInternal server error

Error Response Format#

JSON
{
  "success": false,
  "message": "Plan not found for this network",
  "code": "PLAN_NOT_FOUND"
}