API Documentation

Introduction

Welcome to the HAXOR BULK SMS & Call API. Our RESTful API allows you to send bulk SMS, make voice calls (OBD), and manage your account programmatically.

šŸ”— Base URL: https://sms.cathaxor.com/
All API endpoints are relative to this base URL. HTTP requests will be rejected in production.

šŸ” Authentication

Include your 6-digit API Key in every request header:

X-API-Key: HAX_AB12CD

Or as query parameter:

GET /api-sms.php?api_key=HAX_AB12CD&number=01XXXXXXXXX&message=Hello

šŸ”‘ Your API Key

Get your API Key: Register or Login to get your 6-digit API key.

šŸ“± Send Single SMS

POST /api-sms.php
ParameterTypeRequiredDescription
api_keyStringYesYour 6-digit API key
numberStringYesRecipient number (01XXXXXXXXX)
messageStringYesSMS content (max 480 chars)

Example Request (POST)

curl -X POST "https://sms.cathaxor.com/api-sms.php" \
  -H "X-API-Key: HAX_AB12CD" \
  -d "number=01612345678" \
  -d "message=Hello from API!"

Success Response

{
  "success": true,
  "message": "1 SMS sent",
  "data": {
    "total_sent": 1,
    "cost": "0.20 TK",
    "remaining_balance": "48.80 TK"
  }
}

Error Response

{
  "success": false,
  "error": "Insufficient balance. Need 0.20 TK"
}

šŸ“Ø Send Bulk SMS

POST /api-sms.php (with comma-separated numbers)

Send SMS to multiple recipients by providing comma-separated phone numbers.

ParameterTypeRequiredDescription
api_keyStringYesYour 6-digit API key
numberStringYesComma-separated numbers (01XXXXXXXXX,01XXXXXXXXX)
messageStringYesSMS content (max 480 chars)

Example Request

curl -X POST "https://sms.cathaxor.com/api-sms.php" \
  -H "X-API-Key: HAX_AB12CD" \
  -d "number=01612345678,01712345678,01812345678" \
  -d "message=Bulk notification to all users!"

Success Response

{
  "success": true,
  "message": "3 SMS sent",
  "data": {
    "total_sent": 3,
    "cost": "0.60 TK",
    "remaining_balance": "49.40 TK"
  }
}

šŸ“ž Send Voice Call (OBD)

POST /api-call.php
ParameterTypeRequiredDescription
api_keyStringYesYour 6-digit API key
numberStringYesRecipient number (01XXXXXXXXX)
durationIntegerNo10-120 seconds (default: 60)
voice_urlStringNoCustom audio URL (optional)

Example Request

curl -X POST "https://sms.cathaxor.com/api-call.php" \
  -H "X-API-Key: HAX_AB12CD" \
  -d "number=01612345678" \
  -d "duration=60"

Success Response

{
  "success": true,
  "message": "1 call(s) initiated",
  "data": {
    "total_sent": 1,
    "duration": "60 sec",
    "cost": "0.40 TK",
    "remaining_balance": "49.60 TK"
  }
}

šŸ“¢ Send Text Call (TTS)

Convert your text to speech and play it to the recipient during the call.

POST /api-txt-call.php
ParameterTypeRequiredDescription
api_keyStringYesYour 6-digit API key
numberStringYesRecipient number (01XXXXXXXXX)
textStringYesText to be spoken
durationIntegerNo10-120 seconds (default: 60)

Example Request

curl -X POST "https://sms.cathaxor.com/api-txt-call.php" \
  -H "X-API-Key: HAX_AB12CD" \
  -d "number=01612345678" \
  -d "text=Hello, this is a custom text call" \
  -d "duration=60"

Success Response

{
  "success": true,
  "message": "1 call(s) initiated",
  "data": {
    "total_sent": 1,
    "duration": "60 sec",
    "cost": "0.40 TK",
    "remaining_balance": "49.60 TK"
  }
}

šŸ’° Check Balance

GET /api-balance.php
ParameterTypeRequiredDescription
api_keyStringYesYour 6-digit API key (header or query)

Example Request

# Using Header
curl "https://sms.cathaxor.com/api-balance.php" \
  -H "X-API-Key: HAX_AB12CD"

# Using Query Parameter  
curl "https://sms.cathaxor.com/api-balance.php?api_key=HAX_AB12CD"

Success Response

{
  "success": true,
  "data": {
    "balance": "48.80",
    "currency": "TK",
    "sms_remaining": 244,
    "call_remaining": 122
  }
}

āŒ Error Codes

