Netportal API
Buy data bundles from your own app, website or bot. Orders are paid from your store wallet, the same one you use on the website, and they are delivered the same way.
- Log in to your account at https://netportal.store/login.
- Open Developer API in the menu and press Create API key. Copy it straight away: it is shown only once.
- Top up your wallet, then send requests to
https://netportal.store/api/v1.
Authentication
Send your key in the Authorization header of every request. X-API-Key: YOUR_KEY works too.
Authorization: Bearer YOUR_API_KEYKeep your key secret. Call the API from your server, never from a web page or mobile app that other people can open. If a key leaks, create a new one: the old one stops working at once.
Responses and limits
Base address: https://netportal.store/api/v1. Send and receive JSON. Money is in Ghana cedis (GHS). Times are ISO 8601.
Every answer has success. When it is true the result is in data. When it is false you get an error code you can test for, and a message a person can read.
Each key can make 60 requests per minute. Over that, you get HTTP 429. Wait a few seconds and try again.
Account
Your name, phone, balance, the store, and when your key was made and last used.
{
"success": true,
"data": {
"name": "Ama Mensah",
"phone": "0241234567",
"email": "ama@example.com",
"balance": 50.00,
"currency": "GHS",
"store": { "name": "Fast Data", "url": "https://fastdata.example" },
"api_key": { "prefix": "sk_live_AbCd", "created_at": "2026-10-14T09:00:00+00:00", "last_used_at": "2026-10-14T09:12:00+00:00" },
"member_since": "2026-08-01T10:00:00+00:00"
}
}Balance
Your wallet balance right now. Top up from your account on the website.
{ "success": true, "data": { "balance": 50.00, "currency": "GHS" } }Bundles
Everything the store sells, with your price. Use bundle_code when you place an order, or send network and volume.
{
"success": true,
"count": 2,
"data": [
{ "bundle_code": "mtn-1gb", "network": "MTN", "volume": "1GB", "megabytes": 1024, "price": 8.50 },
{ "bundle_code": "mtn-2gb", "network": "MTN", "volume": "2GB", "megabytes": 2048, "price": 16.00 }
]
}Store status
The same numbers the website shows: whether the store is taking orders, how fast delivery is, and how many orders are waiting. Use it to warn your own customers when delivery is slow.
| Field | Meaning |
|---|---|
accepting_orders | false when the store is paused or cannot deliver. |
delivery.speed | fast (minutes), average (about an hour), slow (several hours) or none (no recent deliveries). |
delivery.average_minutes | Average time of the latest deliveries. |
orders.in_progress | Orders waiting or processing in the whole store. |
orders.oldest_wait_minutes | How long the oldest of them has waited. null when there are none. |
{
"success": true,
"data": {
"accepting_orders": true,
"delivery": { "speed": "fast", "average_minutes": 6, "last_delivery_minutes": 4, "last_delivery_at": "2026-10-14T09:10:00+00:00" },
"orders": { "in_progress": 3, "processing": 2, "queued": 1, "oldest_wait_minutes": 5, "last_order_at": "2026-10-14T09:12:41+00:00" }
}
}Place an order
Buys one bundle for one phone number and takes the price from your wallet. If the order fails later, the money goes back to your wallet.
| Field | Required | Meaning |
|---|---|---|
phone | yes | The number that receives the data. 0241234567 or 233241234567. |
bundle_code | one of | A code from GET /bundles. |
network + volume | one of | For example MTN and 1GB. A volume without a unit is read as GB. |
reference | no, but use it | Your own reference (letters, numbers, . _ -, up to 64). See safe retries. |
curl -X POST "https://netportal.store/api/v1/orders" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"network":"MTN","volume":"1GB","phone":"0241234567","reference":"order-1001"}'Answer: HTTP 201, the order, and your new balance.
{
"success": true,
"balance": 41.50,
"data": {
"reference": "ODK3F9A2X1QZ",
"client_reference": "order-1001",
"status": "pending",
"network": "MTN",
"bundle": "1GB",
"bundle_code": "mtn-1gb",
"phone": "0241234567",
"amount": 8.50,
"refunded": false,
"source": "api",
"message": null,
"created_at": "2026-10-14T09:12:41+00:00",
"delivered_at": null,
"delivery_minutes": null
}
}List orders
Your orders, newest first. This includes orders you placed on the website.
| Query | Meaning |
|---|---|
status | pending, processing, successful or failed. |
phone | Only orders for this number. |
since | Only orders from this date or time, for example 2026-10-01. |
per_page | 1 to 100. Default 25. Add page=2 for the next page. |
{
"success": true,
"meta": { "current_page": 1, "last_page": 4, "per_page": 25, "total": 92 },
"data": [ { "reference": "ODK3F9A2X1QZ", "status": "successful", "...": "same fields as above" } ]
}Get one order
Use the store's reference or your own. Check this to see when an order becomes successful.
curl "https://netportal.store/api/v1/orders/ODK3F9A2X1QZ" \
-H "Authorization: Bearer YOUR_API_KEY"Order statuses
| Status | Meaning |
|---|---|
pending | Received and waiting to be sent for delivery. |
processing | With the network. Most orders finish within minutes. |
successful | Delivered. delivered_at and delivery_minutes are filled in. |
failed | Could not be delivered. The price is back in your wallet (refunded: true). message says why. |
Check an order every 15 to 30 seconds at first, then less often. Please do not poll faster than once every 5 seconds per order.
Safe retries
Networks drop. If your request times out, you do not know if the order was placed. Always send your own reference when you place an order. If you send the same reference again, you get the first order back with "duplicate": true and you are not charged again.
Use a new reference for every new purchase, for example your own order number.
Webhooks
Instead of asking again and again, let us tell you. When an order you placed with the API is delivered or fails, we send a message to the address you saved on your Developer API page. Webhooks are sent for orders placed with the API only.
Events
| Event | When |
|---|---|
order.successful | The data was delivered. |
order.failed | The order could not be delivered. The price is back in your wallet (refunded: true). |
webhook.test | Sent when you press "Send a test". |
What we send
A POST with a JSON body. data is the same order object the API returns.
{
"id": "evt_6f1c2d0e-8c1b-4d0a-9d52-1f2b3c4d5e6f",
"event": "order.successful",
"created_at": "2026-11-20T10:15:30+00:00",
"data": {
"reference": "ORD123456",
"client_reference": "order-1001",
"status": "successful",
"network": "MTN",
"bundle": "1GB",
"phone": "0241234567",
"amount": 5.5,
"refunded": false,
"source": "api",
"message": null,
"created_at": "2026-11-20T10:14:02+00:00",
"delivered_at": "2026-11-20T10:15:28+00:00",
"delivery_minutes": 1
}
}Headers
| Header | Meaning |
|---|---|
X-Webhook-Event | The event name. |
X-Webhook-Id | A unique id for this message. Use it to ignore a message you already handled. |
X-Webhook-Timestamp | When it was sent (unix seconds). |
X-Webhook-Signature | sha256= followed by the HMAC-SHA256 of timestamp + "." + raw body, made with your signing secret. |
Check the signature
Always check it, so nobody else can pretend to be us. Use the raw body exactly as it arrived, not a re-encoded copy.
PHP
<?php
$raw = file_get_contents('php://input');
$timestamp = $_SERVER['HTTP_X_WEBHOOK_TIMESTAMP'] ?? '';
$signature = $_SERVER['HTTP_X_WEBHOOK_SIGNATURE'] ?? '';
$secret = 'YOUR_WEBHOOK_SECRET';
$expected = 'sha256=' . hash_hmac('sha256', $timestamp . '.' . $raw, $secret);
if (! hash_equals($expected, $signature) || abs(time() - (int) $timestamp) > 300) {
http_response_code(401);
exit;
}
$event = json_decode($raw, true);
if ($event['event'] === 'order.successful') {
// mark order $event['data']['client_reference'] as delivered
}
http_response_code(200); // answer 200 quicklyJavaScript (Node, Express)
const crypto = require('crypto');
const express = require('express');
const app = express();
// keep the RAW body: the signature is made from it
app.post('/hooks/data', express.raw({ type: 'application/json' }), (req, res) => {
const timestamp = req.get('X-Webhook-Timestamp') || '';
const signature = req.get('X-Webhook-Signature') || '';
const expected = 'sha256=' + crypto.createHmac('sha256', process.env.WEBHOOK_SECRET)
.update(timestamp + '.' + req.body.toString('utf8')).digest('hex');
const ok = signature.length === expected.length
&& crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected))
&& Math.abs(Date.now() / 1000 - Number(timestamp)) < 300;
if (!ok) return res.sendStatus(401);
const event = JSON.parse(req.body.toString('utf8'));
// handle event.event and event.data here
res.sendStatus(200);
});Retries
Answer with any 2xx code within 8 seconds. Anything else, or no answer, counts as a failure. We try again after 1 minute, 5 minutes, 30 minutes, 2 hours and 6 hours, then stop (6 tries in all). Redirects are not followed.
- The same message can arrive twice. Save the
X-Webhook-Idand skip ones you have seen. - Do the slow work after you answer. Reply
200first. - Webhooks can arrive late or out of order. If you are unsure, ask
GET /orders/{reference}for the truth. - Your address must be a public
https://address.
Errors
{
"success": false,
"error": "insufficient_balance",
"message": "Your wallet balance is too low. Top up and try again."
}| HTTP | error | What to do |
|---|---|---|
| 401 | missing_key, invalid_key | Send a valid key. If you made a new key, the old one no longer works. |
| 403 | api_disabled, account_disabled | The owner has switched the API off, or your account was disabled. Contact the store. |
| 402 | insufficient_balance | Top up your wallet. |
| 404 | order_not_found, not_found | Check the reference or the address. |
| 409 | duplicate_in_progress | The same reference is still being processed. Try again in a few seconds. |
| 422 | validation_failed, invalid_phone, bundle_not_found, rejected | Fix the request. message tells you what is wrong. errors lists the fields. |
| 429 | Too Many Attempts. | Slow down. The limit is 60 requests a minute per key. |
| 503 | store_not_taking_orders, store_unavailable | The store is paused. Try later. GET /status shows accepting_orders. |
Code examples
PHP
<?php
$apiKey = 'YOUR_API_KEY';
$ch = curl_init('https://netportal.store/api/v1/orders');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => ["Authorization: Bearer $apiKey", 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'network' => 'MTN',
'volume' => '1GB',
'phone' => '0241234567',
'reference' => 'order-1001', // your own reference: sending it twice never charges twice
]),
]);
$res = json_decode(curl_exec($ch), true);
if ($res['success'] ?? false) {
echo $res['data']['reference'] . ' is ' . $res['data']['status'];
} else {
echo ($res['error'] ?? 'error') . ': ' . ($res['message'] ?? 'No answer');
}JavaScript (Node)
// Node 18+ (or any browser-free JavaScript runtime with fetch). Keep your key on the server.
const res = await fetch('https://netportal.store/api/v1/orders', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
network: 'MTN',
volume: '1GB',
phone: '0241234567',
reference: 'order-1001',
}),
});
const json = await res.json();
if (json.success) {
console.log(json.data.reference, json.data.status);
} else {
console.error(json.error, json.message);
}Python
import requests
res = requests.post(
"https://netportal.store/api/v1/orders",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"network": "MTN", "volume": "1GB", "phone": "0241234567", "reference": "order-1001"},
timeout=30,
).json()
if res.get("success"):
print(res["data"]["reference"], res["data"]["status"])
else:
print(res.get("error"), res.get("message"))