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:

cURLbash
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 NEWGET /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:

Authentication headersbash
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:

MTN
GLO
AIRTEL
9MOBILE

Wallet balance

NEW

Check 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.

GET/wallet/Live + test
Requestbash
curl "https://meledata.ng/api/v1/developer/wallet/" \
  -H "X-API-Key: $TOKEN"
ResponseJSON
{
  "success": true,
  "data": {
    "balance":  14250.50,
    "display":  "₦14,250.50",
    "currency": "NGN",
    "livemode": true,
    "mode":     "live"
  }
}
FieldTypeNotes
balancenumberNaira, up to 2 decimal places.
displaystringPre-formatted for UI, e.g. "₦14,250.50".
currencystringAlways "NGN" today.
livemodebooleantrue for live tokens, false for test.
modestring"live" or "test" — convenience over livemode.

Errors

Every non-2xx response uses the same envelope:

Error envelopeJSON
{
  "success": false,
  "error":   "insufficient_balance",
  "message": "Wallet balance is below the order total."
}
HTTPerrorWhen
401invalid_tokenMissing, expired, or revoked token.
403account_inactiveDeveloper account is deactivated.
404not_foundPlan, transaction, or endpoint doesn't exist.
400invalid_requestBody validation failed; message explains.
400insufficient_balanceWallet is below the order total.
409duplicate_referenceReference was already used (idempotency).
429rate_limitedToo many requests in this minute window.
500server_errorUnexpected. 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.

Example — reference-based idempotencyJSON
{
  "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.

cURLbash
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.

GET/data/plans
Syncing Live Catalog...
Requestbash
curl "https://meledata.ng/api/v1/developer/data/plans" \
  -H "X-API-Key: $TOKEN"
ResponseJSON
{
  "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
    }
  ]
}
FieldTypeNotes
plan_idintUse this when calling POST /data/purchase.
plan_codestringHuman-readable plan code.
networkstringMTN, GLO, AIRTEL, or 9MOBILE.
plan_namestringDisplay name of the plan.
data_sizestringe.g. "1GB", "500MB".
validitystringe.g. "30 days", "7 days".
pricenumberYour reseller price in Naira.

POST /data/purchase

Idempotent
POST/data/purchase
Request bodyJSON
{
  "network":      "MTN",           // MTN, GLO, AIRTEL, 9MOBILE
  "phone_number": "09012345678",   // recipient
  "plan_id":      1,               // from GET /data/plans
  "reference":    "order_001"      // unique per purchase
}
Response (success)JSON
{
  "status":    "success",
  "reference": "DEV_DATA_order_001",
  "amount":    290.00,
  "message":   "Transaction successful"
}
Response (failed — auto-refunded)JSON
{
  "status":    "failed",
  "reference": "DEV_DATA_order_001",
  "amount":    290.00,
  "message":   "Provider error: plan temporarily unavailable"
}
FieldTypeNotes
networkstringRequired. MTN, GLO, AIRTEL, or 9MOBILE.
phone_numberstringRequired. 11-digit Nigerian mobile number.
plan_idintRequired. From the plan catalog.
referencestringRequired. 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)

NEW

Look 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.

GET/data/status/?ref=DEV_DATA_…Live + test

Scope: a token only sees purchases it owns. Requests for a reference that belongs to another user return a clean 404.

Requestbash
curl "https://meledata.ng/api/v1/developer/data/status/?ref=DEV_DATA_order_001" \
  -H "X-API-Key: $TOKEN"
ResponseJSON
{
  "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"
  }
}
FieldTypeNotes
referencestringThe reference from the original POST /data/purchase.
statusstring"delivered" or "failed".
networkstringNetwork of the purchase.
mobile_numberstringThe recipient phone number.
planstringThe plan code from the catalog.
amount_chargednumberNaira debited. 0 for failed transactions.
messagestringHuman-readable summary, safe to show end users.
purchased_atstringISO 8601 UTC timestamp of the original purchase.
queried_atstringISO 8601 UTC timestamp of this requery call.

Airtime API

Mobile airtime top-ups

POST /airtime/purchase

Idempotent
POST/airtime/purchase
Request bodyJSON
{
  "network":      "MTN",           // MTN, GLO, AIRTEL, 9MOBILE
  "phone_number": "08098765432",   // recipient
  "amount":       500,             // Naira (minimum ₦100)
  "reference":    "airtime_001"    // unique per purchase
}
Response (success)JSON
{
  "status":    "success",
  "reference": "DEV_AIRTIME_airtime_001",
  "amount":    485.00,
  "message":   "Airtime topup succeeded"
}
FieldTypeNotes
networkstringRequired. MTN, GLO, AIRTEL, or 9MOBILE.
phone_numberstringRequired. 11-digit Nigerian mobile number.
amountnumberRequired. Naira amount (minimum ₦100).
referencestringRequired. 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.