Error MessageHTTP StatusDescription
API key required401No API key provided
Invalid API key401API key not found in database
Account blocked403User account is suspended
Insufficient balance. Need X TK402Not enough balance for request
Number required400Phone number not provided
Message required400SMS message not provided

šŸ’µ Pricing

ServiceCostPer
SMS0.20 TKPer SMS
Voice Call0.40 TKPer call (up to 60 sec)

šŸ’» PHP Example

Complete working PHP class with all API methods:

<?php
/**
 * HAXOR BULK SMS API Client
 */
class HaxorSMSClient {
    private $apiKey;
    private $baseUrl;
    
    public function __construct($apiKey, $baseUrl = 'https://sms.cathaxor.com') {
        $this->apiKey = $apiKey;
        $this->baseUrl = rtrim($baseUrl, '/');
    }
    
    // Send SMS (single or bulk)
    public function sendSMS($number, $message) {
        $data = [
            'api_key' => $this->apiKey,
            'number' => $number,
            'message' => $message
        ];
        
        return $this->makeRequest('/api-sms.php', $data);
    }
    
    // Make voice call
    public function makeCall($number, $duration = 60) {
        $data = [
            'api_key' => $this->apiKey,
            'number' => $number,
            'duration' => $duration
        ];
        
        return $this->makeRequest('/api-call.php', $data);
    }
    
    // Check balance
    public function checkBalance() {
        $url = $this->baseUrl . '/api-balance.php?api_key=' . $this->apiKey;
        
        $ch = curl_init($url);
        curl_setopt_array($ch, [
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_HTTPHEADER => ['X-API-Key: ' . $this->apiKey]
        ]);
        
        $response = curl_exec($ch);
        curl_close($ch);
        
        return json_decode($response, true);
    }
    
    private function makeRequest($endpoint, $data) {
        $ch = curl_init($this->baseUrl . $endpoint);
        curl_setopt_array($ch, [
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_POST => true,
            CURLOPT_POSTFIELDS => http_build_query($data),
            CURLOPT_HTTPHEADER => ['X-API-Key: ' . $this->apiKey]
        ]);
        
        $response = curl_exec($ch);
        curl_close($ch);
        
        return json_decode($response, true);
    }
}

// ===== USAGE EXAMPLES =====

$client = new HaxorSMSClient('HAX_AB12CD');

// Send single SMS
$result = $client->sendSMS('01612345678', 'Hello from PHP!');
if ($result['success']) {
    echo "SMS sent! Cost: " . $result['data']['cost'];
}

// Send bulk SMS
$numbers = ['01612345678', '01712345678', '01812345678'];
$bulkResult = $client->sendSMS(implode(',', $numbers), 'Bulk message!');
echo "Sent to " . $bulkResult['data']['total_sent'] . " numbers";

// Check balance
$balance = $client->checkBalance();
echo "Balance: " . $balance['data']['balance'] . " TK";

// Make voice call
$call = $client->makeCall('01612345678', 30);
if ($call['success']) {
    echo "Call initiated! Duration: " . $call['data']['duration'];
}
?>

šŸ“œ JavaScript/Node.js Example

const axios = require('axios');
const querystring = require('querystring');

class HaxorSMSClient {
    constructor(apiKey, baseUrl = 'https://sms.cathaxor.com') {
        this.apiKey = apiKey;
        this.baseUrl = baseUrl.replace(/\/$/, '');
        this.headers = {
            'X-API-Key': apiKey,
            'Content-Type': 'application/x-www-form-urlencoded'
        };
    }
    
    // Send SMS
    async sendSMS(number, message) {
        const data = { api_key: this.apiKey, number, message };
        const res = await axios.post(
            `${this.baseUrl}/api-sms.php`,
            querystring.stringify(data),
            { headers: this.headers }
        );
        return res.data;
    }
    
    // Make voice call
    async makeCall(number, duration = 60) {
        const data = { api_key: this.apiKey, number, duration };
        const res = await axios.post(
            `${this.baseUrl}/api-call.php`,
            querystring.stringify(data),
            { headers: this.headers }
        );
        return res.data;
    }
    
    // Check balance
    async checkBalance() {
        const res = await axios.get(
            `${this.baseUrl}/api-balance.php`,
            { headers: this.headers }
        );
        return res.data;
    }
}

// ===== USAGE =====

(async () => {
    const client = new HaxorSMSClient('HAX_AB12CD');
    
    try {
        // Send SMS
        const sms = await client.sendSMS('01612345678', 'Hello from Node.js!');
        console.log('SMS Result:', sms);
        
        // Bulk SMS
        const bulk = await client.sendSMS(
            '01612345678,01712345678',
            'Bulk message!'
        );
        console.log('Bulk Result:', bulk);
        
        // Check balance
        const balance = await client.checkBalance();
        console.log('Balance:', balance.data);
        
        // Make call
        const call = await client.makeCall('01612345678', 30);
        console.log('Call Result:', call);
        
    } catch (err) {
        console.error('Error:', err.message);
    }
})();

