Welcome to the Xonabs Swift API documentation. Integrate airtime, data bundles, exam pins, electricity subscriptions and more into your platform. Start building with our reliable API today.
https://xonabsswift.online/restapi/
Authorization
header with the Bearer token for authentication.Header | Type | Required | Description |
---|---|---|---|
Authorization | String | Yes | Bearer token for API authentication. |
Content-Type | String | Yes | Must be application/json . |
This API allows users to purchase airtime for mobile numbers across different networks. The service deducts the airtime cost from the user's wallet and processes the transaction via the VTU provider.
POST https://xonabsswift.online/restapi/airtime.php
Parameter | Type | Required | Description |
---|---|---|---|
network | String | Yes | Network ID |
amount | Float | Yes | Amount of airtime to purchase. |
mobile_number | String | Yes | Mobile number to top up. |
airtime_type | String | No | Type of airtime (VTU by default). |
Ported_number | Bool | Yes | Indicates whether the number is ported (true or false). Defaults to true. |
{
"network": "1",
"amount": 500,
"mobile_number": "08012345678",
"airtime_type": "VTU",
"Ported_number": true
}
// API URL for airtime top-up
$apiUrl = 'https://xonabsswift.online/restapi/airtime.php';
// Get the user's API token
$token = 'YOUR_API_TOKEN_HERE';
// Set request parameters
$requestPayload = [
'network' => '1', // Network ID
'amount' => 500, // Airtime amount
'mobile_number' => '08012345678', // Mobile number
'airtime_type' => 'VTU', // Optional, defaults to 'VTU'
'Ported_number' => true // Optional, 0 for no, 1 for yes
];
// Initialize cURL
$curl = curl_init();
// Configure cURL request
curl_setopt_array($curl, array(
CURLOPT_URL => $apiUrl,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode($requestPayload),
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer ' . $token,
'Content-Type: application/json',
),
));
// Execute request and capture response
$response = curl_exec($curl);
// Close cURL
curl_close($curl);
// Output the response
echo $response;
{
"message": "Airtime Top Up successful",
"status": "success",
"new_balance": 4950.00
}
This API allows users to purchase mobile data for various networks. The cost is deducted from the user's wallet, and the transaction is processed via the VTU provider.
POST https://xonabsswift.online/restapi/data.php
The request body should be sent in JSON format.
{
"network": "1",
"mobile_number": "08012345678",
"plan_id": "5",
"Ported_number": true
}
// API URL for data top-up
$apiUrl = 'https://xonabsswift.online/restapi/data.php';
// User's API token
$token = 'your_api_token';
// Prepare cURL request
$curl = curl_init();
// Request payload
$requestPayload = [
'network' => '1', //
'mobile_number' => '08012345678',
'plan_id' => '5',
'Ported_number' => false,
];
curl_setopt_array($curl, [
CURLOPT_URL => $apiUrl,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode($requestPayload),
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $token,
'Content-Type: application/json',
],
]);
// Execute request and get response
$response = curl_exec($curl);
curl_close($curl);
// Decode and process the response
$result = json_decode($response, true);
print_r($result);
{
"message": "Data Top Up successful",
"status": "success",
"new_balance": 4950.00
}
This API allows users to purchase cable subscriptions. The cost is deducted from the user's wallet, and the transaction is processed via the VTU provider.
POST https://xonabsswift.online/restapi/cable.php
Parameter | Type | Required | Description |
---|---|---|---|
cablename | Interger | Yes | The cable provider ID. |
cableplan | String | Yes | The selected cable subscription plan ID. |
smart_card_number | String | Yes | The smart card number for the subscription. |
{
"cablename": "1",
"cableplan": "101",
"smart_card_number": "1234567890"
}
// API URL for cable subscription
$apiUrl = 'https://xonabsswift.online/restapi/cable.php';
// User's API token
$token = 'your_api_token';
// Request payload
$requestPayload = [
'cablename' => '1',
'cableplan' => '101',
'smart_card_number' => '1234567890'
];
// Initialize cURL
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => $apiUrl,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode($requestPayload),
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $token,
'Content-Type: application/json',
],
]);
// Execute request
$response = curl_exec($curl);
curl_close($curl);
// Decode and process the response
$result = json_decode($response, true);
print_r($result);
{
"message": "Cable Subscription successful",
"status": "success",
"new_balance": 1500.00
}
This API enables users to pay their electricity bills. The transaction amount is deducted from the user's wallet or bonus account, and a token is generated for the user.
POST https://xonabsswift.online/restapi/electricity.php
Parameter | Type | Required | Description |
---|---|---|---|
disco_name | Integer | Yes | Electricity distribution company ID. |
meter_number | String | Yes | Meter number for the electricity connection. |
meter_type | Integer | Yes | Type of meter (1 for Prepaid, 2 for Postpaid). |
amount | Float | Yes | Amount to pay (minimum is 500). |
customer_phone | String | Yes | Customer's phone number. |
name | String | No | Customer's name (optional). |
address | String | No | Customer's address (optional). |
{
"account": "balance",
"disco_name": 1,
"meter_number": "1234567890",
"meter_type": 1,
"amount": 1500,
"customer_phone": "08012345678",
"name": "John Doe",
"address": "123 Example Street"
}
Array
(
[message] => Invalid API Token
[status] => error
)
{
"message": "Electricity bill payment successful.",
"status": "success",
"token": "0123456789ABCDEFG"
}
This API validates an electricity meter number based on the DISCO (electricity provider) name and meter type (prepaid or postpaid). It checks if the meter is valid and returns a response accordingly.
POST https://xonabsswift.online/restapi/validate-meter.php
Parameter | Type | Required | Description |
---|---|---|---|
meternumber | String | Yes | The meter number to validate. |
disconame | String | Yes | The name of the DISCO (electricity provider). |
mtype | Integer | Yes | The type of meter (1 for Prepaid, 2 for Postpaid). |
{
"meternumber": "12345678901",
"disconame": "Ikeja Electric",
"mtype": 1
}
$apiUrl = 'https://xonabsswift.online/restapi/validate-meter.php';
$token = 'your_api_token';
$requestPayload = [
'meternumber' => '12345678901',
'disconame' => 'Ikeja Electric',
'mtype' => 1
];
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => $apiUrl,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode($requestPayload),
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $token,
'Content-Type: application/json',
],
]);
$response = curl_exec($curl);
curl_close($curl);
$result = json_decode($response, true);
print_r($result);
{
"http_code": 200,
"response": {
"valid": true,
"message": "Meter number validated successfully"
}
}
This API allows users to purchase exam pins for various exams.
POST https://xonabsswift.online/restapi/exams.php
Parameter | Type | Required | Description |
---|---|---|---|
exam_name | String | Yes | The name of the exam for which the pin is being purchased. |
quantity | Integer | Yes | The number of exam pins to purchase. |
{
"exam_name": "JAMB",
"quantity": 2
}
$apiUrl = 'https://xonabsswift.online/restapi/exams.php';
$token = 'your_api_token';
$requestPayload = [
'exam_name' => 'JAMB',
'quantity' => 2
];
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => $apiUrl,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode($requestPayload),
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $token,
'Content-Type: application/json',
],
]);
$response = curl_exec($curl);
curl_close($curl);
$result = json_decode($response, true);
print_r($result);
{
"http_code": 200,
"response": {
"message": "Exam Pin purchase successful.",
"status": "success",
"new_balance": 1500
}
}
{
"http_code": 400,
"response": {
"message": "Your account balance is insufficient for this purchase",
"status": "error"
}
}
The following error responses are applicable to all API endpoints:
Status Code | Error Message | Description |
---|---|---|
401 | API token is missing | The Authorization header is not provided. |
401 | Invalid API Token | The provided API token is invalid. |
400 | Missing required fields | One or more required fields are missing. |
500 | Server error | Internal server error. |
500 | Transaction failed | API returned a failed status. |