NAV
cURL PHP JAVA C# C Python Ruby JavaScript NodeJS

Overview

SMS Gateway API. Our Bulk SMS API work with PHP, JAVA, C#, C, Python, Ruby, Javascript, NodeJS, etc. Secure, robust and easy to integrate APIs to send DLT Approved SMS, Promotional SMS, Service Implicit SMS, Service Explicit SMS via REST API. Check Bulk SMS Price here.

Authorization Key

Fast2SMS expects for the API Key to be included in all API requests to the server in a header for POST requests & in query parameters for GET requests.
Get Your API Authorization Key from Fast2SMS Dev API section for FREE which you need to add in each API request as following:

GET https://www.fast2sms.com/dev/wallet?authorization=YOUR_API_KEY

POST authorization: YOUR_API_KEY

DLT SMS API

You can use DLT SMS API to send your DLT approved SMS from Fast2SMS.

Service Implicit/Inferred: All Transactional SMS will come under this category like OTP, Alerts, Informative SMS. This route is for all numbers (DND+NonDND) & will work 24×7.

Service Explicit: All type of promotional or marketing SMS will come under this category. This route can only deliver SMS on NonDND numbers from 10 AM to 9 PM only.

You first need to submit your DLT approved message in Fast2SMS & once Fast2SMS will add your message text you can use this API for sending Bulk SMS.

GET Method

GET https://www.fast2sms.com/dev/bulkV2

curl -X GET \
  'https://www.fast2sms.com/dev/bulkV2?authorization=YOUR_API_KEY&sender_id=DLT_SENDER_ID&message=YOUR_MESSAGE_ID&variables_values=12345|asdaswdx&route=dlt&numbers=9999999999,8888888888,7777777777'
<?php
          
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://www.fast2sms.com/dev/bulkV2?authorization=YOUR_API_KEY&sender_id=DLT_SENDER_ID&message=".urlencode('YOUR_MESSAGE_ID')."&variables_values=".urlencode('12345|asdaswdx')."&route=dlt&numbers=".urlencode('9999999999,8888888888,7777777777'),
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_SSL_VERIFYHOST => 0,
  CURLOPT_SSL_VERIFYPEER => 0,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "cache-control: no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://www.fast2sms.com/dev/bulkV2?authorization=YOUR_API_KEY&sender_id=DLT_SENDER_ID&message=YOUR_MESSAGE_ID&variables_values=12345|asdaswdx&route=dlt&numbers=9999999999,8888888888,7777777777",
  "method": "GET"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
require 'uri'
require 'net/http'

url = URI("https://www.fast2sms.com/dev/bulkV2?authorization=YOUR_API_KEY&sender_id=DLT_SENDER_ID&message=YOUR_MESSAGE_ID&route=dlt&numbers=9999999999,8888888888,7777777777")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["cache-control"] = 'no-cache'

response = http.request(request)
puts response.read_body
import requests

url = "https://www.fast2sms.com/dev/bulkV2"

querystring = {"authorization":"YOUR_API_KEY","sender_id":"DLT_SENDER_ID","message":"YOUR_MESSAGE_ID","variables_values":"12345|asdaswdx","route":"dlt","numbers":"9999999999,8888888888,7777777777"}

headers = {
    'cache-control': "no-cache"
}

response = requests.request("GET", url, headers=headers, params=querystring)

print(response.text)
HttpResponse response = Unirest.get("https://www.fast2sms.com/dev/bulkV2?authorization=YOUR_API_KEY&sender_id=DLT_SENDER_ID&message=YOUR_MESSAGE_ID&variables_values=12345|asdaswdx&route=dlt&numbers=9999999999,8888888888,7777777777")
  .header("cache-control", "no-cache")
  .asString();
var client = new RestClient("https://www.fast2sms.com/dev/bulkV2?authorization=YOUR_API_KEY&sender_id=DLT_SENDER_ID&message=YOUR_MESSAGE_ID&variables_values=12345|asdaswdx&route=dlt&numbers=9999999999,8888888888,7777777777");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "https://www.fast2sms.com/dev/bulkV2?authorization=YOUR_API_KEY&sender_id=DLT_SENDER_ID&message=YOUR_MESSAGE_ID&variables_values=12345|asdaswdx&route=dlt&numbers=9999999999,8888888888,7777777777");

