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 Promotional, Transactional & Quick Transactional 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

Bulk SMS API

You can use this Bulk SMS API to send Promotional & Transactional SMS.

Promotional Route: As per TRAI, SMS can only be sent to Non DND numbers within the time frame of 9 AM to 9 PM only. Each SMS sent from promotional route after 9 PM will auto schedule on 9 AM (in morning).

Transactional Route: This route is for company/organization, who want to send non-promotional SMS without approval (open template) on DND + Non DND numbers 24x7.
You need to submit company documents before using this route.
Email: [email protected] for more info.

You can check your sent SMS delivery reports in Fast2SMS Delivery Report section.

GET Method

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

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

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://www.fast2sms.com/dev/bulk?authorization=YOUR_API_KEY&sender_id=FSTSMS&message=".urlencode('This is a test message')."&language=english&route=p&numbers=".urlencode('9999999999,8888888888,7777777777'),
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  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/bulk?authorization=YOUR_API_KEY&sender_id=FSTSMS&message=This is test message&language=english&route=p&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/bulk?authorization=YOUR_API_KEY&sender_id=FSTSMS&message=This is a test message&language=english&route=p&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/bulk"

querystring = {"authorization":"YOUR_API_KEY","sender_id":"FSTSMS","message":"This is test message","language":"english","route":"p","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/bulk?authorization=YOUR_API_KEY&sender_id=FSTSMS&message=This%20is%20a%20test%20message&language=english&route=p&numbers=9999999999,8888888888,7777777777")
  .header("cache-control", "no-cache")
  .asString();
var client = new RestClient("https://www.fast2sms.com/dev/bulk?authorization=YOUR_API_KEY&sender_id=FSTSMS&message=This%20is%20a%20test%20message&language=english&route=p&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/bulk?authorization=YOUR_API_KEY&sender_id=FSTSMS&message=This%20is%20a%20test%20message&language=english&route=p&numbers=9999999999,8888888888,7777777777");

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

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

req.query({
  "authorization": "YOUR_API_KEY",
  "sender_id": "FSTSMS",
  "message": "This is a test message",
  "language": "english",
  "route": "p",
  "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);
});

Promotional Route Success Response:
{
    "return": true,
    "request_id": "lwdtp7cjyqxvfe9",
    "message": [
        "Message sent successfully to NonDND numbers"
    ]
}
Transactional Route Success Response:
{
    "return": true,
    "request_id": "vrc5yp9k4sfze6t",
    "message": [
        "Message sent successfully"
    ]
}

Following are the parameter to be used for GET API:

HTTP Request

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

Body

Parameter Required Description
authorization true Provide "YOUR_API_KEY". Sign up for API Key
sender_id true "FSTSMS" is the default sender id, you can create your own custom 6 digit sender id on Fast2SMS.
message true Message "text" to be sent
language true Default language is "english". You can use "unicode" for other languages
route true For promotional use "p" & For transactional use "t"
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/bulk

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

$fields = array(
    "sender_id" => "FSTSMS",
    "message" => "This is Test message",
    "language" => "english",
    "route" => "p",
    "numbers" => "9999999999,8888888888,7777777777",
);

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://www.fast2sms.com/dev/bulk",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  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/bulk",
  "method": "POST",
  "headers": {
    "authorization": "YOUR_API_KEY",
  },
  "data": {
    "sender_id": "FSTSMS",
    "message": "This is a test message",
    "language": "english",
    "route": "p",
    "numbers": "9999999999,8888888888,7777777777",
  }
}

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

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

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=FSTSMS&message=This is a test message&language=english&route=p&numbers=9999999999,8888888888,7777777777"

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

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

payload = "sender_id=FSTSMS&message=This%20is%20a%20test%20message&language=english&route=p&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/bulk")
  .header("authorization", "YOUR_API_KEY")
  .header("Content-Type", "application/x-www-form-urlencoded")
  .body("sender_id=FSTSMS&message=This%20is%20a%20test%20message&language=english&route=p&numbers=9999999999,8888888888,7777777777")
  .asString();
