REST API ยท JSON ยท HTTPS
GhanaDataHub REST API
Programmatically purchase data bundles across MTN, Telecel, AirtelTigo (iShare & BigTime) networks in Ghana. Simple, reliable, and fast.
Base URL https://ghanadatahub.net/api/v1
โœ“ Production Ready ๐Ÿ“„ JSON Responses ๐Ÿ”’ HTTPS Only โšก v1 Stable
๐Ÿ“– Introduction
The GhanaDataHub API lets you build reseller apps, automate data purchases, or integrate data bundles into existing platforms. All endpoints return JSON and require an API key.
๐Ÿš€ Quick Start (4 Steps)
1
Create a free account
Register at ghanadatahub.net/register โ€” takes under 2 minutes.
2
Fund your wallet
Add credit to your main wallet from the dashboard using Paystack (VISA, MasterCard, MoMo).
3
Generate your API key
Go to Profile โ†’ API Keys and generate a key. Keep it secret.
4
Make your first request
Use the examples below to test your key and start purchasing bundles programmatically.
cURL โ€” Quick Test
# Check your wallet balance to verify your API key
curl https://ghanadatahub.net/api/v1/balance \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Accept: application/json"
๐Ÿ”‘ Authentication
All API requests require your API key in the x-api-key header. Never expose your key in frontend or client-side code.
โš ๏ธ
Keep your API key secret. Treat it like a password. If compromised, regenerate it immediately from your dashboard.
Required Headers
HeaderValueDescription
x-api-keystringYour API key โ€” find it under Profile โ†’ API Keys
AcceptstringMust be application/json
Content-TypestringRequired for POST requests: application/json
Example Request Headers
x-api-key:       ghd_live_xxxxxxxxxxxxxxxxxxxxxxxx
Accept:          application/json
Content-Type:    application/json
GET Check Balance
Returns your current wallet balances โ€” main, referral and agent.
GET/api/v1/balanceNo body required
cURL
curl https://ghanadatahub.net/api/v1/balance \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Accept: application/json"
โ— 200 OK
Response
{
  "success": true,
  "balance": { "main": 150.00, "referral": 12.50, "agent": 30.00 },
  "currency": "GHS"
}
GET Get Networks
Returns all active networks available for data purchases. Use the network id to fetch bundles.
GET/api/v1/networks
cURL
curl https://ghanadatahub.net/api/v1/networks \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Accept: application/json"
โ— 200 OK
Response
{
  "success": true,
  "networks": [
    { "id": 1, "name": "MTN", "slug": "mtn", "color": "#FFC300", "delivery": "5-60 minutes", "bundles_count": 10 },
    { "id": 2, "name": "Telecel", "slug": "telecel", "color": "#E40032", "delivery": "5-60 minutes", "bundles_count": 6 },
    { "id": 3, "name": "AirtelTigo (iShare)", "slug": "airteltigo", "color": "#E40000", "delivery": "Instant", "bundles_count": 10 }
  ]
}
GET Get Bundles
Returns all active bundles for a specific network. Prices shown reflect your account's price group.
GET/api/v1/networks/{network_id}/bundles
Path Parameters
ParameterTypeRequiredDescription
network_idintegerRequiredNetwork ID from /networks (e.g. 1 = MTN)
cURL โ€” MTN Bundles
curl https://ghanadatahub.net/api/v1/networks/1/bundles \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Accept: application/json"
โ— 200 OK
Response
{
  "success": true, "network": "MTN",
  "bundles": [
    { "id": 10, "name": "1GB Data Bundle", "size": "1GB", "price": 5.39, "badge": "Non-Expiry", "is_active": true },
    { "id": 11, "name": "2GB Data Bundle", "size": "2GB", "price": 10.78, "badge": "Non-Expiry", "is_active": true }
  ]
}
POST Place Order
Purchase a data bundle for a Ghana phone number. The bundle price is deducted from your main wallet balance instantly.
โš ๏ธ
Double-check the phone number. Data is delivered immediately and there are no refunds for wrong numbers.
POST/api/v1/orders
Request Body (JSON)
ParameterTypeRequiredDescription
bundle_idintegerRequiredBundle ID from /networks/{id}/bundles
phone_numberstringRequiredGhana number โ€” 0XXXXXXXXX or 233XXXXXXXXX
referencestringOptionalYour own reference for tracking (max 100 chars)
cURL
curl https://ghanadatahub.net/api/v1/orders \
  -X POST \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{"bundle_id":10,"phone_number":"0244123456","reference":"MY-REF-001"}'