CURLcode ret = curl_easy_perform(hnd);
var unirest = require("unirest");

var req = unirest("GET", "https://www.fast2sms.com/dev/bulkV2");

req.query({
  "authorization": "YOUR_API_KEY",
  "sender_id": "DLT_SENDER_ID",
  "message": "YOUR_MESSAGE_ID",
  "variables_values": "12345|asdaswdx",
  "route": "dlt",
  "numbers": "9999999999,8888888888,7777777777",
});

req.headers({
  "cache-control": "no-cache"
});


req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});

DLT Route Success Response:
{
    "return": true,
    "request_id": "lwdtp7cjyqxvfe9",
    "message": [
        "Message sent successfully"
    ]
}

Following are the parameter to be used for GET API:

HTTP Request

GET https://www.fast2sms.com/dev/bulkV2

Body

Parameter Required Description
authorization true Provide "YOUR_API_KEY". Sign up for API Key
sender_id true Your 6 digit DLT approved Sender ID like "FSTSMS", before using you need to first submit it to Fast2SMS for approval here.
message true Your Message_ID like, "111111" you can get your approved Message ID here.
variables_values true If you've used {#var#} inside your DLT approved SMS then you can submit values for those variables like: "Rahul|8888888888|6695" seperated by pipe "|".

NOTE:
1) Use the same variable sequence in which you've approved in message template.
2) If your message don't have any variables you can skip variables_values field.
route true For DLT SMS use "dlt"
numbers true You can send multiple mobile numbers seperated by comma like: "8888888888,9999999999,6666666666"
flash false This field is optional, it will use "0" as default value or you can set to "1" for sending flash message.

POST Method

POST https://www.fast2sms.com/dev/bulkV2

curl -X POST \
  https://www.fast2sms.com/dev/bulkV2 \
  -H 'authorization: YOUR_API_KEY' \
  -d 'sender_id=DLT_SENDER_ID&message=YOUR_MESSAGE_ID&variables_values=12345|asdaswdx&route=dlt&numbers=9999999999,8888888888,7777777777'
<?php

