URL: /api/dataapi
Methods: POST, GET
This API endpoint allows users to purchase mobile data for mobile phones and other internet enabled devices.
To access this endpoint, users must include their API key and secret key in the request headers.
See usage example in the code snippets below:
POST request to purchase data:
Content-Type: application/json
api-key: your-api-key
secret-key: your-secret-key
{
"phone": "08032566178",
"firstLevel": "MTN SME", // value of this key can either be firstLevel or fId, e.g. "mtn-sme" to avoid whitespace issue
"secondLevel": "1GB" // value of this key can either be secondLevel or sId, e.g. "1gb" to avoid whitespace issue
}
Response:
- Status Code: 200
{
"message": "Transaction successful",
"data": {
"transactionId": "1234567890",
"email": "user@example.com",
"activity": "MTN SME",
"message": "1GB",
"status": "Successful",
"recipient": "08032566178",
"amount": 240,
"initialBalance": 500,
"finalBalance": 260,
"Method": API,
}
}
{
"error": "Transaction failed",
"data": {
"transactionId": "1234567890",
"email": "user@example.com",
"activity": "MTN SME",
"message": "1GB",
"status": "Failed",
"recipient": "08032566178",
"amount": 240,
"initialBalance": 500,
"finalBalance": 500
"Method": API,
}
}
See usage example in the code snippets below:
GET request for available firstLevel and secondLevel:
Content-Type: application/json
api-key: your-api-key
secret-key: your-secret-key
Response:
- Status Code: 200
[
{
"available": true,
"firstLevel": "Mtn",
"fId": "mtn",
"amounts": [null],
"secondLevels": [
{
"available": true,
"secondLevel": "10gb",
"sId": "10gb",
"amounts": [4000]
},
{
"available": true,
"secondLevel": "20gb",
"sId": "20gb",
"amounts": [8000]
},
{
"available": true,
"secondLevel": "1gb",
"sId": "1gb",
"amounts": [3]
}
]
},
{
"available": true,
"firstLevel": "Glo",
"fId": "glo",
"amounts": [0],
"secondLevels": [
{
"available": true,
"secondLevel": "20gb",
"sId": "20gb",
"amounts": [7000]
}
]
},
{
"available": true,
"firstLevel": "MTN DIRECT PLAN",
"fId": "mtn-direct-plan",
"amounts": [null],
"secondLevels": [
{
"available": true,
"secondLevel": "1.2GB All Social Monthly",
"sId": "12gb-all-social-monthly",
"amounts": [490]
},
{
"available": true,
"secondLevel": "2GB+2mins Monthly Plan",
"sId": "2gb2mins-monthly-plan",
"amounts": [1480]
},
{
"available": true,
"secondLevel": "2.7GB+2mins Monthly Plan",
"sId": "27gb2mins-monthly-plan",
"amounts": [1970]
},
{
"available": true,
"secondLevel": "3.5GB+5mins Monthly Plan",
"sId": "35gb5mins-monthly-plan",
"amounts": [2470]
},
{
"available": true,
"secondLevel": "10GB + 10mins Monthly Plan",
"sId": "10gb-10mins-monthly-plan",
"amounts": [4420]
},
{
"available": true,
"secondLevel": "7GB Monthly Plan",
"sId": "7gb-monthly-plan",
"amounts": [3430]
},
{
"available": true,
"secondLevel": "12.5 Monthly Plan",
"sId": "125-monthly-plan",
"amounts": [5390]
},
{
"available": true,
"secondLevel": "20GB Monthly Plan",
"sId": "20gb-monthly-plan",
"amounts": [7350]
},
{
"available": true,
"secondLevel": "36GB Monthly Plan",
"sId": "36gb-monthly-plan",
"amounts": [10780]
},
{
"available": true,
"secondLevel": "75GB Monthly Plan",
"sId": "75gb-monthly-plan",
"amounts": [17650]
},
{
"available": true,
"secondLevel": "75mB",
"sId": "75mb",
"amounts": [75]
},
{
"available": true,
"secondLevel": "110MB",
"sId": "110mb",
"amounts": [100]
},
{
"available": true,
"secondLevel": "230MB",
"sId": "230mb",
"amounts": [200]
},
{
"available": true,
"secondLevel": "500MB",
"sId": "500mb",
"amounts": [350]
},
{
"available": true,
"secondLevel": "1GB+1.5mins Daily Plan",
"sId": "1gb15mins-daily-plan",
"amounts": [500]
},
{
"available": true,
"secondLevel": "1.5GB 2-Day Plan",
"sId": "15gb-2-day-plan",
"amounts": [590]
},
{
"available": true,
"secondLevel": "2GB 2-Day Plan",
"sId": "2gb-2-day-plan",
"amounts": [740]
},
{
"available": true,
"secondLevel": "2.5GB 2-Day Plan",
"sId": "25gb-2-day-plan",
"amounts": [890]
},
{
"available": true,
"secondLevel": "3.2GB 2-Day Plan",
"sId": "32gb-2-day-plan",
"amounts": [980]
},
{
"available": true,
"secondLevel": "7GB - 2 Days",
"sId": "7gb-2-days",
"amounts": [1780]
},
{
"available": true,
"secondLevel": "500MB Weekly Plan",
"sId": "500mb-weekly-plan",
"amounts": [500]
},
{
"available": true,
"secondLevel": "1GB Weekly Plan",
"sId": "1gb-weekly-plan",
"amounts": [790]
},
{
"available": true,
"secondLevel": "1.5GB Weekly Plan",
"sId": "15gb-weekly-plan",
"amounts": [980]
},
{
"available": true,
"secondLevel": "3.5GB Weekly Plan",
"sId": "35gb-weekly-plan",
"amounts": [1470]
},
{
"available": true,
"secondLevel": "6GB Weekly Plan",
"sId": "6gb-weekly-plan",
"amounts": [2450]
},
{
"available": true,
"secondLevel": "11GB Weekly plan",
"sId": "11gb-weekly-plan",
"amounts": [3450]
}
]
},
{
"available": true,
"firstLevel": "AIRTEL DIRECT Plan",
"fId": "airtel-direct-plan",
"amounts": [0],
"secondLevels": [
{
"available": true,
"secondLevel": "75MB",
"sId": "75mb",
"amounts": [75]
},
{
"available": true,
"secondLevel": "Daily Plan 100 - Data - 100MB",
"sId": "daily-plan-100-data-100mb",
"amounts": [100]
},
{
"available": true,
"secondLevel": "Daily Plan 200 - Data - 200MB",
"sId": "daily-plan-200-data-200mb",
"amounts": [200]
},
{
"available": true,
"secondLevel": "Daily Plan 300 - Data - 300MB",
"sId": "daily-plan-300-data-300mb",
"amounts": [300]
},
{
"available": true,
"secondLevel": "Social Plan 1GB (3 Days)",
"sId": "social-plan-1gb-3-days",
"amounts": [300]
},
{
"available": true,
"secondLevel": "(1 Day) - Data - 1GB",
"sId": "1-day-data-1gb",
"amounts": [500]
},
{
"available": true,
"secondLevel": "(2 Days) - Data - 1.5GB",
"sId": "2-days-data-15gb",
"amounts": [590]
},
{
"available": true,
"secondLevel": "Data - 2GB (2 Days)",
"sId": "data-2gb-2-days",
"amounts": [740]
},
{
"available": true,
"secondLevel": "Data - 3.2GB(2 Days)",
"sId": "data-32gb2-days",
"amounts": [980]
},
{
"available": true,
"secondLevel": "2GB - 2 Days",
"sId": "2gb-2-days",
"amounts": [750]
},
{
"available": true,
"secondLevel": "Weekly Plan 500 (7 Days) - Data - 500MB",
"sId": "weekly-plan-500-7-days-data-500mb",
"amounts": [500]
},
{
"available": true,
"secondLevel": "Weekly Plan (7 Days) - Data - 1GB",
"sId": "weekly-plan-7-days-data-1gb",
"amounts": [790]
},
{
"available": true,
"secondLevel": "Weekly Plan Data - 1.5GB",
"sId": "weekly-plan-data-15gb",
"amounts": [980]
},
{
"available": true,
"secondLevel": "Weekly Plan Data - 3.5GB",
"sId": "weekly-plan-data-35gb",
"amounts": [1470]
},
{
"available": true,
"secondLevel": "5GB Weekly Plan - 7 Day",
"sId": "5gb-weekly-plan-7-day",
"amounts": [1900]
},
{
"available": true,
"secondLevel": "Weekly Plan Data - 6GB",
"sId": "weekly-plan-data-6gb",
"amounts": [2450]
},
{
"available": true,
"secondLevel": "Weekly Plan Data - 10GB",
"sId": "weekly-plan-data-10gb",
"amounts": [2950]
},
{
"available": true,
"secondLevel": "Monthly Plan 3000 - Data - 8GB - 30 Days",
"sId": "monthly-plan-3000-data-8gb-30-days",
"amounts": [2940]
},
{
"available": true,
"secondLevel": "Monthly Plan 1500 - Data - 2GB",
"sId": "monthly-plan-1500-data-2gb",
"amounts": [1470]
},
{
"available": true,
"secondLevel": "Monthly Plan 2000 - Data - 3GB",
"sId": "monthly-plan-2000-data-3gb",
"amounts": [1960]
},
{
"available": true,
"secondLevel": "Monthly Plan 2500 - Data - 4GB",
"sId": "monthly-plan-2500-data-4gb",
"amounts": [2450]
},
{
"available": true,
"secondLevel": "Monthly Plan 4000 - Data - 10GB",
"sId": "monthly-plan-4000-data-10gb",
"amounts": [3920]
},
{
"available": true,
"secondLevel": "Weekly Plan 5000 - Data - 18GB",
"sId": "weekly-plan-5000-data-18gb",
"amounts": [4900]
},
{
"available": true,
"secondLevel": "Monthly Plan 5000 - Data - 13GB",
"sId": "monthly-plan-5000-data-13gb",
"amounts": [4900]
},
{
"available": true,
"secondLevel": "Monthly Plan 6000 - Data - 18GB",
"sId": "monthly-plan-6000-data-18gb",
"amounts": [5880]
},
{
"available": true,
"secondLevel": "Monthly Plan 8000 - Data - 25GB",
"sId": "monthly-plan-8000-data-25gb",
"amounts": [7840]
},
{
"available": true,
"secondLevel": "Monthly Plan 10000 - Data - 35GB",
"sId": "monthly-plan-10000-data-35gb",
"amounts": [9800]
},
{
"available": true,
"secondLevel": "Monthly Plan 15000 - Data - 60GB",
"sId": "monthly-plan-15000-data-60gb",
"amounts": [14700]
},
{
"available": true,
"secondLevel": "Monthly Plan 20000 - Data - 100GB",
"sId": "monthly-plan-20000-data-100gb",
"amounts": [19600]
},
{
"available": true,
"secondLevel": "Router - Unlimited 20.0 MBPS - 30 Days",
"sId": "router-unlimited-200-mbps-30-days",
"amounts": [29400]
}
]
}
]