Developer API · Data API
Data API for MTN, Airtel and Glo bundles
Fetch every plan we sell with its API price, then buy a bundle for any number with one request. Gifting, SME (Datashare), corporate and awoof plans all come through the same endpoint.
- REST and JSON
- Bearer API key
- Refund on every failed purchase
/v1/data/purchase{
"plan_id": "mtn_1gb_30d",
"phone": "08012345678",
"request_ref": "3c9e7d22-5a1b-4f6e-8d2c-1e2f3a4b5c6d"
}Endpoints
All requests go to https://api.vtuagent.com with your key in the Authorization header.
Example request
POST /v1/data/purchase, in the language your site is built with.
curl -X POST https://api.vtuagent.com/v1/data/purchase \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"plan_id": "mtn_1gb_30d",
"phone": "08012345678",
"request_ref": "3c9e7d22-5a1b-4f6e-8d2c-1e2f3a4b5c6d"
}'const res = await fetch('https://api.vtuagent.com/v1/data/purchase', {
method: 'POST',
headers: {
Authorization: 'Bearer ' + process.env.VTUAGENT_API_KEY,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"plan_id": "mtn_1gb_30d",
"phone": "08012345678",
"request_ref": "3c9e7d22-5a1b-4f6e-8d2c-1e2f3a4b5c6d"
}),
});
const result = await res.json();$ch = curl_init('https://api.vtuagent.com/v1/data/purchase');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('VTUAGENT_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'plan_id' => 'mtn_1gb_30d',
'phone' => '08012345678',
'request_ref' => '3c9e7d22-5a1b-4f6e-8d2c-1e2f3a4b5c6d',
]),
]);
$result = json_decode(curl_exec($ch), true);import os, requests
res = requests.post(
"https://api.vtuagent.com/v1/data/purchase",
headers={"Authorization": f"Bearer {os.environ['VTUAGENT_API_KEY']}"},
json={
"plan_id": "mtn_1gb_30d",
"phone": "08012345678",
"request_ref": "3c9e7d22-5a1b-4f6e-8d2c-1e2f3a4b5c6d"
},
)
result = res.json()Response
{
"status": "successful",
"status_code": 200,
"message": "Data purchase successful - MTN 1GB (SME) for 08012345678",
"reference": "3c9e7d22-5a1b-4f6e-8d2c-1e2f3a4b5c6d",
"data": {
"amount": "270",
"phone": "08012345678",
"plan": "MTN 1GB (SME)"
}
}How it behaves
You never send a price
The amount comes from your account’s API price for that plan_id, so a stale price in your app can’t undercharge or overcharge.
Answer within 15 seconds
The request waits up to 15 seconds for the network. If it’s slower you get 202 pending, and the result arrives by webhook or from the status endpoint.
Charged once, refunded on failure
Your wallet is debited when the request is accepted. If the provider rejects the purchase you get HTTP 424 and the money is already back in your wallet.
Safe to retry
Every purchase carries your own request_ref (a UUID works). Sending the same reference twice is rejected with 400, so a retry after a timeout can’t charge you twice.
API data prices today
What an API account pays for the cheapest plan of each size, straight from our price list. Every plan is returned by GET /v1/data/plans.
| Size | MTN | Airtel | Glo |
|---|---|---|---|
| 1GB | ₦414.40 | ₦777.60 | ₦271.70 |
| 2GB | ₦727.50 | ₦583.20 | ₦830 |
| 5GB | ₦1,904 | ₦1,458.01 | ₦1,410.75 |
| 10GB | ₦4,365 | ₦2,810 | ₦1,870 |
Get your API key
- Step 1
Create an account
Sign up for free with your email.
- Step 2
Apply for API access
On Upgrade Account, choose API User and add the website or app you’ll connect.
- Step 3
Get your key
Once you’re approved, generate your key in Settings → API Keys. Send it as Authorization: Bearer <key> on every request.
- Step 4
Fund your wallet
Purchases are paid from your wallet balance at API prices, so top it up by bank transfer or card.
Questions people ask
Which networks does the data API support?
MTN, Airtel and Glo. GET /v1/data/plans returns every plan currently on sale, with the plan_id to buy it.
Does the API include SME data?
Yes. MTN Datashare (often called SME data), Glo corporate gifting, gifting and awoof plans are all in the plan list, each with its own plan_id.
How do I know if a data purchase succeeded?
Most purchases return 200 successful in the same request. If the network takes longer than 15 seconds you get 202 pending, then a data.purchase.success or data.purchase.failed webhook, or you can poll POST /v1/transaction/status.
What does the data API cost?
There is no monthly fee. You pay the API price for each bundle from your wallet. API prices are the lowest of our three account types.
Other APIs
Start selling with the Data API
Apply for API access, then follow the docs at docs.vtuagent.com.