$fields = array(
    "sender_id" => "DLT_SENDER_ID",
    "message" => "YOUR_MESSAGE_ID",
    "variables_values" => "12345|asdaswdx",
    "route" => "dlt",
    "numbers" => "9999999999,8888888888,7777777777",
);

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://www.fast2sms.com/dev/bulkV2",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_SSL_VERIFYHOST => 0,
  CURLOPT_SSL_VERIFYPEER => 0,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode($fields),
  CURLOPT_HTTPHEADER => array(
    "authorization: YOUR_API_KEY",
    "accept: */*",
    "cache-control: no-cache",
    "content-type: application/json"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://www.fast2sms.com/dev/bulkV2",
  "method": "POST",
  "headers": {
    "authorization": "YOUR_API_KEY",
  },
  "data": {
    "sender_id": "DLT_SENDER_ID",
    "message": "YOUR_MESSAGE_ID",
    "route": "dlt",
    "variables_values": "12345|asdaswdx",
    "numbers": "9999999999,8888888888,7777777777",
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
require 'uri'
require 'net/http'

url = URI("https://www.fast2sms.com/dev/bulkV2")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["authorization"] = 'YOUR_API_KEY'
request.body = "sender_id=DLT_SENDER_ID&message=YOUR_MESSAGE_ID&variables_values=12345|asdaswdx&route=dlt&numbers=9999999999,8888888888,7777777777"

response = http.request(request)
puts response.read_body
import requests

url = "https://www.fast2sms.com/dev/bulkV2"

payload = "sender_id=DLT_SENDER_ID&message=YOUR_MESSAGE_ID&variables_values=12345|asdaswdx&route=dlt&numbers=9999999999,8888888888,7777777777"
headers = {
    'authorization': "YOUR_API_KEY",
    'Content-Type': "application/x-www-form-urlencoded",
    'Cache-Control': "no-cache",
    }

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
HttpResponse response = Unirest.post("https://www.fast2sms.com/dev/bulkV2")
  .header("authorization", "YOUR_API_KEY")
  .header("Content-Type", "application/x-www-form-urlencoded")
  .body("sender_id=DLT_SENDER_ID&message=YOUR_MESSAGE_ID&variables_values=12345|asdaswdx&route=dlt&numbers=9999999999,8888888888,7777777777")
  .asString();
var client = new RestClient("https://www.fast2sms.com/dev/bulkV2");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/x-www-form-urlencoded");
request.AddHeader("authorization", "YOUR_API_KEY");
request.AddParameter("sender_id", "DLT_SENDER_ID");
request.AddParameter(message", "YOUR_MESSAGE_ID");
request.AddParameter("variables_values", "12345|asdaswdx");
request.AddParameter("route", "dlt");
request.AddParameter("numbers", "9999999999,8888888888,7777777777");
IRestResponse response = client.Execute(request);
CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "https://www.fast2sms.com/dev/bulkV2");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/x-www-form-urlencoded");
headers = curl_slist_append(headers, "authorization: YOUR_API_KEY");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "sender_id=DLT_SENDER_ID&message=YOUR_MESSAGE_ID&variables_values=12345|asdaswdx&route=dlt&numbers=9999999999,8888888888,7777777777");

CURLcode ret = curl_easy_perform(hnd);
var unirest = require("unirest");

var req = unirest("POST", "https://www.fast2sms.com/dev/bulkV2");

req.headers({
  "authorization": "YOUR_API_KEY"
});

req.form({
  "sender_id": "DLT_SENDER_ID",
  "message": "YOUR_MESSAGE_ID",
  "variables_values": "123456787|asdaswdx",
  "route": "dlt",
  "numbers": "9999999999,8888888888,7777777777",
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});

DLT Route Success Response:
{
    "return": true,
    "request_id": "lwdtp7cjyqxvfe9",
    "message": [
        "Message sent successfully"
    ]
}

Following are the parameter to be used for POST API:

HTTP Request

POST https://www.fast2sms.com/dev/bulkV2

Headers

Parameter Required Description
authorization true Provide "YOUR_API_KEY". Sign up for API Key
sender_id true Your 6 digit DLT approved Sender ID like "FSTSMS", before using you need to first submit it to Fast2SMS for approval here.
message true Your Message_ID like, "111111" you can get your approved Message ID here.
variables_values true If you've used {#var#} inside your DLT approved SMS then you can submit values for those variables like: "Rahul|8888888888|6695" seperated by pipe "|".

NOTE:
1) Use the same variable sequence in which you've approved in message template.
2) If your message don't have any variables you can skip variables_values field.
route true For DLT SMS use "dlt"
numbers true You can send multiple mobile numbers seperated by comma like: "8888888888,9999999999,6666666666"
flash false This field is optional, it will use "0" as default value or you can set to "1" for sending flash message.

Quick SMS API

You can use Quick SMS API to send SMS without DLT approval

Use this premium route for sending SMS without DLT approval. SMS will be sent via random numeric Sender ID on all Indian numbers (including DND). No need of DLT registration, Send SMS 24*7 (OPEN TEMPLATE).

GET Method

GET https://www.fast2sms.com/dev/bulkV2

curl -X GET \
  'https://www.fast2sms.com/dev/bulkV2?authorization=YOUR_API_KEY&message=This is test message&language=english&route=q&numbers=9999999999,8888888888,7777777777'
<?php
          
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://www.fast2sms.com/dev/bulkV2?authorization=YOUR_API_KEY&message=".urlencode('This is a test message')."&language=english&route=q&numbers=".urlencode('9999999999,8888888888,7777777777'),
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_SSL_VERIFYHOST => 0,
  CURLOPT_SSL_VERIFYPEER => 0,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "cache-control: no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://www.fast2sms.com/dev/bulkV2?authorization=YOUR_API_KEY&message=This is test message&language=english&route=q&numbers=9999999999,8888888888,7777777777",
  "method": "GET"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
require 'uri'
require 'net/http'

url = URI("https://www.fast2sms.com/dev/bulkV2?authorization=YOUR_API_KEY&message=This is a test message&language=english&route=q&numbers=9999999999,8888888888,7777777777")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["cache-control"] = 'no-cache'

response = http.request(request)
puts response.read_body
import requests

url = "https://www.fast2sms.com/dev/bulkV2"

