BSB Messaging API

Powerful, reliable messaging infrastructure for SMS and WhatsApp. Build seamless communication experiences with our developer-friendly API.

99.9%
Uptime SLA
<1s
Avg Latency
200+
Countries

Quick Integration

Get started in minutes with our simple REST API. Just authenticate and start sending messages.

Multi-Language SDKs

Code samples available in PHP, C#, Python, and Node.js to accelerate your development.

Enterprise Security

Advanced API key authentication for secured endpoints. Your data is always protected.

Authentication

Learn about the two authentication methods available in our API

Two Authentication Methods

Standard APIs (1-5): Use username and password parameters only.
Secured APIs (6-7): Require an API-Key header in addition to username/password.

API Key Required for Secured Endpoints

To use Secured Messaging API or AI Chatbot API, you must generate an API key from: Agent → Users → Edit API User → Generate API Key

Base URL
https://www.bestsmsbulk.com/bestsmsbulkapi
1
Send SMS (Text HTTP)
GET POST
https://www.bestsmsbulk.com/bestsmsbulkapi/sendSmsAPI.php

Parameters

Parameter Description
usernameRequiredYour BSB username
passwordRequiredYour BSB password
messageRequiredSMS content to send
senderidRequiredSender ID (case sensitive)
destinationRequiredPhone number(s) in format: 96170XXXXXX. Multiple numbers separated by ;
dateOptionalSchedule date (YYYY-MM-DD)
timeOptionalSchedule time (HH:mm, 24h format)
PHP
<?php
$url = "https://www.bestsmsbulk.com/bestsmsbulkapi/sendSmsAPI.php";

$data = [
    'username'    => 'your_username',
    'password'    => 'your_password',
    'senderid'    => 'SENDERID',
    'destination' => '96170123456',
    'message'     => 'Hello, this is a test SMS!'
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
// Response: confirmationID;recipientNumber;numSMSParts
?>
C#
using System;
using System.Net.Http;
using System.Collections.Generic;
using System.Threading.Tasks;

class Program
{
    static async Task Main()
    {
        using var client = new HttpClient();
        var values = new Dictionary<string, string>
        {
            { "username", "your_username" },
            { "password", "your_password" },
            { "senderid", "SENDERID" },
            { "destination", "96170123456" },
            { "message", "Hello, this is a test SMS!" }
        };

        var content = new FormUrlEncodedContent(values);
        var response = await client.PostAsync(
            "https://www.bestsmsbulk.com/bestsmsbulkapi/sendSmsAPI.php", 
            content
        );

        Console.WriteLine(await response.Content.ReadAsStringAsync());
    }
}
Python
import requests

url = "https://www.bestsmsbulk.com/bestsmsbulkapi/sendSmsAPI.php"

data = {
    "username": "your_username",
    "password": "your_password",
    "senderid": "SENDERID",
    "destination": "96170123456",
    "message": "Hello, this is a test SMS!"
}

response = requests.post(url, data=data)
print(response.text)
# Response: confirmationID;recipientNumber;numSMSParts
Node.js
const https = require('https');
const querystring = require('querystring');

const postData = querystring.stringify({
    username: 'your_username',
    password: 'your_password',
    senderid: 'SENDERID',
    destination: '96170123456',
    message: 'Hello, this is a test SMS!'
});

const options = {
    hostname: 'www.bestsmsbulk.com',
    path: '/bestsmsbulkapi/sendSmsAPI.php',
    method: 'POST',
    headers: {
        'Content-Type': 'application/x-www-form-urlencoded',
        'Content-Length': Buffer.byteLength(postData)
    }
};

const req = https.request(options, (res) => {
    let data = '';
    res.on('data', chunk => data += chunk);
    res.on('end', () => console.log('Response:', data));
});

req.write(postData);
req.end();

Success Response (Plain Text)

confirmationID;recipientNumber;numSMSParts

Example: 110099887;96170123456;1

For multiple recipients (each on new line):
110099887;96170123456;1
110099888;96170789012;1

Error Responses (Plain Text)

ResponseDescription
username Field is emptyUsername parameter missing
password Field is emptyPassword parameter missing
message Field is emptyMessage parameter missing
destination Field is emptyDestination parameter missing
senderid is not authorizedSender ID not approved for your account
Wrong username/passwordInvalid credentials
API key is set, you cannot use this API linkUse Secured API instead
No creditsInsufficient balance
Error 101Balance update failed
Error 102Message insertion failed
2
Send SMS (JSON HTTP)
POST JSON Body

JSON Array Input Required

This endpoint accepts a JSON array of message objects. You can send multiple messages in a single request. Set Content-Type: application/json header.

https://www.bestsmsbulk.com/bestsmsbulkapi/sendSmsAPIJson.php

Request Body (JSON Array)

ParameterDescription
usernameRequiredYour BSB username
passwordRequiredYour BSB password
messageRequiredSMS content to send
senderidRequiredSender ID (case sensitive)
destinationRequiredPhone number(s), separated by ;
dateOptionalSchedule date (YYYY-MM-DD)
timeOptionalSchedule time (HH:mm:ss)
PHP
<?php
$url = "https://www.bestsmsbulk.com/bestsmsbulkapi/sendSmsAPIJson.php";

// JSON array - can send multiple messages at once
$data = [
    [
        'username'    => 'your_username',
        'password'    => 'your_password',
        'senderid'    => 'SENDERID',
        'destination' => '96170123456',
        'message'     => 'Hello, this is message 1!'
    ],
    [
        'username'    => 'your_username',
        'password'    => 'your_password',
        'senderid'    => 'SENDERID',
        'destination' => '96170789012',
        'message'     => 'Hello, this is message 2!'
    ]
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json'
]);

