BSB Messaging API
Powerful, reliable messaging infrastructure for SMS and WhatsApp. Build seamless communication experiences with our developer-friendly API.
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
Parameters
| Parameter | Description |
|---|---|
| usernameRequired | Your BSB username |
| passwordRequired | Your BSB password |
| messageRequired | SMS content to send |
| senderidRequired | Sender ID (case sensitive) |
| destinationRequired | Phone number(s) in format: 96170XXXXXX. Multiple numbers separated by ; |
| dateOptional | Schedule date (YYYY-MM-DD) |
| timeOptional | Schedule time (HH:mm, 24h format) |
<?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
?>
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());
}
}
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
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)
| Response | Description |
|---|---|
username Field is empty | Username parameter missing |
password Field is empty | Password parameter missing |
message Field is empty | Message parameter missing |
destination Field is empty | Destination parameter missing |
senderid is not authorized | Sender ID not approved for your account |
Wrong username/password | Invalid credentials |
API key is set, you cannot use this API link | Use Secured API instead |
No credits | Insufficient balance |
Error 101 | Balance update failed |
Error 102 | Message insertion failed |
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.
Request Body (JSON Array)
| Parameter | Description |
|---|---|
| usernameRequired | Your BSB username |
| passwordRequired | Your BSB password |
| messageRequired | SMS content to send |
| senderidRequired | Sender ID (case sensitive) |
| destinationRequired | Phone number(s), separated by ; |
| dateOptional | Schedule date (YYYY-MM-DD) |
| timeOptional | Schedule time (HH:mm:ss) |
<?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);
?>
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())
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
| Response | Description |
|---|---|
{"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 |
JSON Array Input Required
This endpoint accepts a JSON array with your credentials. Set Content-Type: application/json header.
Request Body (JSON Array)
| Parameter | Description |
|---|---|
| usernameRequired | Your BSB username |
| passwordRequired | Your BSB password |
| limitOptional | Number of statuses to retrieve (default: 1000) |
<?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);
?>
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)
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
| Status | Description |
|---|---|
DELIVERED | Message delivered successfully |
PENDING | Message queued, awaiting delivery |
FAILED | Message delivery failed |
SENT | Message sent to carrier |
Error Responses
| Response | Description |
|---|---|
wrong 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": "Wrong username/password"} | Invalid credentials |
No msgs sent today | No messages found for today |
| Parameter | Description |
|---|---|
| usernameRequired | Your BSB username |
| passwordRequired | Your BSB password |
| destinationRequired | Phone number(s), separated by ; |
| routeRequired | sms or wp (WhatsApp) |
| messageSMS Only | SMS message content |
| senderidSMS Only | Sender ID (case sensitive) |
| templateWhatsApp | Approved template name |
| variablesWhatsApp | Template variables (comma-separated) |
| mediaWhatsApp | Media file URL |
Success Response (Plain Text)
confirmationID;recipientNumber;numSMSParts
Example: 110099887;96170123456;1
Error Responses (Plain Text)
| Response | Description |
|---|---|
username Field is empty | Username parameter missing |
password Field is empty | Password parameter missing |
destination Field is empty | Destination parameter missing |
Wrong username/password | Invalid credentials |
API key is set, you cannot use this API link | Use Secured API instead |
No credits | Insufficient balance |
| Parameter | Description |
|---|---|
| usernameRequired | Your BSB username |
| passwordRequired | Your BSB password |
| destinationRequired | Phone number(s) |
| messageRequired | OTP code only (e.g., "123456") |
| routeRequired | sms 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)
| Response | Description |
|---|---|
username Field is empty | Username parameter missing |
password Field is empty | Password parameter missing |
message Field is empty | Message PArameter is missing |
destination Field is empty | Destination parameter missing |
Wrong username/password | Invalid credentials |
API key is set, you cannot use this API link | Use Secured API instead |
No credits | Insufficient balance |
API Key Authentication Required
This endpoint requires an API-Key header. Generate your API key from the admin panel.
Required Headers
| Header | Value |
|---|---|
| API-KeyRequired | Your unique API key |
| Content-TypeRequired | application/json |
Request Body (JSON)
| Parameter | Type | Description |
|---|---|---|
| usernameRequired | string | Your BSB username |
| passwordRequired | string | Your BSB password |
| destinationRequired | string | Phone number(s), separated by ; |
| messageRequired | string | Message content |
| routeOptional | string | sms or wp (default: wp) |
| senderidSMS Only | string | Sender ID for SMS |
| templateWhatsApp | string | WhatsApp template name |
| variablesWhatsApp | string | Template variables (comma-separated) |
<?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";
?>
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());
}
}
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()}")
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 Code | Response | Description |
|---|---|---|
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 |
AI-Powered Chatbot Integration
Integrate our intelligent chatbot into your application. Requires API-Key header for authentication.
Request Body (JSON)
| Parameter | Description |
|---|---|
| usernameRequired | Your BSB username |
| passwordRequired | Your BSB password |
| messageRequired | User message to the chatbot |
| fromRequired | User identifier/phone number |
| dateOptional | Date (YYYY-MM-DD) |
| timeOptional | Time (HH:mm:ss) |
Success Response
{
"status": "success",
"message": "Hi there! 👋 How can I assist you today?"
}
Error Responses
| HTTP Code | Response | Description |
|---|---|---|
405 | Method 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
Need Help?
Our support team is here to assist you with any questions or issues.