querystring = {"authorization":"YOUR_API_KEY","message":"This is test message","language":"english","route":"q","numbers":"9999999999,8888888888,7777777777"}

headers = {
    'cache-control': "no-cache"
}

response = requests.request("GET", url, headers=headers, params=querystring)

print(response.text)
HttpResponse response = Unirest.get("https://www.fast2sms.com/dev/bulkV2?authorization=YOUR_API_KEY&message=This%20is%20a%20test%20message&language=english&route=q&numbers=9999999999,8888888888,7777777777")
  .header("cache-control", "no-cache")
  .asString();
var client = new RestClient("https://www.fast2sms.com/dev/bulkV2?authorization=YOUR_API_KEY&message=This%20is%20a%20test%20message&language=english&route=q&numbers=9999999999,8888888888,7777777777");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "https://www.fast2sms.com/dev/bulkV2?authorization=YOUR_API_KEY&message=This%20is%20a%20test%20message&language=english&route=q&numbers=9999999999,8888888888,7777777777");

CURLcode ret = curl_easy_perform(hnd);
var unirest = require("unirest");

var req = unirest("GET", "https://www.fast2sms.com/dev/bulkV2");

req.query({
  "authorization": "YOUR_API_KEY",
  "message": "This is a test message",
  "language": "english",
  "route": "q",
  "numbers": "9999999999,8888888888,7777777777",
});

req.headers({
  "cache-control": "no-cache"
});


req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});

Quick SMS Route Success Response:
{
    "return": true,
    "request_id": "lwdtp7cjyqxvfe9",
    "message": [
        "Message sent successfully"
    ]
}

Following are the parameter to be used for GET API:

HTTP Request

GET https://www.fast2sms.com/dev/bulkV2

Body

Parameter Required Description
authorization true Provide "YOUR_API_KEY". Sign up for API Key
message true Message "text" to be sent
language false Default language is "english". API will detect "unicode" message automatically.
route true For Quick SMS use "q"
numbers true You can send multiple mobile numbers seperated by comma like: "8888888888,9999999999,6666666666"
flash false This field is optional, it will use "0" as default value or you can set to "1" for sending flash message.

POST Method

POST https://www.fast2sms.com/dev/bulkV2

curl -X POST \
  https://www.fast2sms.com/dev/bulkV2 \
  -H 'authorization: YOUR_API_KEY' \
  -d 'message=This is a test message&language=english&route=q&numbers=9999999999,8888888888,7777777777'
<?php