šŸ Python Example

import requests
from typing import Dict, List, Optional

class HaxorSMSClient:
    """HAXOR BULK SMS API Client"""
    
    def __init__(self, api_key: str, base_url: str = "https://sms.cathaxor.com"):
        self.api_key = api_key
        self.base_url = base_url.rstrip('/')
        self.headers = {
            "X-API-Key": api_key,
            "Content-Type": "application/x-www-form-urlencoded"
        }
    
    def send_sms(self, number: str, message: str) -> Dict:
        """Send single or bulk SMS"""
        url = f"{self.base_url}/api-sms.php"
        data = {
            "api_key": self.api_key,
            "number": number,
            "message": message
        }
        response = requests.post(url, data=data, headers=self.headers)
        return response.json()
    
    def send_bulk_sms(self, numbers: List[str], message: str) -> Dict:
        """Send SMS to multiple numbers"""
        number_string = ",".join(numbers)
        return self.send_sms(number_string, message)
    
    def make_call(self, number: str, duration: int = 60) -> Dict:
        """Make voice call"""
        url = f"{self.base_url}/api-call.php"
        data = {
            "api_key": self.api_key,
            "number": number,
            "duration": duration
        }
        response = requests.post(url, data=data, headers=self.headers)
        return response.json()
    
    def check_balance(self) -> Optional[Dict]:
        """Check account balance"""
        url = f"{self.base_url}/api-balance.php"
        response = requests.get(url, headers=self.headers)
        result = response.json()
        return result.get('data') if result.get('success') else None


# ===== USAGE =====

if __name__ == "__main__":
    client = HaxorSMSClient("HAX_AB12CD")
    
    # Send single SMS
    result = client.send_sms("01612345678", "Hello from Python!")
    if result.get('success'):
        print(f"āœ… SMS sent!")
        print(f"šŸ“Š Total: {result['data']['total_sent']}")
        print(f"šŸ’° Cost: {result['data']['cost']}")
        print(f"šŸ’³ Balance: {result['data']['remaining_balance']}")
    else:
        print(f"āŒ Error: {result.get('error')}")
    
    # Send bulk SMS
    numbers = ["01612345678", "01712345678", "01812345678"]
    bulk = client.send_bulk_sms(numbers, "Bulk notification!")
    print(f"\nBulk SMS sent to {bulk['data']['total_sent']} numbers")
    
    # Check balance
    balance = client.check_balance()
    if balance:
        print(f"\nšŸ’° Balance: {balance['balance']} TK")
        print(f"šŸ“Ø SMS available: {balance['sms_remaining']}")
        print(f"šŸ“ž Calls available: {balance['call_remaining']}")
    
    # Make voice call
    call = client.make_call("01612345678", 30)
    if call.get('success'):
        print(f"\nšŸ“ž Call initiated!")
        print(f"ā±ļø Duration: {call['data']['duration']}")
        print(f"šŸ’° Cost: {call['data']['cost']}")

šŸ–„ļø cURL Examples

Send Single SMS

curl -X POST "https://sms.cathaxor.com/api-sms.php" \
  -H "X-API-Key: HAX_AB12CD" \
  -d "number=01612345678" \
  -d "message=Hello from cURL!"

Send Bulk SMS

curl -X POST "https://sms.cathaxor.com/api-sms.php" \
  -H "X-API-Key: HAX_AB12CD" \
  -d "number=01612345678,01712345678,01812345678" \
  -d "message=Bulk notification!"

Check Balance (Header)

curl "https://sms.cathaxor.com/api-balance.php" \
  -H "X-API-Key: HAX_AB12CD"

Check Balance (Query)

curl "https://sms.cathaxor.com/api-balance.php?api_key=HAX_AB12CD"

Send Voice Call

curl -X POST "https://sms.cathaxor.com/api-call.php" \
  -H "X-API-Key: HAX_AB12CD" \
  -d "number=01612345678" \
  -d "duration=60"

Send Voice Call with Custom Audio

curl -X POST "https://sms.cathaxor.com/api-call.php" \
  -H "X-API-Key: HAX_AB12CD" \
  -d "number=01612345678" \
  -d "duration=30" \
  -d "voice_url=https://example.com/audio.mp3"

šŸš€ Ready to integrate?
Create your free account and get your 6-digit API key instantly with 1 TK bonus!