var client = new RestClient("https://www.fast2sms.com/dev/bulk");
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", "FSTSMS");
request.AddParameter(message", "This is a test message");
request.AddParameter("language", "english");
request.AddParameter("route", "p");
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/bulk");

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=FSTSMS&message=This%20is%20a%20test%20message&language=english&route=p&numbers=9999999999,8888888888,7777777777");

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

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

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

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

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

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

Promotional Route Success Response:
{
    "return": true,
    "request_id": "lwdtp7cjyqxvfe9",
    "message": [
        "Message sent successfully to NonDND numbers"
    ]
}
Transactional Route Success Response:
{
    "return": true,
    "request_id": "vrc5yp9k4sfze6t",
    "message": [
        "Message sent successfully"
    ]
}

Following are the parameter to be used for POST API:

HTTP Request

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

Headers

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

Body

Parameter Required Description
sender_id true "FSTSMS" is the default sender id, you can create your own custom 6 digit sender id on Fast2SMS.
message true Message "text" to be sent
language true Default language is "english". You can use "unicode" for other languages
route true For promotional use "p" & For transactional use "t"
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 Transactional API

Fast2SMS has introduced a new service named quick transactional route in which you can send SMS to DND + Non DND numbers without submitting company documents (template based SMS) mainly for One time password (OTP), Alerts, Informative SMS in which the message text is fixed with some dynamic values like:

Your OTP is: {#AA#} (it contains 5 digit dynamic value named {#AA#})

Dear {#AA#}, Your Mobile Number is: {#EE#} & Password is: {#CC#}
(it contains three variables for name: {#AA#}, for mobile number: {#EE#} & for password: {#CC#})

How To Use

1) Create your message template with fixed text or with some dynamic variables from Fast2SMS Bulk SMS section Read this.

2) After approval you need to get your Template ID by hitting following link with your API key:

https://www.fast2sms.com/dev/quick-templates?authorization=YOUR_API_KEY

3) You'll get list of all approved templates as shown here->:

GET https://www.fast2sms.com/dev/quick-templates?authorization=YOUR_API_KEY

{
"return": true,
  "data":
  [
      {
        "template_id": 596,
        "message": "Your OTP is {#AA#}",    
      },
      {
        "template_id": 768,
        "message": "Dear {#AA#}, Your Mobile Number is: {#EE#} & Password is: {#CC#}",     
      },   
    ]
}


4) Now you need to use your Template ID & the Variables (in same sequence) while hitting the GET or POST API to send the SMS to DND + Non DND numbers 24x7 (with high priority).

GET

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

curl -X GET \
  'https://www.fast2sms.com/dev/bulk?authorization=YOUR_API_KEY&sender_id=FSTSMS&language=english&route=qt&numbers=9999999999,8888888888,7777777777&message=YOUR_QT_TEMPLATE_ID&variables={AA}|{CC}&variables_values=12345|asdaswdx' \
  -H 'cache-control: no-cache'
<?php
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://www.fast2sms.com/dev/bulk?authorization=YOUR_API_KEY&sender_id=FSTSMS&language=english&route=qt&numbers=".urlencode('9999999999,8888888888,7777777777')."&message=YOUR_QT_TEMPLATE_ID&variables=".urlencode('{AA}|{CC}')."&variables_values=".urlencode('12345|asdaswdx')."",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  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;
}
HttpResponse response = Unirest.get("https://www.fast2sms.com/dev/bulk?authorization=YOUR_API_KEY&sender_id=FSTSMS&language=english&route=qt&numbers=9999999999,8888888888,7777777777&message=YOUR_QT_TEMPLATE_ID&variables={AA}|{CC}&variables_values=12345|asdaswdx")
  .header("cache-control", "no-cache")
  .asString();
var client = new RestClient("https://www.fast2sms.com/dev/bulk?authorization=YOUR_API_KEY&sender_id=FSTSMS&language=english&route=qt&numbers=9999999999,8888888888,7777777777&message=YOUR_QT_TEMPLATE_ID&variables={AA}|{CC}&variables_values=12345|asdaswdx");
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/bulk?authorization=YOUR_API_KEY&sender_id=FSTSMS&language=english&route=qt&numbers=9999999999,8888888888,7777777777&message=YOUR_QT_TEMPLATE_ID&variables={AA}|{CC}&variables_values=12345|asdaswdx");