$fields = array(
    "message" => "This is test message",
    "language" => "english",
    "route" => "q",
    "numbers" => "9999999999,8888888888,7777777777",
);

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://www.fast2sms.com/dev/bulkV2",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_SSL_VERIFYHOST => 0,
  CURLOPT_SSL_VERIFYPEER => 0,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode($fields),
  CURLOPT_HTTPHEADER => array(
    "authorization: YOUR_API_KEY",
    "accept: */*",
    "cache-control: no-cache",
    "content-type: application/json"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://www.fast2sms.com/dev/bulkV2",
  "method": "POST",
  "headers": {
    "authorization": "YOUR_API_KEY",
  },
  "data": {
    "message": "This is a test message",
    "language": "english",
    "route": "q",
    "numbers": "9999999999,8888888888,7777777777",
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
require 'uri'
require 'net/http'

url = URI("https://www.fast2sms.com/dev/bulkV2")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["authorization"] = 'YOUR_API_KEY'
request.body = "message=This is a test message&language=english&route=q&numbers=9999999999,8888888888,7777777777"

response = http.request(request)
puts response.read_body
import requests

url = "https://www.fast2sms.com/dev/bulkV2"

payload = "message=This%20is%20a%20test%20message&language=english&route=q&numbers=9999999999,8888888888,7777777777"
headers = {
    'authorization': "YOUR_API_KEY",
    'Content-Type': "application/x-www-form-urlencoded",
    'Cache-Control': "no-cache",
    }

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
HttpResponse response = Unirest.post("https://www.fast2sms.com/dev/bulkV2")
  .header("authorization", "YOUR_API_KEY")
  .header("Content-Type", "application/x-www-form-urlencoded")
  .body("message=This%20is%20a%20test%20message&language=english&route=q&numbers=9999999999,8888888888,7777777777")
  .asString();
var client = new RestClient("https://www.fast2sms.com/dev/bulkV2");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/x-www-form-urlencoded");
request.AddHeader("authorization", "YOUR_API_KEY");
request.AddParameter(message", "This is a test message");
request.AddParameter("language", "english");
request.AddParameter("route", "q");
request.AddParameter("numbers", "9999999999,8888888888,7777777777");
IRestResponse response = client.Execute(request);
CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "https://www.fast2sms.com/dev/bulkV2");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/x-www-form-urlencoded");
headers = curl_slist_append(headers, "authorization: YOUR_API_KEY");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "message=This%20is%20a%20test%20message&language=english&route=q&numbers=9999999999,8888888888,7777777777");

CURLcode ret = curl_easy_perform(hnd);
var unirest = require("unirest");

var req = unirest("POST", "https://www.fast2sms.com/dev/bulkV2");

req.headers({
  "authorization": "YOUR_API_KEY"
});

req.form({
  "message": "This is a test message",
  "language": "english",
  "route": "q",
  "numbers": "9999999999,8888888888,7777777777",
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});

Quick SMS Route Success Response:
{
    "return": true,
    "request_id": "lwdtp7cjyqxvfe9",
    "message": [
        "Message sent successfully"
    ]
}

Following are the parameter to be used for POST API:

HTTP Request

POST https://www.fast2sms.com/dev/bulkV2

Headers

Parameter Description
authorization Provide "YOUR_API_KEY". Sign up for API Key

Body

Parameter Required Description
message true Message "text" to be sent
language false Default language is "english". API will detect "unicode" message automatically.
route true For Quick SMS use "q"
numbers true You can send multiple mobile numbers seperated by comma like: "8888888888,9999999999,6666666666"
flash false This field is optional, it will use "0" as default value or you can set to "1" for sending flash message.

Bulk SMS (Service) API

You can use Bulk SMS (service) route for sending OTP, Alerts based SMS from Fast2SMS approved Sender ID & Content Template.

Fast2SMS will provide you pre approved DLT templates for OTP, Alerts based SMS & you can use this route for sending SMS without DLT approval.

GET Method

GET https://www.fast2sms.com/dev/bulkV2

curl -X GET \
  'https://www.fast2sms.com/dev/bulkV2?authorization=YOUR_API_KEY&sender_id=TXTIND&message=This is a test message&route=v3&numbers=9999999999,8888888888,7777777777'
<?php
          
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://www.fast2sms.com/dev/bulkV2?authorization=YOUR_API_KEY&sender_id=TXTIND&message=".urlencode('This is a test message')."&route=v3&numbers=".urlencode('9999999999,8888888888,7777777777'),
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_SSL_VERIFYHOST => 0,
  CURLOPT_SSL_VERIFYPEER => 0,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "cache-control: no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://www.fast2sms.com/dev/bulkV2?authorization=YOUR_API_KEY&sender_id=TXTIND&message=This is a test message&route=v3&numbers=9999999999,8888888888,7777777777",
  "method": "GET"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
require 'uri'
require 'net/http'

url = URI("https://www.fast2sms.com/dev/bulkV2?authorization=YOUR_API_KEY&sender_id=TXTIND&message=This is a test message&route=v3&numbers=9999999999,8888888888,7777777777")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["cache-control"] = 'no-cache'

response = http.request(request)
puts response.read_body
import requests

url = "https://www.fast2sms.com/dev/bulkV2"

querystring = {"authorization":"YOUR_API_KEY","sender_id":"TXTIND","message":"This is a test message","route":"v3","numbers":"9999999999,8888888888,7777777777"}

headers = {
    'cache-control': "no-cache"
}

response = requests.request("GET", url, headers=headers, params=querystring)

print(response.text)
HttpResponse response = Unirest.get("https://www.fast2sms.com/dev/bulkV2?authorization=YOUR_API_KEY&sender_id=TXTIND&message=This is a test message&route=v3&numbers=9999999999,8888888888,7777777777")
  .header("cache-control", "no-cache")
  .asString();
var client = new RestClient("https://www.fast2sms.com/dev/bulkV2?authorization=YOUR_API_KEY&sender_id=TXTIND&message=This is a test message&route=v3&numbers=9999999999,8888888888,7777777777");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "https://www.fast2sms.com/dev/bulkV2?authorization=YOUR_API_KEY&sender_id=TXTIND&message=This is a test message&route=v3&numbers=9999999999,8888888888,7777777777");

