MK
MK DATADocs
DocumentationREST API v1.0overview
1. Getting Started

MK DATA Developer Platform API

Welcome to the official MK DATA API documentation. Our REST service empowers fintech platforms, mobile apps, and VTU aggregators to vend automated Nigerian telecom data bundles, purchase airtime top-ups, and verify real-time status with sub-second execution speeds and wholesale agent rates.

Production Base URL:
https://mkdatasub.com/api/v1
2. Authentication

API Keys & Authorization Header

All API requests must include your live production key in the HTTP Authorization header using the standard Bearer scheme.

Authorization: Bearer mk_live_a1b2c3d4e5f60718293a4b5c...
Guaranteed Wholesale Agent Pricing

Every request authenticated with your API key automatically receives the discounted wholesale Agent Price from our database catalog, regardless of your consumer portal level.

3. Concurrency Protection

Idempotency-Key & Safe Retries

To prevent double-billing caused by network timeouts or dropped sockets, you can pass an Idempotency-Key header or provide a custom tx_id in your payload.

24-Hour Idempotency Cache

If a request is retried with the same transaction key within 24 hours, MK DATA returns the identical cached response with header X-Idempotent-Replay: true without debiting your wallet balance a second time.

4. Wallet & Account

Check Wallet Balance

GEThttps://mkdatasub.com/api/v1/balance

Returns your current live wallet balance and wholesale developer account tier.

cURL
curl -X GET "https://mkdatasub.com/api/v1/balance" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response (200 OK)
{
  "success": true,
  "balance": 24500.00,
  "currency": "NGN",
  "tier": "agent",
  "pricing": "wholesale"
}
5. Catalog

List Active Data Plans

GEThttps://mkdatasub.com/api/v1/data/plans

Retrieves all active data plans with their numeric plan_id, numeric network code, and real-time wholesale agent prices. Optional query parameter ?network=1|2|3|4 filters the catalog.

cURL
curl -X GET "https://mkdatasub.com/api/v1/data/plans?network=1" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response (200 OK)
{
  "success": true,
  "count": 48,
  "data": [
    {
      "plan_id": 82,
      "network": 1,
      "network_name": "MTN",
      "name": "MTN SME 1GB",
      "type": "SME",
      "size": "1GB",
      "validity": "30 Days",
      "price": 285.00
    },
    {
      "plan_id": 83,
      "network": 1,
      "network_name": "MTN",
      "name": "MTN SME 2GB",
      "type": "SME",
      "size": "2GB",
      "validity": "30 Days",
      "price": 570.00
    }
  ]
}
6. Vending

Purchase Mobile Data

POSThttps://mkdatasub.com/api/v1/data/purchase
Mandatory: Numeric Network Codes

The network field must always be an integer number, not a text string:

MTN1
GLO2
AIRTEL3
9MOBILE4
Request Payload Body (JSON)
FieldTypeRequirementDescription
networkintegerRequiredNumeric ID: 1 (MTN), 2 (GLO), 3 (AIRTEL), 4 (9MOBILE).
plan_idintegerRequiredNumeric plan ID from the database catalog (e.g. 82, 5, 174).
numberstringRequired11-digit recipient phone number (e.g. "08012345678").
tx_idstringRecommendedYour unique merchant reference for idempotency tracking and status query.
cURL
curl -X POST "https://mkdatasub.com/api/v1/data/purchase" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "network": 1,
    "plan_id": 82,
    "number": "08012345678",
    "tx_id": "MKD-TX-171800123456"
  }'
Response (200 OK)
{
  "success": true,
  "status": "SUCCESS",
  "reference": "MKD-DATA-171800123456",
  "requestId": "MKD-TX-171800123456",
  "amount": 285.00,
  "balance": 10215.00,
  "phone": "08012345678",
  "network": 1,
  "network_name": "MTN",
  "plan": "MTN SME 1GB",
  "message": "Data vending successful."
}
7. Vending

Purchase Airtime Top-Up

POSThttps://mkdatasub.com/api/v1/airtime/purchase

Instantly credit airtime to any Nigerian phone number. Accepts numeric network: 1 (MTN), 2 (GLO), 3 (AIRTEL), or 4 (9MOBILE).

cURL
curl -X POST "https://mkdatasub.com/api/v1/airtime/purchase" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "network": 1,
    "amount": 1000,
    "number": "08012345678",
    "tx_id": "MKD-AIR-171800998877"
  }'
Response (200 OK)
{
  "success": true,
  "status": "SUCCESS",
  "reference": "MKD-AIR-171800998877",
  "amount_charged": 970.00,
  "discount_applied": 30.00,
  "new_balance": 9245.00,
  "phone": "08012345678",
  "network": 1,
  "network_name": "MTN"
}
8. Requery

Requery Transaction Status

GEThttps://mkdatasub.com/api/v1/transactions/:reference

Query the final state of any transaction by passing your MK DATA reference or client-side request_id.

curl -X GET "https://mkdatasub.com/api/v1/transactions/MKD-DATA-171800123456" \
  -H "Authorization: Bearer YOUR_API_KEY"
9. Webhooks

HMAC Signature Verification

Every webhook notification sent to your configured endpoint includes a signature header: X-MK-Signature: t=1718000000,v1=abc123.... Verify this signature to ensure payloads are authentic and unhampered:

import crypto from "crypto";

export function verifyWebhook(secret: string, signatureHeader: string, rawBody: string): boolean {
  const parts = signatureHeader.split(",");
  const timestamp = parts.find((p) => p.startsWith("t="))?.replace("t=", "");
  const signature = parts.find((p) => p.startsWith("v1="))?.replace("v1=", "");

  if (!timestamp || !signature) return false;

  const signedPayload = `${timestamp}.${rawBody}`;
  const expected = crypto.createHmac("sha256", secret).update(signedPayload).digest("hex");

  return crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected));
}
10. Reference

Numeric Network Codes Reference Table

All API mutation payloads require the network to be specified as an integer code. Refer to this canonical table:

Network NameNumeric ID (Integer)Supported Vending TypesStatus
MTN Nigeria1SME, Corporate Gifting, Gifting, AirtimeOperational
Globacom (GLO)2Corporate Gifting, AirtimeOperational
Airtel Nigeria3Corporate Gifting, AirtimeOperational
9mobile Nigeria4Corporate Gifting, AirtimeOperational
11. Errors

HTTP Status & Error Reference

StatusError CodeDescriptionRemediation
400BAD_REQUESTValidation failure (e.g. invalid phone number format or missing plan ID).Check payload structure and phone regex.
401UNAUTHORIZEDMissing or revoked API key in Authorization header.Regenerate live key in Developer Keys tab.
402INSUFFICIENT_FUNDSAccount balance is lower than wholesale purchase cost.Fund developer wallet via virtual account.
409CONCURRENT_MUTATIONAnother purchase transaction is currently locking this wallet.Retry request with exponential backoff.
429RATE_LIMIT_EXCEEDEDExceeded standard limit of 60 requests/minute.Throttle batch throughput.
Need integration support? Contact our technical engineering team at support@mkdatasub.com.
Browse Live Plan IDs