CURLcode ret = curl_easy_perform(hnd);
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://www.fast2sms.com/dev/bulk?authorization=YOUR_API_KEY&sender_id=FSTSMS&language=english&route=qt&numbers=9999999999,8888888888,7777777777&message=YOUR_QT_TEMPLATE_ID&variables={AA}|{CC}&variables_values=12345|asdaswdx",
  "method": "GET",
  "headers": {
    "cache-control": "no-cache"
  }
}

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

url = URI("https://www.fast2sms.com/dev/bulk?authorization=YOUR_API_KEY&sender_id=FSTSMS&language=english&route=qt&numbers=9999999999,8888888888,7777777777&message=YOUR_QT_TEMPLATE_ID&variables={AA}|{CC}&variables_values=12345|asdaswdx")

http = Net::HTTP.new(url.host, url.port)

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/bulk"

querystring = {"authorization":"YOUR_API_KEY","sender_id":"FSTSMS","language":"english","route":"qt","numbers":"9999999999,8888888888,7777777777","message":"YOUR_QT_TEMPLATE_ID","variables":"{AA}|{CC}","variables_values":"12345|asdaswdx"}

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

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

print(response.text))

var unirest = require("unirest");
var req = unirest("GET", "https://www.fast2sms.com/dev/bulk");
req.query({
  "authorization": "YOUR_API_KEY",
  "sender_id": "FSTSMS",
  "language": "english",
  "route": "qt",
  "numbers": "9999999999,8888888888,7777777777",
  "message": "YOUR_QT_TEMPLATE_ID",
  "variables": "{AA}|{CC}",
  "variables_values": "12345|asdaswdx"
});

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

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

  console.log(res.body);
});
Quick Transactional Route Success Response:
{
    "return": true,
    "request_id": "drhgp7cjyqxvfe9",
    "message": [
        "Message sent successfully"
    ]
}

Following are the parameter to be used for GET API:

HTTP Request

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

Query Paramters

Parameter Required Description
authorization true Provide "YOUR_API_KEY". Sign up for API Key
sender_id true "FSTSMS" is the default sender id, you can create your own custom 6 digit sender id on Fast2SMS.
language true Use "english". You can't use other languages in Quick Transactional
route true Use "qt" as its Quick Transactional route
numbers true You can send multiple mobile numbers seperated by comma like: "8888888888,9999999999,6666666666"
message true Your Template ID like "786", get your ID here
variables true Variables used like: "{AA}|{EE}|{CC}" in same sequence which is used at the time of creation seperated by pipe "|".
NOTE:
1) In GET requests you need to remove "#" from the variables as it can't parse by the browser.
2) If your message don't have any variables you can skip variables field.
variables_values true Above variables values like: "Rahul|8888888888|6695" seperated by pipe "|".
NOTE:
1) Use the same variable sequence in which you've created the message.
2) If your message don't have any variables you can skip variables_values field.
flash false This field is optional, it will use "0" as default value or you can set to "1" for sending flash message.

POST

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