$response = curl_exec($ch);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
?>
Python
import requests

url = "https://www.bestsmsbulk.com/bestsmsbulkapi/sendSmsAPIJson.php"

# JSON array - can send multiple messages at once
data = [
    {
        "username": "your_username",
        "password": "your_password",
        "senderid": "SENDERID",
        "destination": "96170123456",
        "message": "Hello, this is message 1!"
    },
    {
        "username": "your_username",
        "password": "your_password",
        "senderid": "SENDERID",
        "destination": "96170789012",
        "message": "Hello, this is message 2!"
    }
]

response = requests.post(url, json=data)
print(response.json())
Node.js
const https = require('https');

// JSON array - can send multiple messages at once
const data = JSON.stringify([
    {
        username: 'your_username',
        password: 'your_password',
        senderid: 'SENDERID',
        destination: '96170123456',
        message: 'Hello, this is message 1!'
    },
    {
        username: 'your_username',
        password: 'your_password',
        senderid: 'SENDERID',
        destination: '96170789012',
        message: 'Hello, this is message 2!'
    }
]);

const options = {
    hostname: 'www.bestsmsbulk.com',
    path: '/bestsmsbulkapi/sendSmsAPIJson.php',
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Content-Length': Buffer.byteLength(data)
    }
};

const req = https.request(options, (res) => {
    let body = '';
    res.on('data', chunk => body += chunk);
    res.on('end', () => console.log(JSON.parse(body)));
});

req.write(data);
req.end();

Success Response

{
  "status": 201,
  "message": "Messages successfully queued",
  "data": [
    {
      "status": 201,
      "confirmationid": 12345678,
      "recipient": "96170123456",
      "numberofsmspermsg": 1
    }
  ]
}

Error Responses

ResponseDescription
{"status": 300, "message": "Invalid JSON format"}Malformed JSON body
{"status": 300, "message": "Username field is empty"}Username missing
{"status": 300, "message": "Password field is empty"}Password missing
{"status": 300, "message": "Message field is empty"}Message missing
{"status": 300, "message": "Sender ID field is empty"}Sender ID missing
{"status": 300, "message": "Destination field is empty"}Destination missing
{"status": 300, "message": "Invalid username or password"}Wrong credentials
{"status": 300, "message": "Sender ID is not authorized"}Sender ID not approved
{"status": 300, "message": "Insufficient credits"}No balance available
3
Get Delivery Status
POST JSON Body

JSON Array Input Required

This endpoint accepts a JSON array with your credentials. Set Content-Type: application/json header.

https://www.bestsmsbulk.com/bestsmsbulkapi/getSmsStatusJson.php

Request Body (JSON Array)

ParameterDescription
usernameRequiredYour BSB username
passwordRequiredYour BSB password
limitOptionalNumber of statuses to retrieve (default: 1000)
PHP
<?php
$url = "https://www.bestsmsbulk.com/bestsmsbulkapi/getSmsStatusJson.php";

// JSON array format required
$data = [
    [
        'username' => 'your_username',
        'password' => 'your_password',
        'limit'    => 100
    ]
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json'
]);

$response = curl_exec($ch);
curl_close($ch);

$statuses = json_decode($response, true);
print_r($statuses);
?>
Python
import requests

url = "https://www.bestsmsbulk.com/bestsmsbulkapi/getSmsStatusJson.php"

# JSON array format required
data = [
    {
        "username": "your_username",
        "password": "your_password",
        "limit": 100
    }
]

response = requests.post(url, json=data)
statuses = response.json()
print(statuses)
Node.js
const https = require('https');

// JSON array format required
const data = JSON.stringify([
    {
        username: 'your_username',
        password: 'your_password',
        limit: 100
    }
]);

