Architecture & Overview
Single Unified Telecom REST Contract
The SaukiMart Developer API standardizes instant mobile data bundle delivery across MTN, Airtel, Glo, and 9Mobile. Every carrier shares one uniform request schema, atomic wallet deduction with idempotency protection, and real-time webhook callbacks.
| Base Production URL | https://saukimart.com |
| Sandbox Base URL | https://saukimart.com/api/v1/test |
| Data Format | JSON (Content-Type: application/json) |
| Authentication | Header: x-api-key: sm_live_... / sm_test_... |
| Default Rate Limit | 90 requests / minute per API key (configurable up to 600) |
Quickstart
4 Steps to Production Fulfillment
Go from account registration to verified sandbox testing and live carrier fulfillment in minutes.
Sign up or sign in to auto-provision sandbox (sm_test_...) and live (sm_live_...) API keys.
Call GET /api/v1/data-plans to retrieve planCode values, validity, and wholesale rates.
Send POST /api/v1/purchase-data with recipient phoneNumber, planCode, network, and idempotencyKey.
Configure your HTTPS webhook endpoint to verify completion events in real time.
Inspect Master Developer Prompt
You are a Senior Full-Stack Software Engineer. Your task is to integrate the SaukiMart Telecom Data & Airtime API into our application backend.
### Context & Goal
SaukiMart (https://saukimart.com) provides a unified REST API for instant mobile data bundle vending across all 4 major Nigerian telecom networks (MTN, Airtel, Glo, 9Mobile).
### Base Configuration
- Base URL: https://saukimart.com
- Sandbox Base URL: https://saukimart.com/api/v1/test
- Authentication: Pass the secret API key in the 'x-api-key' HTTP header.
- Headers required:
- x-api-key: sm_live_9a8b7c6d5e4f...
- Content-Type: application/json
### Core Endpoints to Implement
1. Fetch Data Plans (GET /api/v1/data-plans)
- Method: GET
- URL: https://saukimart.com/api/v1/data-plans
- Headers: x-api-key: <KEY>
- Response: Returns array of active plans with 'code' (numeric plan ID), 'network' (MTN, AIRTEL, GLO, 9MOBILE), 'dataSize', 'validity', and 'developerPrice'.
2. Purchase Mobile Data Bundle (POST /api/v1/purchase-data)
- Method: POST
- URL: https://saukimart.com/api/v1/purchase-data
- Request Body:
{
"phoneNumber": "08012345678",
"planCode": 23,
"network": 1,
"idempotencyKey": "unique_uuid_per_order"
}
* Note on network ID: 1 = MTN, 2 = Glo, 3 = 9Mobile, 4 = Airtel.
* Note on idempotencyKey: Always pass a unique UUID per transaction to guarantee at most single debit.
3. Query Transaction Receipt (GET /api/v1/transactions)
- Method: GET
- URL: https://saukimart.com/api/v1/transactions?limit=20
- Query by Idempotency Key: https://saukimart.com/api/v1/transactions?idempotencyKey=unique_uuid_per_order
4. Webhook Callback Listener (POST /api/webhooks/saukimart)
- Setup an endpoint in our app to receive delivery event webhooks:
{
"event": "developer.purchase.completed",
"transactionId": "tx_uuid",
"status": "success",
"planCode": 23,
"phoneNumber": "08012345678",
"amount": 332.50,
"timestamp": "2026-08-19T03:00:00Z"
}
### Error Handling & Reliability
- HTTP 402: Handle INSUFFICIENT_FUNDS (prompt admin/user that developer wallet needs funding).
- HTTP 429: Respect Retry-After header and apply exponential backoff.
- On network timeout, retry with the EXACT SAME idempotencyKey so the wallet is debited at most once.
- Sandbox testing: Phone number 08012345678 simulates instant success with ₦0 debit.
Please write clean, modular, production-ready code with error handling and environment variable configuration for our stack.# 1. Fetch available data plans across MTN, Airtel, Glo & 9Mobile $curl -X GET "https://saukimart.com/api/v1/data-plans" \ -H "x-api-key: sm_live_9a8b7c6d5e4f..." # 2. Purchase data bundle with idempotency protection $curl -X POST "https://saukimart.com/api/v1/purchase-data" \ -H "Content-Type: application/json" \ -H "x-api-key: sm_live_9a8b7c6d5e4f..." \ -d '{ "phoneNumber": "08012345678", "planCode": 23, "network": 1, "idempotencyKey": "req_8f19e7a2b" }'
Security & Auth
API Key Authentication
Every /api/v1/* request requires your secret API key in the x-api-key HTTP header. Keys are scoped per environment (sm_live_ vs sm_test_), encrypted at rest with AES-256-GCM plus SHA-256 hash verification, and support per-key IP allowlisting.
| Header | Format | Description |
|---|---|---|
| x-api-key | sm_live_<prefix>_<secret> | Production key — debits live developer wallet balance |
| x-api-key | sm_test_<prefix>_<secret> | Sandbox key — ₦0 simulated fulfillment responses |
| Content-Type | application/json | Required for all POST requests |
$curl -X GET "https://saukimart.com/api/v1/data-plans" \ -H "x-api-key: sm_live_9a8b7c6d5e4f..."
{
"success": false,
"error": "A valid API key is required. Pass your key in the x-api-key header.",
"code": "INVALID_API_KEY",
"statusCode": 401,
"requestId": "req_a1b2c3d4"
}| Scope | Grants Access To |
|---|---|
read:plans | GET /api/v1/data-plans, GET /api/v1/me, GET /api/v1/wallet/balance |
write:purchases | POST /api/v1/purchase-data |
read:transactions | GET /api/v1/transactions, GET /api/v1/transactions/:id |
Endpoint 01 · Account
Get User Profile
Returns the authenticated developer's profile details, virtual bank funding account details, and API key metadata.
/api/v1/meread:plans$curl -X GET "https://saukimart.com/api/v1/me" \ -H "x-api-key: sm_live_9a8b7c6d5e4f..."
{
"success": true,
"version": "2026-04-17",
"requestId": "req_a1b2c3d4",
"user": {
"id": "usr_uuid_12345",
"firstName": "David",
"lastName": "Adeleke",
"phone": "08012345678",
"isDeveloper": true,
"developerDiscountPercent": 5,
"accountNumber": "7821234567",
"bankName": "Flutterwave MFB",
"phoneVerified": true,
"phoneVerifiedAt": "2026-06-15T10:30:00Z",
"createdAt": "2026-05-01T08:00:00Z"
},
"environment": "live",
"keyName": "production-server",
"scopes": [
"read:plans",
"write:purchases",
"read:transactions"
]
}| Field | Type | Description |
|---|---|---|
user.id* | string | Unique user identifier (UUID) |
user.firstName* | string | Developer first name |
user.lastName* | string | Developer last name |
user.phone* | string | 11-digit registered phone number |
user.developerDiscountPercent* | number | Wholesale discount tier percentage |
user.accountNumber | string | null | Dedicated virtual bank account for instant wallet funding |
user.bankName | string | null | Issuing bank name for the virtual account |
environment* | string | Active key environment ("live" or "test") |
scopes* | string[] | Permissions granted to the active API key |
Endpoint 02 · Account
Fetch Wallet Balance
Returns the current NGN wallet balance for the authenticated developer account. Check before vending to prevent 402 INSUFFICIENT_FUNDS errors.
/api/v1/wallet/balanceread:plans$curl -X GET "https://saukimart.com/api/v1/wallet/balance" \ -H "x-api-key: sm_live_9a8b7c6d5e4f..."
{
"success": true,
"version": "2026-04-17",
"requestId": "req_e5f6g7h8",
"wallet": {
"balance": 125430.5,
"currency": "NGN",
"lastUpdated": "2026-08-19T14:30:00Z"
},
"environment": "live"
}| Field | Type | Description |
|---|---|---|
wallet.balance* | number | Available wallet credit balance in NGN |
wallet.currency* | string | Currency code ("NGN") |
wallet.lastUpdated* | ISO 8601 | Timestamp of last wallet ledger update |
- Call this endpoint before batch vending jobs to monitor balance availability.
- Transfers into your dedicated virtual bank account credit your wallet automatically.
Plan Catalog · Live ISR Snapshot
Wholesale & Developer Rates
Pass the numeric planCode shown below into POST /api/v1/purchase-data. Query GET /api/v1/data-plans for your complete live catalog.
MTN
| Code | Size | Valid | Dev Rate |
|---|---|---|---|
77 | 200MB | 7d | ₦150.00 |
56 | 500MB | 7d | ₦230.00 |
57 | 1GBPopular | 7d | ₦400.00 |
51 | 1GB | 30d | ₦500.00 |
58 | 2GB | 7d | ₦750.00 |
52 | 2GB | 30d | ₦850.00 |
GLO
| Code | Size | Valid | Dev Rate |
|---|---|---|---|
65 | 1.5GB | 1d | ₦350.00 |
60 | 1GBPopular | 3d | ₦400.00 |
61 | 3GB | 3d | ₦1,200.00 |
62 | 5GB | 3d | ₦2,000.00 |
63 | 5GB | 7d | ₦2,000.00 |
64 | 5GB | 30d | ₦2,200.00 |
AIRTEL
| Code | Size | Valid | Dev Rate |
|---|---|---|---|
67 | 600MB (Sme) | 2d | ₦300.00 |
68 | 1GB (Sme Social) | 3d | ₦350.00 |
66 | 1.5GB | 1d | ₦499.00 |
69 | 2GB (Sme) | 2d | ₦700.00 |
72 | 1GB (Gifting) | 7d | ₦900.00 |
70 | 3GB (Sme) | 2d | ₦1,000.00 |
Endpoint 03 · Core Data API
Fetch Available Data Plans
Returns all active mobile data bundles across MTN, Airtel, Glo, and 9Mobile with exact wholesale pricing computed for your developer account.
/api/v1/data-plansread:plans$curl -X GET "https://saukimart.com/api/v1/data-plans" \ -H "x-api-key: sm_live_9a8b7c6d5e4f..."
{
"success": true,
"version": "2026-04-17",
"requestId": "req_dp_10293847",
"discountPercent": 5,
"plans": [
{
"code": 23,
"network": "MTN",
"networkId": 1,
"planId": 201,
"dataSize": "1GB",
"validity": "30 Days",
"appPrice": 350,
"developerPrice": 332.5
},
{
"code": 24,
"network": "MTN",
"networkId": 1,
"planId": 202,
"dataSize": "2GB",
"validity": "30 Days",
"appPrice": 700,
"developerPrice": 665
},
{
"code": 31,
"network": "GLO",
"networkId": 2,
"planId": 301,
"dataSize": "1GB",
"validity": "30 Days",
"appPrice": 399,
"developerPrice": 379.05
},
{
"code": 41,
"network": "AIRTEL",
"networkId": 4,
"planId": 401,
"dataSize": "1GB",
"validity": "30 Days",
"appPrice": 760,
"developerPrice": 722
}
]
}| Field | Type | Description |
|---|---|---|
code* | integer | Numeric planCode passed into POST /api/v1/purchase-data |
network* | string | Carrier label: MTN, AIRTEL, GLO, or 9MOBILE |
networkId* | integer | Carrier code: 1=MTN, 2=Glo, 3=9Mobile, 4=Airtel |
dataSize* | string | Bundle capacity (e.g. 500MB, 1GB, 5GB) |
validity* | string | Bundle validity window (e.g. "30 Days") |
developerPrice* | number | Wholesale amount in NGN debited from your wallet |
appPrice* | number | Retail app price in NGN |
- Cache the returned catalog for 5–15 minutes to keep checkout pages instantaneous.
- Always pass the integer code property as planCode when calling /api/v1/purchase-data.
Endpoint 04 · Core Data API
Purchase Mobile Data Bundle
Executes instant automated data delivery to a Nigerian MSISDN. Protected by database-enforced idempotency to guarantee at most one debit per order.
/api/v1/purchase-datawrite:purchases$curl -X POST "https://saukimart.com/api/v1/purchase-data" \ -H "Content-Type: application/json" \ -H "x-api-key: sm_live_9a8b7c6d5e4f..." \ -d '{ "phoneNumber": "08012345678", "planCode": 23, "network": 1, "idempotencyKey": "order_uuid_98f12a4c" }'
{
"success": true,
"status": "success",
"transactionId": "tx_a8f9c0e2_1948",
"idempotencyKey": "order_uuid_98f12a4c",
"data": {
"planCode": 23,
"network": "MTN",
"phoneNumber": "08012345678",
"dataSize": "1GB",
"deliveryReference": "AMG-987654321"
},
"developerPrice": 332.5,
"newBalance": 125098,
"timestamp": "2026-08-21T14:30:00Z"
}| Field | Type | Description |
|---|---|---|
phoneNumber* | string | 11-digit Nigerian recipient number (e.g. "08012345678") |
planCode* | integer | Numeric plan code returned by GET /api/v1/data-plans |
network* | integer | 1 = MTN, 2 = Glo, 3 = 9Mobile, 4 = Airtel |
idempotencyKey* | string | Unique UUIDv4 per order to prevent double debits on retry |
- Always reuse the exact same idempotencyKey when retrying after a network timeout.
- Sandbox mode: phoneNumber "08012345678" (or any sm_test_ key) simulates delivery at ₦0 cost.
Endpoint 05 · Reconciliation
Query Transaction History
Retrieve paginated developer transactions, carrier references, and wholesale deductions. Supports filtering by status, transactionId, or idempotencyKey.
/api/v1/transactionsread:transactions$curl -X GET "https://saukimart.com/api/v1/transactions?limit=20&status=success" \ -H "x-api-key: sm_live_9a8b7c6d5e4f..."
{
"success": true,
"version": "2026-04-17",
"requestId": "req_tx_query_9812",
"transactions": [
{
"id": "dev_tx_01",
"transactionId": "tx_a8f9c0e2_1948",
"status": "success",
"phoneNumber": "08012345678",
"network": "MTN",
"planCode": "23",
"planName": "MTN 1GB (30 Days)",
"developerPrice": 332.5,
"appPrice": 350,
"idempotencyKey": "order_uuid_98f12a4c",
"amigoReference": "AMG-987654321",
"createdAt": "2026-08-21T14:30:00Z"
}
]
}| Field | Type | Description |
|---|---|---|
limit | query integer | Maximum records returned (default: 50, max: 200) |
status | query string | Filter status ("success", "pending", "failed") |
idempotencyKey | query string | Filter by original idempotency key |
transactionId | query string | Filter by SaukiMart transaction ID |
- Schedule automated ledger reconciliation jobs using limit and idempotencyKey filters.
Endpoint 06 · Reconciliation
Query Individual Transaction
Inspect a single transaction receipt by Transaction ID, database UUID, or your client idempotencyKey to recover cleanly from request timeouts.
/api/v1/transactions/:idread:transactions$curl -X GET "https://saukimart.com/api/v1/transactions/order_uuid_98f12a4c" \ -H "x-api-key: sm_live_9a8b7c6d5e4f..."
{
"success": true,
"version": "2026-04-17",
"requestId": "req_single_tx_5544",
"transaction": {
"id": "dev_tx_uuid_1029",
"transactionId": "tx_a8f9c0e2_1948",
"status": "success",
"transactionStatus": "COMPLETED",
"phoneNumber": "08012345678",
"network": "MTN",
"planCode": "23",
"planName": "MTN 1GB (30 Days)",
"developerPrice": 332.5,
"appPrice": 350,
"idempotencyKey": "order_uuid_98f12a4c",
"amigoReference": "AMG-987654321",
"rawStatus": "SUCCESSFUL",
"endpoint": "/api/v1/purchase-data",
"message": "Data bundle successfully delivered to recipient",
"createdAt": "2026-08-21T14:30:00Z"
},
"environment": "live"
}| Field | Type | Description |
|---|---|---|
:id (path)* | string | Transaction ID, internal UUID, or idempotencyKey |
transaction.status* | string | "success", "pending", or "failed" |
transaction.amigoReference | string | null | Upstream carrier fulfillment reference |
transaction.developerPrice* | number | Exact wholesale debit in NGN |
- Always query this endpoint with your original idempotencyKey after any network timeout before issuing a replacement purchase.
- For "pending" responses, poll with backoff (5s, 15s, 30s) or listen for webhooks.
Webhooks & Events
Real-time Delivery Webhooks
Configure a public HTTPS webhook endpoint per API key inside the Developer Console. SaukiMart sends signed HTTP POST callbacks whenever fulfillment transitions or wallet balance thresholds trigger.
{
"event": "developer.purchase.completed",
"transactionId": "tx_a8f9c0e2_1948",
"status": "success",
"planCode": 23,
"network": "MTN",
"phoneNumber": "08012345678",
"dataSize": "1GB",
"amount": 332.5,
"idempotencyKey": "order_uuid_98f12a4c",
"timestamp": "2026-08-21T14:30:05.000Z"
}| Event | Trigger Condition | Expected Action |
|---|---|---|
developer.purchase.completed | Carrier confirmed data bundle delivered to recipient | Mark order completed in your system and notify end-user |
developer.purchase.failed | Carrier rejected fulfillment or invalid number | Refund end-user or prompt to re-enter phone number |
developer.wallet.low_balance | Developer wallet balance fell below threshold (₦5,000) | Alert finance team to fund developer wallet |
Every callback includes the X-SaukiMart-Webhook-Secret header matching the signing secret configured on your key in the Developer Console.
// Express / Node.js Webhook Handler app.post('/api/webhooks/saukimart', (req, res) => { const secret = req.headers['x-saukimart-webhook-secret']; if (secret !== process.env.SAUKIMART_WEBHOOK_SECRET) { return res.status(401).send('Unauthorized'); } const { event, transactionId, status } = req.body; if (event === 'developer.purchase.completed') { // Mark fulfillment completed for transactionId (status) } res.status(200).json({ received: true }); });
Reference & Diagnostics
HTTP Status Codes & Error Matrix
Failed requests return deterministic JSON error envelopes with machine-readable error codes and a unique requestId.
{
"success": false,
"error": "Insufficient wallet balance to fulfill purchase",
"code": "INSUFFICIENT_FUNDS",
"statusCode": 402,
"requestId": "req_98f12a",
"timestamp": "2026-08-21T14:30:00.000Z"
}| HTTP Status | Error Code | Description | Recommended Action |
|---|---|---|---|
| 200 OK | SUCCESS | Purchase executed and bundle vended successfully. | Parse transactionId and store confirmation in your database. |
| 400 Bad Request | INVALID_PARAMS | Missing required fields (phoneNumber, planCode, or network). | Ensure request body satisfies schema requirements. |
| 401 Unauthorized | INVALID_API_KEY | x-api-key header is missing, expired, or invalid. | Verify your key credentials in the Developer Console. |
| 402 Payment Required | INSUFFICIENT_FUNDS | Wallet balance is lower than developer wholesale price. | Fund your Sauki developer wallet via virtual bank transfer. |
| 404 Not Found | PLAN_NOT_FOUND | The specified planCode does not exist for this network. | Query GET /api/v1/data-plans for active bundles. |
| 404 Not Found | TRANSACTION_NOT_FOUND | No transaction matching the provided ID or idempotency key. | Check reference string or verify transaction belongs to this key. |
| 409 Conflict | DUPLICATE_IDEMPOTENCY_KEY | A purchase with this idempotencyKey was already processed. | Query GET /api/v1/transactions/:id to inspect original status. |
| 422 Unprocessable | INVALID_PHONE_NUMBER | Recipient phone number is invalid (must be 11-digit Nigerian MSISDN). | Validate 11-digit phone format before sending. |
| 429 Too Many Requests | RATE_LIMIT_EXCEEDED | Exceeded 90 requests/minute throughput. | Read Retry-After header and apply exponential backoff. |
| 502 Bad Gateway | PROVIDER_DOWN | Upstream telecom carrier switch is temporarily unreachable. | Retry with the EXACT SAME idempotencyKey after a short delay. |
| 503 Unavailable | MAINTENANCE | Carrier bundle network is undergoing scheduled maintenance. | Check carrier status and retry during operational windows. |
Architecture Reference
Rate Limiting & Idempotency Rules
Reliability primitives protect your wallet ledger against duplicate retries and sudden traffic bursts.
Every POST /api/v1/purchase-data call enforces an atomic idempotencyKey. Retrying a timed-out request with the exact same key replays the original outcome without billing your wallet twice.
Keys default to 90 requests/minute (adjustable per key up to 600 req/min inside Developer Console):
X-RateLimit-Limit: Per-minute quotaX-RateLimit-Remaining: Remaining quotaX-RateLimit-Reset: ISO UTC reset time
SDKs & Schemas
OpenAPI Spec & Stack Templates
Generate strongly typed API clients automatically from our OpenAPI 3.1 document or copy the native templates in Quickstart.
Complete machine-readable JSON OpenAPI specification for code generators, Insomnia, and Postman.
Direct HTTP requests for cron jobs, monitoring probes, and quick sanity tests.
Zero-dependency native Fetch examples with TypeScript safety and idempotency keys.
Production-ready HTTP client examples with strict timeout and retry handling.