Don't have an account with us? continue to sign up for freeSign Up Now


SMS API

Use our SMS Gateway API

Connect your application with our API and start sending SMSes today. Easily SMS-enable your website, application or customer relationship management platform with our REST API.


View Our Pricing    Comprehensive Documentation



User-friendly Documentation

We offer comprehensive documentation that is easy to access and includes code samples. Our API supports Unicode and long messages, and allows for multiple web hooks to create and customise any workflow.



SMS Messaging API

You can use BSMS's HTTP SMS API to send SMS to anywhere in the Pakistan.

SMS gateway

HOW TO SEND SMS MESSAGES WITH BSMS'S SMS API?



   Make HTTPS request to SMS Messaging API.

   Check the response code and store returned Transaction ID to match DLR later.

   SMS is sent to the handset.

   Handset responds with Delivery Report (DLR).

   If DLR callback URL was configured in API Settings, BSMS forwards the DLR to you with the same Transaction ID.

Getting Started

Setup is quick, easy and free. You can be sending SMS messages in just a few minutes!

Android Sample Code

StringRequest registerRequest = new StringRequest(Request.Method.POST, "https://cp.bsms.pk/api/quick/message",
    new Response.Listener() {
        @Override
        public void onResponse(String response) {
            pDialog.dismiss();
            try {
                JSONObject object = new JSONObject(response);
                Log.d("Response from API", "onResponse: " + response);
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    },
    new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
            new VolleyErrorManager(error, mContext,"Exception: ");
        }
    }
) {
    @Override
    protected Map getParams() {
        Map  params = new HashMap();
        params.put("user", "username");
        params.put("password", "secret");
        params.put("to", "923123456789");
        params.put("mask", "BrainTEL");
        params.put("message", "Your message");

        return params;
    }
};

Node.js Sample Code

var Request = require("request");

Request.post({
    "headers": { "content-type": "application/json" },
    "url": "https://cp.bsms.pk/api/quick/message",
    "body": JSON.stringify({
        "user": "username", "password": "secret", "to": "923123456789", "mask": "BrainTEL", "message": "Your message"
    })
}, (error, response, body) => {
    if(error) {
        return console.dir(error);
    }
    console.dir(JSON.parse(body));
});

Swift Sample Code

let params = ["user": "username", "password": "secret", "to": "923123456789", "mask": "BrainTEL", "message": "Your message"] as Dictionary

var request = URLRequest(url: URL(string: "https://cp.bsms.pk/api/quick/message")!)
request.httpMethod = "POST"
request.httpBody = try? JSONSerialization.data(withJSONObject: params, options: [])
request.addValue("application/json", forHTTPHeaderField: "Content-Type")

let session = URLSession.shared
let task = session.dataTask(with: request, completionHandler: { data, response, error -> Void in
    do {
        let json = try JSONSerialization.jsonObject(with: data!) as! Dictionary
        print(json)
    } catch {
        print("error")
    }
})
task.resume()

.NET Sample Code

using System;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;

namespace HttpClientSample
{
    public class Message
    {
        public string user { get; set; }
        public string password { get; set; }
        public int to { get; set; }
        public string mask { get; set; }
        public string message { get; set; }
    }

    class Program
    {
        static HttpClient client = new HttpClient();

        static async Task CreateMessageAsync(Message message)
        {
            HttpResponseMessage response = await client.PostAsJsonAsync(
                "api/quick/message", message);
            response.EnsureSuccessStatusCode();
            return response.Headers.Location;
        }

        static async Task SendMessageAsync(string path)
        {
            Message message = null;
            HttpResponseMessage response = await client.GetAsync(path);
            if (response.IsSuccessStatusCode)
            {
                message = await response.Content.ReadAsStringAsync();
            }
            return message;
        }
                                            static void Main()
        {
            RunAsync().GetAwaiter().GetResult();
        }

        static async Task RunAsync()
        {
            client.BaseAddress = new Uri("https://cp.bsms.pk/");
            client.DefaultRequestHeaders.Accept.Clear();
            client.DefaultRequestHeaders.Accept.Add(
            new MediaTypeWithQualityHeaderValue("application/json"));

            try {
                Message message = new Message
                {
                    user = "username",
                    password = "secret",
                    to = "923123456789",
                    mask = "BrainTEL",
                    message = "Your Message"
                };
                var url = await CreateMessageAsync(message);
                Console.WriteLine($"Created at {url}");

                message = await GetProductAsync(url.PathAndQuery);
                Console.WriteLine(message);
            }
            catch (Exception e) {
                Console.WriteLine(e.Message);
            }
            Console.ReadLine();
        }
    }
}

Python Sample Code

import requests
payload = {'user': 'username', 'password': 'secret', 'to': '923123456789', 'mask': 'BrainTEL', 'message': 'Your message'}
r = requests.get('https://cp.bsms.pk/api/quick/message', params=payload)
r.text

PHP Sample Code

function httpPost($url,$params)
{
    $postData = '';
    foreach($params as $k => $v) {
        $postData .= $k . '='.$v.'&';
    }
    $postData = rtrim($postData, '&');

    $ch = curl_init();
    curl_setopt($ch,CURLOPT_URL,$url);
    curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
    curl_setopt($ch,CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_POST, count($postData));
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
    $output = curl_exec($ch);
    curl_close($ch);
    return $output;
}

$url = "https://cp.bsms.pk/api/quick/message";
$params = [
    "user" => "username",
    "password" => "password",
    "mask" => "BrainTEL",
    "to" => "923123456789",
    "message" => "Your Message",
];
httpPost($url,$params);

Want to know more?

Our Docs are such friendly that a normal user can also integrate API without deep knowledge.

Comprehensive Documentation