const options = {
    hostname: 'www.bestsmsbulk.com',
    path: '/bestsmsbulkapi/getSmsStatusJson.php',
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Content-Length': Buffer.byteLength(data)
    }
};

const req = https.request(options, (res) => {
    let body = '';
    res.on('data', chunk => body += chunk);
    res.on('end', () => console.log(JSON.parse(body)));
});

req.write(data);
req.end();

Success Response

[
  {
    "ack": "12345678",
    "opstatus": "DELIVERED",
    "recipient": "96170123456"
  },
  {
    "ack": "12345679",
    "opstatus": "PENDING",
    "recipient": "96170789012"
  }
]

Possible opstatus Values

StatusDescription
DELIVEREDMessage delivered successfully
PENDINGMessage queued, awaiting delivery
FAILEDMessage delivery failed
SENTMessage sent to carrier

Error Responses

ResponseDescription
wrong json formatMalformed JSON body
{"status": 300, "message": "username Field is empty"}Username missing
{"status": 300, "message": "password Field is empty"}Password missing
{"status": 300, "message": "Wrong username/password"}Invalid credentials
No msgs sent todayNo messages found for today
4
Combined SMS & WhatsApp
GET POST
https://www.bestsmsbulk.com/bestsmsbulkapi/common/sendSmsWpAPITemplate.php
ParameterDescription
usernameRequiredYour BSB username
passwordRequiredYour BSB password
destinationRequiredPhone number(s), separated by ;
routeRequiredsms or wp (WhatsApp)
messageSMS OnlySMS message content
senderidSMS OnlySender ID (case sensitive)
templateWhatsAppApproved template name
variablesWhatsAppTemplate variables (comma-separated)
mediaWhatsAppMedia file URL

Success Response (Plain Text)

confirmationID;recipientNumber;numSMSParts

Example: 110099887;96170123456;1

Error Responses (Plain Text)

ResponseDescription
username Field is emptyUsername parameter missing
password Field is emptyPassword parameter missing
destination Field is emptyDestination parameter missing
Wrong username/passwordInvalid credentials
API key is set, you cannot use this API linkUse Secured API instead
No creditsInsufficient balance
5
WhatsApp OTP
GET POST
https://www.bestsmsbulk.com/bestsmsbulkapi/common/sendSmsWpAPI.php
ParameterDescription
usernameRequiredYour BSB username
passwordRequiredYour BSB password
destinationRequiredPhone number(s)
messageRequiredOTP code only (e.g., "123456")
routeRequiredsms or wp

OTP Message Format

For WhatsApp OTP, the message will be sent as: "[YOUR_OTP] is your verification code. For your security, do not share this code."

Success Response (Plain Text)

confirmationID;recipientNumber;numSMSParts

Example: 110099887;96170123456;1

Error Responses (Plain Text)

ResponseDescription
username Field is emptyUsername parameter missing
password Field is emptyPassword parameter missing
message Field is emptyMessage PArameter is missing
destination Field is emptyDestination parameter missing
Wrong username/passwordInvalid credentials
API key is set, you cannot use this API linkUse Secured API instead
No creditsInsufficient balance
6
Secured Messaging API
POST API Key Required

API Key Authentication Required

This endpoint requires an API-Key header. Generate your API key from the admin panel.

https://www.bestsmsbulk.com/bestsmsbulkapi/common/messaging_api_secured_json.php

Required Headers

HeaderValue
API-KeyRequiredYour unique API key
Content-TypeRequiredapplication/json

Request Body (JSON)

ParameterTypeDescription
usernameRequiredstringYour BSB username
passwordRequiredstringYour BSB password
destinationRequiredstringPhone number(s), separated by ;
messageRequiredstringMessage content
routeOptionalstringsms or wp (default: wp)
senderidSMS OnlystringSender ID for SMS
templateWhatsAppstringWhatsApp template name
variablesWhatsAppstringTemplate variables (comma-separated)
PHP
<?php
$url = "https://www.bestsmsbulk.com/bestsmsbulkapi/common/messaging_api_secured_json.php";

$data = [
    'username'    => 'your_username',
    'password'    => 'your_password',
    'destination' => '96170123456',
    'message'     => 'Hello from Secured API!',
    'route'       => 'wp',
    'template'    => 'your_template',
    'variables'   => 'var1,var2'
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'API-Key: YOUR_API_KEY_HERE'  // Required!
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

echo "HTTP Code: $httpCode\n";
echo "Response: $response";
?>
C#
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main()
    {
        using var client = new HttpClient();
        
        // Add required API-Key header
        client.DefaultRequestHeaders.Add("API-Key", "YOUR_API_KEY_HERE");
        
        var data = new
        {
            username = "your_username",
            password = "your_password",
            destination = "96170123456",
            message = "Hello from Secured API!",
            route = "wp",
            template = "your_template",
            variables = "var1,var2"
        };

        var json = JsonSerializer.Serialize(data);
        var content = new StringContent(json, Encoding.UTF8, "application/json");
        
        var response = await client.PostAsync(
            "https://www.bestsmsbulk.com/bestsmsbulkapi/common/messaging_api_secured_json.php",
            content
        );

        Console.WriteLine($"Status: {response.StatusCode}");
        Console.WriteLine(await response.Content.ReadAsStringAsync());
    }
}
Python
import requests
import json