CURLcode ret = curl_easy_perform(hnd);
var unirest = require("unirest");

var req = unirest("GET", "https://www.fast2sms.com/dev/bulkV2");

req.query({
  "authorization": "YOUR_API_KEY",
  "sender_id": "TXTIND",
  "message": "This is a test message",
  "route": "v3",
  "numbers": "9999999999,8888888888,7777777777"
});

req.headers({
  "cache-control": "no-cache"
});


req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});

Service Route Success Response:
{
    "return": true,
    "request_id": "lwdtp7cjyqxvfe9",
    "message": [
        "Message sent successfully"
    ]
}

Following are the parameter to be used for GET API:

HTTP Request

GET https://www.fast2sms.com/dev/bulkV2

Body

Parameter Required Description
authorization true Provide "YOUR_API_KEY". Sign up for API Key
sender_id true "TXTIND" is the default sender id
message true Message "text" to be sent
language false Default language is "english". API will detect "unicode" message automatically.
route true For Bulk SMS (Service) route use "v3"
numbers true You can send multiple mobile numbers seperated by comma like: "8888888888,9999999999,6666666666"
flash false This field is optional, it will use "0" as default value or you can set to "1" for sending flash message.

POST Method

POST https://www.fast2sms.com/dev/bulkV2

curl -X POST \
  https://www.fast2sms.com/dev/bulkV2 \
  -H 'authorization: YOUR_API_KEY' \
  -d 'sender_id=TXTIND&message=This is a test message&route=v3&numbers=9999999999,8888888888,7777777777'
<?php

