Get started
The MELE DATA API lets you sell mobile-data top-ups and airtime across every Nigerian network — MTN, Glo, Airtel, and 9mobile — straight from your backend. Token auth, idempotent retries, and a shared wallet that any of your apps can debit.
Token auth
Bearer token via X-API-Key or Authorization header.
Idempotent retries
Safe retries with unique reference strings.
Shared wallet
One balance debited per call — check it via /wallet/.
Data + Airtime
Buy data plans or send airtime in one API call.
Your first call — buy 1GB of MTN data:
curl --location 'https://meledata.ng/api/v1/developer/data/purchase' \
--header 'X-API-Key: mele_live_xxxxxxxxxxxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data '{
"network": "MTN",
"phone_number": "09012345678",
"plan_id": 1,
"reference": "order_001"
}'Overview
MELE DATA Developers gives you two product APIs:
- Data API — buy mobile data on MTN, Glo, Airtel, and 9mobile. Per-plan pricing, idempotent retries.
- Airtime API — send airtime to any Nigerian number. Per-network discounts for resellers.
- Wallet balance NEW — a lightweight
GET /wallet/that returns your current balance, so your backend can check funds before queuing a buy. - Status requery NEW —
GET /data/status/?ref=…to look up any past purchase.
Base URL: https://meledata.ng/api/v1/developer. All responses are JSON. Money is Naira (₦) with up to 2 decimal places.
Authentication
Pass your API key in any of these headers — whichever your HTTP client makes easiest:
X-API-Key: mele_live_xxxxxxxxxxxxxxxxxxxxxxxx # --or-- Authorization: Token mele_live_xxxxxxxxxxxxxxxxxxxxxxxx # --or-- Authorization: Bearer mele_live_xxxxxxxxxxxxxxxxxxxxxxxx
Each token belongs to a single MELE DATA user. The token identifies whose wallet gets debited.
⚠️ Security
Keep tokens out of source control. Generate one per environment and rotate immediately if leaked. Your secret key is only shown once when generated — store it safely.
Supported Networks
Use these exact string values for the network field:
Wallet balance
NEWCheck the balance your token can spend. Useful for showing a low-balance warning in your dashboard, gating a data buy before you call /data/purchase, or reconciling against your own ledger.
/wallet/Live + testcurl "https://meledata.ng/api/v1/developer/wallet/" \ -H "X-API-Key: $TOKEN"
{
"success": true,
"data": {
"balance": 14250.50,
"display": "₦14,250.50",
"currency": "NGN",
"livemode": true,
"mode": "live"
}
}| Field | Type | Notes |
|---|---|---|
| balance | number | Naira, up to 2 decimal places. |
| display | string | Pre-formatted for UI, e.g. "₦14,250.50". |
| currency | string | Always "NGN" today. |
| livemode | boolean | true for live tokens, false for test. |
| mode | string | "live" or "test" — convenience over livemode. |
Errors
Every non-2xx response uses the same envelope:
{
"success": false,
"error": "insufficient_balance",
"message": "Wallet balance is below the order total."
}| HTTP | error | When |
|---|---|---|
| 401 | invalid_token | Missing, expired, or revoked token. |
| 403 | account_inactive | Developer account is deactivated. |
| 404 | not_found | Plan, transaction, or endpoint doesn't exist. |
| 400 | invalid_request | Body validation failed; message explains. |
| 400 | insufficient_balance | Wallet is below the order total. |
| 409 | duplicate_reference | Reference was already used (idempotency). |
| 429 | rate_limited | Too many requests in this minute window. |
| 500 | server_error | Unexpected. Logged on our end; retry with backoff. |
Idempotency
Every POST purchase endpoint requires a unique reference string in the request body. Retry with the same reference and you get back the original response — no double-debit, no duplicate work.
{
"network": "MTN",
"phone_number": "09012345678",
"plan_id": 1,
"reference": "order-2026-06-27-7f3a" ← unique per purchase
}References are scoped per-token; reuse across tokens has no effect. Keep references under 80 characters.
Data API
Mobile data top-ups
Quickstart
One endpoint: POST /data/purchase. Pick a plan from the live catalog below, send it with the customer's mobile number, and we route the top-up through the carrier.
curl --location 'https://meledata.ng/api/v1/developer/data/purchase' \
--header 'X-API-Key: mele_live_xxxxxxxxxxxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data '{
"network": "MTN",
"phone_number": "09012345678",
"plan_id": 1,
"reference": "unique_ref_001"
}'Live plan catalog
Fetch all available plans programmatically via GET /data/plans. Use the plan_id column when calling POST /data/purchase.
/data/planscurl "https://meledata.ng/api/v1/developer/data/plans" \ -H "X-API-Key: $TOKEN"
{
"plans": [
{
"plan_id": 1,
"plan_code": "MTN_1GB_SME",
"network": "MTN",
"plan_name": "MTN SME 1GB",
"data_size": "1GB",
"validity": "30 days",
"price": 290.00
},
{
"plan_id": 5,
"plan_code": "GLO_2GB",
"network": "GLO",
"plan_name": "GLO 2GB",
"data_size": "2GB",
"validity": "30 days",
"price": 480.00
}
]
}| Field | Type | Notes |
|---|---|---|
| plan_id | int | Use this when calling POST /data/purchase. |
| plan_code | string | Human-readable plan code. |
| network | string | MTN, GLO, AIRTEL, or 9MOBILE. |
| plan_name | string | Display name of the plan. |
| data_size | string | e.g. "1GB", "500MB". |
| validity | string | e.g. "30 days", "7 days". |
| price | number | Your reseller price in Naira. |
POST /data/purchase
Idempotent/data/purchase{
"network": "MTN", // MTN, GLO, AIRTEL, 9MOBILE
"phone_number": "09012345678", // recipient
"plan_id": 1, // from GET /data/plans
"reference": "order_001" // unique per purchase
}{
"status": "success",
"reference": "DEV_DATA_order_001",
"amount": 290.00,
"message": "Transaction successful"
}{
"status": "failed",
"reference": "DEV_DATA_order_001",
"amount": 290.00,
"message": "Provider error: plan temporarily unavailable"
}| Field | Type | Notes |
|---|---|---|
| network | string | Required. MTN, GLO, AIRTEL, or 9MOBILE. |
| phone_number | string | Required. 11-digit Nigerian mobile number. |
| plan_id | int | Required. From the plan catalog. |
| reference | string | Required. Unique idempotency key (max 80 chars). |
✓ Auto-refund on failure
If the carrier rejects the top-up, your wallet is automatically refunded. The response will show status: "failed" with a human-readable message.
Status (requery)
NEWLook up the current state of a single data purchase you already made. Use this when the original POST /data/purchase response was delayed or you want to reconcile against your own ledger.
/data/status/?ref=DEV_DATA_…Live + testScope: a token only sees purchases it owns. Requests for a reference that belongs to another user return a clean 404.
curl "https://meledata.ng/api/v1/developer/data/status/?ref=DEV_DATA_order_001" \ -H "X-API-Key: $TOKEN"
{
"success": true,
"data": {
"reference": "DEV_DATA_order_001",
"status": "delivered",
"network": "MTN",
"mobile_number": "09012345678",
"plan": "MTN_1GB_SME",
"amount_charged": 290.00,
"message": "Data plan delivered to 09012345678 successfully.",
"purchased_at": "2026-06-27T10:58:02+00:00",
"queried_at": "2026-06-27T11:34:59+00:00",
"livemode": true,
"mode": "live"
}
}| Field | Type | Notes |
|---|---|---|
| reference | string | The reference from the original POST /data/purchase. |
| status | string | "delivered" or "failed". |
| network | string | Network of the purchase. |
| mobile_number | string | The recipient phone number. |
| plan | string | The plan code from the catalog. |
| amount_charged | number | Naira debited. 0 for failed transactions. |
| message | string | Human-readable summary, safe to show end users. |
| purchased_at | string | ISO 8601 UTC timestamp of the original purchase. |
| queried_at | string | ISO 8601 UTC timestamp of this requery call. |
Airtime API
Mobile airtime top-ups
POST /airtime/purchase
Idempotent/airtime/purchase{
"network": "MTN", // MTN, GLO, AIRTEL, 9MOBILE
"phone_number": "08098765432", // recipient
"amount": 500, // Naira (minimum ₦100)
"reference": "airtime_001" // unique per purchase
}{
"status": "success",
"reference": "DEV_AIRTIME_airtime_001",
"amount": 485.00,
"message": "Airtime topup succeeded"
}| Field | Type | Notes |
|---|---|---|
| network | string | Required. MTN, GLO, AIRTEL, or 9MOBILE. |
| phone_number | string | Required. 11-digit Nigerian mobile number. |
| amount | number | Required. Naira amount (minimum ₦100). |
| reference | string | Required. Unique idempotency key. |
💡 Reseller discounts
As a MELE DATA developer, you get reseller-tier pricing on airtime. The amount in the response reflects your discounted charge — not the face value sent to the customer.