curl -X POST \
  https://www.fast2sms.com/dev/bulk \
  -H 'authorization: YOUR_API_KEY' \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/x-www-form-urlencoded' \
  -d 'sender_id=FSTSMS&language=english&route=qt&numbers=9999999999,8888888888,7777777777&message=YOUR_QT_SMS_ID&variables={#AA#}|{#CC#}&variables_values=12345|asdaswdx'
<?php

$field = array(
    "sender_id" => "FSTSMS",
    "language" => "english",
    "route" => "qt",
    "numbers" => "9999999999,8888888888,7777777777",
    "message" => "YOUR_QT_SMS_ID",
    "variables" => "{#AA#}|{#CC#}",
    "variables_values" => "12345|asdaswdx"
);

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://www.fast2sms.com/dev/bulk",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode($field),
  CURLOPT_HTTPHEADER => array(
    "authorization: YOUR_API_KEY",
    "cache-control: no-cache",
    "accept: */*",
    "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/bulk",
  "method": "POST",
  "headers": {
    "authorization": "YOUR_API_KEY",
    "cache-control": "no-cache",
    "content-type": "application/x-www-form-urlencoded"
  },
  "data": {
    "sender_id": "FSTSMS",
    "language": "english",
    "route": "qt",
    "numbers": "9999999999,8888888888,7777777777",
    "message": "YOUR_QT_SMS_ID",
    "variables": "{#AA#}|{#CC#}",
    "variables_values": "12345|asdaswdx"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
var client = new RestClient("https://www.fast2sms.com/dev/bulk");
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", "FSTSMS");
request.AddParameter("language", "english");
request.AddParameter("route", "qt");
request.AddParameter("numbers", "9999999999,8888888888,7777777777");
request.AddParameter("message", "YOUR_QT_SMS_ID");
request.AddParameter("variables", "{#AA#}|{#CC#}");
request.AddParameter("variables_values", "12345|asdaswdx");

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/bulk");

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=FSTSMS&language=english&route=qt&numbers=9999999999,8888888888,7777777777&message=YOUR_QT_SMS_ID&variables={#AA#}|{#CC#}&variables_values=12345|asdaswdx");

CURLcode ret = curl_easy_perform(hnd);
require 'uri'
require 'net/http'

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

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["cache-control"] = 'no-cache'
request["content-type"] = 'application/x-www-form-urlencoded'
request.body = "sender_id=FSTSMS&language=english&route=qt&numbers=9999999999,8888888888,7777777777&message=YOUR_QT_SMS_ID&variables={#AA#}|{#CC#}&variables_values=12345|asdaswdx"

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

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

payload = "sender_id=FSTSMS&language=english&route=qt&numbers=".urlencode('9999999999,8888888888,7777777777')."&message=YOUR_QT_SMS_ID&variables=".urlencode('{#AA#}|{#CC#}')."&variables_values=".urlencode('12345|asdaswdx').""
headers = {
    'authorization': "YOUR_API_KEY",
    'cache-control': "no-cache",
    'content-type': "application/x-www-form-urlencoded"
    }

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

print(response.text)
HttpResponse response = Unirest.post("https://www.fast2sms.com/dev/bulk")
  .header("authorization", "YOUR_API_KEY")
  .header("cache-control", "no-cache")
  .header("content-type", "application/x-www-form-urlencoded")
  .body("sender_id=FSTSMS&language=english&route=qt&numbers=9999999999,8888888888,7777777777&message=YOUR_QT_SMS_ID&variables={#AA#}|{#CC#}&variables_values=12345|asdaswdx")
  .asString();
var unirest = require("unirest");

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

req.headers({
  "content-type": "application/x-www-form-urlencoded",
  "cache-control": "no-cache",
  "authorization": "YOUR_API_KEY"
});

req.form({
  "sender_id": "FSTSMS",
  "language": "english",
  "route": "qt",
  "numbers": "9999999999,8888888888,7777777777",
  "message": "YOUR_QT_SMS_ID",
  "variables": "{#AA#}|{#CC#}",
  "variables_values": "123456787|asdaswdx"
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);
  console.log(res.body);
});

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

This endpoint will send Quick Transactional SMS using POST method.

HTTP Request

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

Headers

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

Body

Parameter Required Description
sender_id true "FSTSMS" is the default sender id, you can create your own custom 6 digit sender id on Fast2SMS.
language true Use "english". You can't use other languages in Quick Transactional
route true Use "qt" as its Quick Transactional route
numbers true You can send multiple mobile numbers seperated by comma like: "8888888888,9999999999,6666666666"
message true Your Template ID like "786", get your ID here
variables true Variables used like: "{#AA#}|{#EE#}|{#CC#}" seperated by pipe "|".
NOTE:
1) Sequence of variables must be same which was used at the time of creation.
2) If your message don't have any variables you can skip variables field.
variables_values true Above variables values like: "Rahul|8888888888|6695" seperated by pipe "|".
NOTE:
1) Use the same variable sequence in which you've created the message.
2) If your message don't have any variables you can skip variables_values field.
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_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 418 Invalid Quick Transactional Template ID.
400 419 Quick Transactional Template Variables Missing
400 420 Invalid Quick Transactional Variables
400 421 Quick Transactional Template Variable Values Missing
400 422 Invalid Variable Values or Some Values Missing
400 423 Transactional Route is active, Use Bulk SMS API.