Back to Dashboard

PhantomGigs API

Integrate data and airtime purchases into your applications

Quick Start

1

Get Your API Key

Log in to your dashboard and go to the API tab to generate your API key.

2

Fund Your Wallet

Add funds to your wallet. All API purchases will be deducted from your wallet balance.

3

Make API Calls

Include your API key in the X-API-Key header with every request.

Important: Your API key must be approved by an admin before you can make authenticated requests.

Base URL

https://phantomgigs.site/api.php

Authentication

Include your API key in the request header:

X-API-Key: your_api_key_here

Rate Limits

The API enforces a rate limit of 50 requests per second per API key.

Rate limit headers are included in every response:

X-RateLimit-Limit: 50 X-RateLimit-Remaining: 49 X-RateLimit-Reset: 1737231234

Exceeding the rate limit will return a 429 Too Many Requests error.

API Endpoints

GET /status Check API status

Returns the current API status. No authentication required.

Response

{ "success": true, "message": "API is running", "data": { "api": "PhantomGigs API", "version": "1.0", "status": "online", "timestamp": "2026-01-18T19:30:00+00:00" } }
GET /balance Check your wallet balance

Returns your current wallet balance and account information.

Response

{ "success": true, "message": "Wallet balance retrieved", "data": { "balance": 150.50, "currency": "GHS", "email": "user@example.com" } }
GET /networks Get available networks

Returns list of available mobile networks. No authentication required.

Response

{ "success": true, "message": "Available networks", "data": [ {"id": "mtn", "name": "MTN", "available": true}, {"id": "telecel", "name": "Telecel (Vodafone)", "available": true}, {"id": "airteltigo", "name": "AirtelTigo", "available": true} ] }
GET /packages Get available data packages

Returns available data packages. Optionally filter by network.

Query Parameters

Parameter Type Description
networkoptional string Filter by network (mtn, telecel, airteltigo). Vodafone is accepted as an alias.

Example Request

GET /api.php?endpoint=packages&network=mtn

Response

{ "success": true, "message": "Packages retrieved", "data": [ { "id": "7bffe888-a73e-42a8-860c-33d65589fc96", "network": "MTN", "name": "1GB", "capacity_mb": 1024, "price": 6.00, "reseller_price": 4.80, "user_price": 4.80, "type": "data" }, { "id": "b1439c5a-1b6f-4529-bb00-ea707af5e8fe", "network": "MTN", "name": "2GB", "capacity_mb": 2048, "price": 9.80, "reseller_price": 9.35, "user_price": 9.35, "type": "data" } ] }
POST /order Place a new data order

Place a new data bundle order. Amount will be deducted from your wallet.

Request Body (JSON)

Parameter Type Description
package_idrequired string The package ID from /packages endpoint
phonerequired string Recipient phone number (0XXXXXXXXX or 233XXXXXXXXX)
referenceoptional string Your own reference ID for tracking
callback_urloptional string URL to receive order status updates (webhook)

Example Request

POST /api.php?endpoint=order Content-Type: application/json X-API-Key: your_api_key { "package_id": "7bffe888-a73e-42a8-860c-33d65589fc96", "phone": "0241234567", "reference": "MY_ORDER_123", "callback_url": "https://mysite.com/webhook" }

Success Response

{ "success": true, "message": "Order placed successfully", "data": { "order_id": "PG-A1B2C3D4", "status": "pending", "network": "MTN", "package": "1GB Daily", "recipient": "0241234567", "amount": 5.00, "balance_after": 145.50, "reference": "MY_ORDER_123", "created_at": "2026-01-18T19:30:00+00:00" } }

Webhook Payload (callback_url)

{ "event": "order.status", "order_id": "PG-A1B2C3D4", "status": "processing", "network": "MTN", "package": "1GB Daily", "recipient": "0241234567", "amount": 5.00, "reference": "MY_ORDER_123", "api_reference": "API-ORDER-9988", "created_at": "2026-01-18T19:30:00+00:00", "updated_at": "2026-01-18T19:30:02+00:00" }

Optional fields: api_reference, api_provider, and api_status are only included when the order is processed via an external provider.

GET /order/{order_id} Check order status

Get the current status of an order by its ID.

Path Parameters

Parameter Type Description
order_idrequired string The order ID returned when placing the order

Example Request

GET /api.php?endpoint=order/PG-A1B2C3D4

Response

{ "success": true, "message": "Order details retrieved", "data": { "order_id": "PG-A1B2C3D4", "status": "completed", "network": "MTN", "package": "1GB Daily", "recipient": "0241234567", "amount": 5.00, "reference": "MY_ORDER_123", "created_at": "2026-01-18T19:30:00+00:00", "completed_at": "2026-01-18T19:30:05+00:00", "failure_reason": null } }