$fields = array(
    "sender_id" => "TXTIND",
    "message" => "This is a test message",
    "route" => "v3",
    "numbers" => "9999999999,8888888888,7777777777",
);

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://www.fast2sms.com/dev/bulkV2",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_SSL_VERIFYHOST => 0,
  CURLOPT_SSL_VERIFYPEER => 0,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode($fields),
  CURLOPT_HTTPHEADER => array(
    "authorization: YOUR_API_KEY",
    "accept: */*",
    "cache-control: no-cache",
    "content-type: application/json"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://www.fast2sms.com/dev/bulkV2",
  "method": "POST",
  "headers": {
    "authorization": "YOUR_API_KEY",
  },
  "data": {
    "sender_id": "TXTIND",
    "message": "This is a test message",
    "route": "v3",
    "numbers": "9999999999,8888888888,7777777777",
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
require 'uri'
require 'net/http'

url = URI("https://www.fast2sms.com/dev/bulkV2")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["authorization"] = 'YOUR_API_KEY'
request.body = "sender_id=TXTIND&message=This is a test message&route=v3&numbers=9999999999,8888888888,7777777777"

response = http.request(request)
puts response.read_body
import requests

url = "https://www.fast2sms.com/dev/bulkV2"

payload = "sender_id=TXTIND&message=This is a test message&route=v3&numbers=9999999999,8888888888,7777777777"
headers = {
    'authorization': "YOUR_API_KEY",
    'Content-Type': "application/x-www-form-urlencoded",
    'Cache-Control': "no-cache",
    }

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
HttpResponse response = Unirest.post("https://www.fast2sms.com/dev/bulkV2")
  .header("authorization", "YOUR_API_KEY")
  .header("Content-Type", "application/x-www-form-urlencoded")
  .body("sender_id=TXTIND&message=This is a test message&route=v3&numbers=9999999999,8888888888,7777777777")
  .asString();
var client = new RestClient("https://www.fast2sms.com/dev/bulkV2");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/x-www-form-urlencoded");
request.AddHeader("authorization", "YOUR_API_KEY");
request.AddParameter("sender_id", "TXTIND");
request.AddParameter(message", "This is a test message");
request.AddParameter("route", "v3");
request.AddParameter("numbers", "9999999999,8888888888,7777777777");
IRestResponse response = client.Execute(request);
CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "https://www.fast2sms.com/dev/bulkV2");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/x-www-form-urlencoded");
headers = curl_slist_append(headers, "authorization: YOUR_API_KEY");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "sender_id=TXTIND&message=This is a test message&language=englishroute=v3&numbers=9999999999,8888888888,7777777777");

CURLcode ret = curl_easy_perform(hnd);
var unirest = require("unirest");

var req = unirest("POST", "https://www.fast2sms.com/dev/bulkV2");

req.headers({
  "authorization": "YOUR_API_KEY"
});

req.form({
  "sender_id": "TXTIND",
  "message": "This is a test message",
  "route": "v3",
  "numbers": "9999999999,8888888888,7777777777",
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});

Service Route Success Response:
{
    "return": true,
    "request_id": "lwdtp7cjyqxvfe9",
    "message": [
        "Message sent successfully"
    ]
}

Following are the parameter to be used for POST API:

HTTP Request

POST https://www.fast2sms.com/dev/bulkV2

Headers

Parameter Description
authorization Provide "YOUR_API_KEY". Sign up for API Key

Body

Parameter Required Description
sender_id true "TXTIND" is the default sender id
message true Message"text" to be sent
language false Default language is "english". API will detect "unicode" message automatically.
route true For Bulk SMS (Service) route use "v3"
numbers true You can send multiple mobile numbers seperated by comma like: "8888888888,9999999999,6666666666"
flash false This field is optional, it will use "0" as default value or you can set to "1" for sending flash message.

Wallet Balance API

GET https://www.fast2sms.com/dev/wallet?authorization=YOUR_API_KEY

curl -X POST \
  https://www.fast2sms.com/dev/wallet \
  -H 'authorization: YOUR_API_KEY'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://www.fast2sms.com/dev/wallet",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_SSL_VERIFYHOST => 0,
  CURLOPT_SSL_VERIFYPEER => 0,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_HTTPHEADER => array(
    "authorization: YOUR_API_KEY"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://www.fast2sms.com/dev/wallet",
  "method": "POST",
  "headers": {
    "authorization": "YOUR_API_KEY"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
require 'uri'
require 'net/http'

url = URI("https://www.fast2sms.com/dev/wallet")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["authorization"] = 'YOUR_API_KEY'

response = http.request(request)
puts response.read_body
import requests

url = "https://www.fast2sms.com/dev/wallet"

headers = {
    'authorization': "YOUR_API_KEY",
    }

response = requests.request("POST", url, headers=headers)

print(response.text)
var client = new RestClient("https://www.fast2sms.com/dev/wallet?authorization=YOUR_API_KEY");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "https://www.fast2sms.com/dev/wallet?authorization=YOUR_API_KEY");

CURLcode ret = curl_easy_perform(hnd);
HttpResponse response = Unirest.post("https://www.fast2sms.com/dev/wallet")
  .header("authorization", "YOUR_API_KEY")
  .asString();
var unirest = require("unirest");

var req = unirest("POST", "https://www.fast2sms.com/dev/wallet");

req.headers({
  "authorization": "YOUR_API_KEY"
});


req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
Wallet Balance Success Response
{
    "return": true,
    "wallet": "493.20"
}

You can check Fast2SMS wallet balance using this API

GET https://www.fast2sms.com/dev/wallet?authorization=YOUR_API_KEY

POST authorization: YOUR_API_KEY

Error Codes

412 Invalid Authentication (401 Status Code)

{
    "return": false,
    "status_code": 412,
    "message": "Invalid Authentication, Check Authorization Key"
}

Following error codes will be used in Fast2SMS API:

Response Code Status Code Message
400 401 Sender ID Missing
400 402 Message Text Missing
400 403 Route Missing
400 404 Language Missing
400 405 Numbers Missing
400 406 Invalid Sender ID
400 407 Invalid words used in message
400 408 Invalid Route
400 409 Invalid Route Authentication
400 410 Invalid Language
400 411 Invalid Numbers
401 412 Invalid Authentication, Check Authorization Key
401 413 Invalid Authentication, Authorization Key Disabled
400 414 IP is blacklisted from Dev API section
400 415 Account Disabled
400 416 You don't have sufficient wallet balance
400 417 Use english letters or change language to unicode
400 424 Invalid Message ID.
400 425 Invalid Template.
400 426 Invalid link used in variables.