PHP (cURL)
$ch = curl_init('https://ghanadatahub.net/api/v1/orders');
curl_setopt_array($ch, [
  CURLOPT_POST=>true, CURLOPT_RETURNTRANSFER=>true,
  CURLOPT_HTTPHEADER=>['x-api-key: YOUR_API_KEY','Content-Type: application/json','Accept: application/json'],
  CURLOPT_POSTFIELDS=>json_encode(['bundle_id'=>10,'phone_number'=>'0244123456','reference'=>'MY-REF-001']),
]);
$res = json_decode(curl_exec($ch), true); curl_close($ch);
โ— 200 OK โ€” Success
Response โ€” Success
{
  "success": true, "message": "1GB data sent to 0244123456 successfully",
  "order": { "order_number": "ORD-XXXXXXXXXXX", "bundle": "MTN 1GB", "phone_number": "0244123456", "amount_paid": 5.39, "status": "successful" },
  "wallet_balance": 144.61
}
โ— 400 โ€” Insufficient Balance
Response โ€” Error
{ "success": false, "message": "Insufficient wallet balance", "balance": 2.50, "required": 5.39 }
GET Order Status
Check the real-time status of an order by its order number.
GET/api/v1/orders/{order_number}
cURL
curl https://ghanadatahub.net/api/v1/orders/ORD-XXXXXXXXXXX \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Accept: application/json"
โ— 200 OK
Response
{
  "success": true,
  "order": { "order_number": "ORD-XXXXXXXXXXX", "bundle": "MTN 1GB", "network": "MTN", "phone_number": "0244123456", "amount_paid": 5.39, "status": "successful", "created_at": "2026-10-07T10:00:00Z" }
}
โ„น๏ธ
Order Statuses: pending โ€” processing ยท successful โ€” delivered ยท failed โ€” failed (wallet refunded)
GET Order History
Returns a paginated list of your orders, newest first. Filter by status or network.
GET/api/v1/orders
Query Parameters
ParameterTypeRequiredDescription
pageintegerOptionalPage number (default: 1)
per_pageintegerOptionalItems per page โ€” max 50, default 20
statusstringOptionalFilter: pending, successful, failed
cURL โ€” Successful Orders
curl "https://ghanadatahub.net/api/v1/orders?status=successful&page=1" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Accept: application/json"
GET Profile
Returns your account details and current plan information.
GET/api/v1/profile
cURL
curl https://ghanadatahub.net/api/v1/profile \
  -H "x-api-key: YOUR_API_KEY"
โ— 200 OK
Response
{
  "success": true,
  "user": { "name": "Kwame Mensah", "email": "kwame@example.com", "username": "kwame123", "price_group": "Standard", "role": "user" }
}
โš ๏ธ Error Codes
All error responses return JSON with success: false and a descriptive message.
CodeStatusDescription
200OKRequest succeeded
400Bad RequestInvalid parameters, insufficient balance, or bundle unavailable
401UnauthorizedMissing or invalid API key in x-api-key header
404Not FoundOrder, network or bundle not found
422Validation ErrorRequest body failed validation โ€” check the errors field
429Rate LimitedToo many requests โ€” retry after 60 seconds
500Server ErrorInternal error โ€” contact support if it persists
๐Ÿšฆ Rate Limits
Requests are rate-limited per API key to prevent abuse. Exceeding limits returns a 429 response.
EndpointLimitWindow
All endpoints60 requestsPer minute
POST /orders10 ordersPer minute
GET /balance30 requestsPer minute
๐Ÿ’ก
Tip: Cache the /networks and /bundles responses locally for 30 minutes โ€” they rarely change and don't count toward your order limits.
๐Ÿช Webhooks Coming Soon
Webhooks will POST to your URL when order status changes โ€” no more polling needed.
When webhooks launch, you'll set your endpoint URL in your dashboard. We'll notify you when:
โ€ข Order status โ†’ successful (data delivered)
โ€ข Order status โ†’ failed (wallet refunded)
โ€ข Wallet funded or debited
๐Ÿ“ฆ Full Integration Example
A complete example showing how to list bundles and place an order in PHP and Python.
PHP โ€” Full Purchase Flow
PHP
$apiKey  = 'YOUR_API_KEY';
$baseUrl = 'https://ghanadatahub.net/api/v1';
function ghd($method, $path, $body = null) {
  global $apiKey, $baseUrl;
  $ch = curl_init($baseUrl . $path);
  curl_setopt_array($ch, [CURLOPT_CUSTOMREQUEST=>$method,CURLOPT_RETURNTRANSFER=>true,CURLOPT_HTTPHEADER=>['x-api-key: '.$apiKey,'Content-Type: application/json','Accept: application/json'],CURLOPT_POSTFIELDS=>$body?json_encode($body):null]);
  $res = json_decode(curl_exec($ch), true); curl_close($ch); return $res;
}
$bal     = ghd('GET',  '/balance');
$bundles = ghd('GET',  '/networks/1/bundles');
$order   = ghd('POST', '/orders', ['bundle_id'=>10,'phone_number'=>'0244123456']);
echo $order['message'];
Python โ€” Full Purchase Flow
Python
import requests
API_KEY  = 'YOUR_API_KEY'
BASE_URL = 'https://ghanadatahub.net/api/v1'
HEADERS  = {'x-api-key': API_KEY, 'Accept': 'application/json'}
bal     = requests.get(f'{BASE_URL}/balance', headers=HEADERS).json()
bundles = requests.get(f'{BASE_URL}/networks/1/bundles', headers=HEADERS).json()
order   = requests.post(f'{BASE_URL}/orders', headers={**HEADERS,'Content-Type':'application/json'}, json={'bundle_id':10,'phone_number':'0244123456'}).json()
print(order['message'])
๐Ÿš€
Ready to build?
Create a free account and get your API key in under 2 minutes.
Create Free Account โ†’
Already have an account? Login to get your API key โ†’