url = "https://www.bestsmsbulk.com/bestsmsbulkapi/common/messaging_api_secured_json.php"

headers = {
    "Content-Type": "application/json",
    "API-Key": "YOUR_API_KEY_HERE"  # Required!
}

data = {
    "username": "your_username",
    "password": "your_password",
    "destination": "96170123456",
    "message": "Hello from Secured API!",
    "route": "wp",
    "template": "your_template",
    "variables": "var1,var2"
}

response = requests.post(url, json=data, headers=headers)

print(f"Status Code: {response.status_code}")
print(f"Response: {response.json()}")
Node.js
const https = require('https');

const data = JSON.stringify({
    username: 'your_username',
    password: 'your_password',
    destination: '96170123456',
    message: 'Hello from Secured API!',
    route: 'wp',
    template: 'your_template',
    variables: 'var1,var2'
});

const options = {
    hostname: 'www.bestsmsbulk.com',
    path: '/bestsmsbulkapi/common/messaging_api_secured_json.php',
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'API-Key': 'YOUR_API_KEY_HERE',  // Required!
        'Content-Length': Buffer.byteLength(data)
    }
};

const req = https.request(options, (res) => {
    let body = '';
    res.on('data', chunk => body += chunk);
    res.on('end', () => {
        console.log('Status:', res.statusCode);
        console.log('Response:', JSON.parse(body));
    });
});

req.write(data);
req.end();

Success Response - SMS

[
  {
    "message": "SMS message sent successfully",
    "status": 200,
    "confirmationid": 12345678,
    "recipient": "96170123456",
    "numberofunits": 1
  }
]

Success Response - WhatsApp

[
  {
    "message": "WhatsApp message sent successfully",
    "status": 200,
    "confirmationid": 12345678,
    "recipient": "96170123456"
  }
]

Error Responses

HTTP CodeResponseDescription
403{"status": 403, "message": "Forbidden: Missing API Key"}API-Key header missing
403{"status": 403, "message": "Forbidden: Invalid API Key"}API key not found or inactive
400{"status": 400, "message": "Invalid JSON input"}Malformed JSON body
400{"status": 400, "message": "Username mismatch or empty"}Username doesn't match API key
400{"status": 400, "message": "Password is required"}Password missing
400{"status": 400, "message": "Destination is required"}Destination missing
400{"status": 400, "message": "Message is required"}Message missing (SMS route)
401{"status": 401, "message": "Wrong username/password"}Invalid credentials
400{"status": 400, "message": "senderid is not authorized"}Sender ID not approved
400{"status": 400, "message": "No credits"}Insufficient balance
7
BSB AI Chatbot API
POST API Key Required

AI-Powered Chatbot Integration

Integrate our intelligent chatbot into your application. Requires API-Key header for authentication.

https://www.bestsmsbulk.com/bestsmsbulkapi/bsbaichatbot/bsb_ai_chatbot_api.php

Request Body (JSON)

ParameterDescription
usernameRequiredYour BSB username
passwordRequiredYour BSB password
messageRequiredUser message to the chatbot
fromRequiredUser identifier/phone number
dateOptionalDate (YYYY-MM-DD)
timeOptionalTime (HH:mm:ss)

Success Response

{
  "status": "success",
  "message": "Hi there! 👋 How can I assist you today?"
}

Error Responses

HTTP CodeResponseDescription
405Method Not Allowed: Only POST requests are accepted.Only POST method allowed
403{"status": 403, "message": "Forbidden: Missing API Key"}API-Key header missing
403{"status": 403, "message": "Forbidden: Invalid API Key"}API key not valid
400{"status": 400, "message": "Invalid JSON input"}Malformed JSON body
400{"status": 400, "message": "Username mismatch or empty"}Username doesn't match API key
400{"status": 400, "message": "Password is required"}Password missing
400{"status": 400, "message": "Destination is required"}'from' field missing
400{"status": 400, "message": "Message is required"}Message missing
401{"status": 401, "message": "Wrong username/password"}Invalid credentials

HTTP Status Codes

200 Success
400 Bad Request
401 Unauthorized
403 Forbidden
405 Method Not Allowed
500 Server Error

Need Help?

Our support team is here to assist you with any questions or issues.