Order Statuses

Status Description
pending Order received, processing
processing Order is being sent to network
completed Order delivered successfully
failed Order failed (check failure_reason)
GET /orders Get order history

Get your order history with pagination.

Query Parameters

Parameter Type Description
limitoptional integer Number of orders to return (default: 20, max: 100)
offsetoptional integer Number of orders to skip for pagination
statusoptional string Filter by status (pending, completed, failed)

Response

{ "success": true, "message": "Orders retrieved", "data": { "orders": [ { "order_id": "PG-A1B2C3D4", "status": "completed", "network": "MTN", "package": "1GB Daily", "recipient": "0241234567", "amount": 5.00, "created_at": "2026-01-18T19:30:00+00:00" } ], "count": 1, "limit": 20, "offset": 0 } }
GET /transactions Get transaction history

Get your wallet transaction history.

Query Parameters

Parameter Type Description
limitoptional integer Number of transactions (default: 20, max: 100)
offsetoptional integer Pagination offset

Response

{ "success": true, "message": "Transactions retrieved", "data": { "transactions": [ { "type": "purchase", "amount": -5.00, "description": "data - MTN 1GB", "reference": "ORDER_1768763292_5311", "balance_before": 15.00, "balance_after": 10.00, "created_at": "2026-01-18T19:30:00+00:00" }, { "type": "topup", "amount": 100.00, "description": "Wallet top-up", "reference": "TOP_123456", "balance_before": 0.00, "balance_after": 100.00, "created_at": "2026-01-18T10:00:00+00:00" } ], "count": 2, "limit": 20, "offset": 0 } }

Error Handling

All errors follow a consistent format:

{ "success": false, "error": "Error message describing what went wrong" }

HTTP Status Codes

200 Success - Request completed successfully
400 Bad Request - Invalid parameters or missing required fields
401 Unauthorized - Invalid or missing API key
404 Not Found - Resource or endpoint not found
500 Server Error - Something went wrong on our end

Common Errors

// Invalid API Key {"success": false, "error": "Invalid or missing API key"} // Insufficient Balance {"success": false, "error": "Insufficient balance. Required: GHS 5.00, Available: GHS 2.50"} // Invalid Phone {"success": false, "error": "Invalid phone number format. Use 0XXXXXXXXX or 233XXXXXXXXX"} // Package Not Found {"success": false, "error": "Package not found or unavailable"}

Code Examples

PHP

<?php $apiKey = 'your_api_key_here'; $baseUrl = 'https://phantomgigs.site/api.php'; // Check Balance $ch = curl_init($baseUrl . '?endpoint=balance'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'X-API-Key: ' . $apiKey ]); $response = json_decode(curl_exec($ch), true); echo "Balance: GHS " . $response['data']['balance']; // Place Order $ch = curl_init($baseUrl . '?endpoint=order'); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'X-API-Key: ' . $apiKey, 'Content-Type: application/json' ]); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([ 'package_id' => '7bffe888-a73e-42a8-860c-33d65589fc96', 'phone' => '0241234567' ])); $response = json_decode(curl_exec($ch), true); print_r($response); ?>

JavaScript (Fetch)

const API_KEY = 'your_api_key_here'; const BASE_URL = 'https://phantomgigs.site/api.php'; // Check Balance async function checkBalance() { const response = await fetch(`${BASE_URL}?endpoint=balance`, { headers: { 'X-API-Key': API_KEY } }); const data = await response.json(); console.log('Balance:', data.data.balance); } // Place Order async function placeOrder(packageId, phone) { const response = await fetch(`${BASE_URL}?endpoint=order`, { method: 'POST', headers: { 'X-API-Key': API_KEY, 'Content-Type': 'application/json' }, body: JSON.stringify({ package_id: packageId, phone: phone }) }); return await response.json(); }

Python

import requests API_KEY = 'your_api_key_here' BASE_URL = 'https://phantomgigs.site/api.php' headers = {'X-API-Key': API_KEY} # Check Balance response = requests.get(f'{BASE_URL}?endpoint=balance', headers=headers) print(f"Balance: GHS {response.json()['data']['balance']}") # Place Order order_data = { 'package_id': '7bffe888-a73e-42a8-860c-33d65589fc96', 'phone': '0241234567' } response = requests.post( f'{BASE_URL}?endpoint=order', headers={**headers, 'Content-Type': 'application/json'}, json=order_data ) print(response.json())