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 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 |
sender_id | true | Your 3-6 letter 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 route 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 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 | Required | Description |
---|---|---|
authorization | true | Provide "YOUR_API_KEY ". Sign up for API Key |
sender_id | true | Your 3-6 letter 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 route 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. |
OTP SMS API
You can use OTP SMS API for sending Numeric based OTP SMS.
In this route you can pass OTP value & Fast2SMS will deliver your SMS as:
"Your OTP: {#var#}"
NOTE: If you want to use your DLT Approved Custom Sender ID & Custom Message Text then use DLT SMS API.
GET Method
GET https://www.fast2sms.com/dev/bulkV2
curl -X GET \
'https://www.fast2sms.com/dev/bulkV2?authorization=YOUR_API_KEY&variables_values=5599&route=otp&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&variables_values=5599&route=otp&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&variables_values=5599&route=otp&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&variables_values=5599&route=otp&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","variables_values":"5599","route":"otp","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&variables_values=5599&route=otp&numbers=9999999999,8888888888,7777777777")
.header("cache-control", "no-cache")
.asString();
var client = new RestClient("https://www.fast2sms.com/dev/bulkV2?authorization=YOUR_API_KEY&variables_values=5599&route=otp&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&variables_values=5599&route=otp&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",
"variables_values": "5599",
"route": "otp",
"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 |
variables_values | true | Pass OTP value like: "5599 "(only numeric value is allowed upto 8 digit) Your SMS will be delivered as: Your OTP: 5599 |
route | true | For OTP SMS use "otp " |
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 'variables_values=5599&route=otp&numbers=9999999999,8888888888,7777777777'
<?php
$fields = array(
"variables_values" => "5599",
"route" => "otp",
"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": {
"variables_values": "5599",
"route": "otp",
"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 = "variables_values=5599&route=otp&numbers=9999999999,8888888888,7777777777"
response = http.request(request)
puts response.read_body
import requests
url = "https://www.fast2sms.com/dev/bulkV2"
payload = "variables_values=5599&route=otp&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("variables_values=5599&route=otp&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("variables_values", "5599");
request.AddParameter("route", "otp");
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, "variables_values=5599&route=otp&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({
"variables_values": "5599",
"route": "otp",
"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 | Required | Description |
---|---|---|
authorization | true | Provide "YOUR_API_KEY ". Sign up for API Key |
variables_values | true | Pass OTP value like: "5599 "(only numeric value is allowed upto 8 digit) Your SMS will be delivered as: Your OTP: 5599 |
route | true | For OTP SMS use "otp " |
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
This route uses international connectivity for sending SMS in INDIA 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). Per SMS cost is ₹5.00
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. |
OTP Voice Call API
You can use OTP Voice Call API for sending Numeric OTP via Voice Call.
In this route you can send OTP value as a recorded voice call without DLT approval in 10 Paise per OTP Voice Call.
GET Method
GET https://www.fast2sms.com/dev/voice
curl -X GET \
'https://www.fast2sms.com/dev/voice?authorization=YOUR_API_KEY&variables_values=5599&route=otp&numbers=9999999999'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://www.fast2sms.com/dev/voice?authorization=YOUR_API_KEY&variables_values=5599&route=otp&numbers=".urlencode('9999999999'),
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/voice?authorization=YOUR_API_KEY&variables_values=5599&route=otp&numbers=9999999999",
"method": "GET"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
require 'uri'
require 'net/http'
url = URI("https://www.fast2sms.com/dev/voice?authorization=YOUR_API_KEY&variables_values=5599&route=otp&numbers=9999999999")
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/voice"
querystring = {"authorization":"YOUR_API_KEY","variables_values":"5599","route":"otp","numbers":"9999999999"}
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/voice?authorization=YOUR_API_KEY&variables_values=5599&route=otp&numbers=9999999999")
.header("cache-control", "no-cache")
.asString();
var client = new RestClient("https://www.fast2sms.com/dev/voice?authorization=YOUR_API_KEY&variables_values=5599&route=otp&numbers=9999999999");
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/voice?authorization=YOUR_API_KEY&variables_values=5599&route=otp&numbers=9999999999");
CURLcode ret = curl_easy_perform(hnd);
var unirest = require("unirest");
var req = unirest("GET", "https://www.fast2sms.com/dev/voice");
req.query({
"authorization": "YOUR_API_KEY",
"variables_values": "5599",
"route": "otp",
"numbers": "9999999999"
});
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/voice
Body
Parameter | Required | Description |
---|---|---|
authorization | true | Provide "YOUR_API_KEY ". Sign up for API Key |
variables_values | true | Pass OTP value like: "5599 "(only numeric value is allowed upto 10 digit) Call will be delivered as: Your one time password is: 5599 |
route | true | For OTP Voice Call use "otp " |
numbers | true | You can put mobile number to send OTP : "8888888888 " |
POST Method
POST https://www.fast2sms.com/dev/voice
curl -X POST \
https://www.fast2sms.com/dev/voice \
-H 'authorization: YOUR_API_KEY' \
-d 'variables_values=5599&route=otp&numbers=9999999999'
<?php
$fields = array(
"variables_values" => "5599",
"route" => "otp",
"numbers" => "9999999999",
);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://www.fast2sms.com/dev/voice",
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/voice",
"method": "POST",
"headers": {
"authorization": "YOUR_API_KEY",
},
"data": {
"variables_values": "5599",
"route": "otp",
"numbers": "9999999999",
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
require 'uri'
require 'net/http'
url = URI("https://www.fast2sms.com/dev/voice")
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 = "variables_values=5599&route=otp&numbers=9999999999"
response = http.request(request)
puts response.read_body
import requests
url = "https://www.fast2sms.com/dev/voice"
payload = "variables_values=5599&route=otp&numbers=9999999999"
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/voice")
.header("authorization", "YOUR_API_KEY")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("variables_values=5599&route=otp&numbers=9999999999")
.asString();
var client = new RestClient("https://www.fast2sms.com/dev/voice");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/x-www-form-urlencoded");
request.AddHeader("authorization", "YOUR_API_KEY");
request.AddParameter("variables_values", "5599");
request.AddParameter("route", "otp");
request.AddParameter("numbers", "9999999999");
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/voice");
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, "variables_values=5599&route=otp&numbers=9999999999");
CURLcode ret = curl_easy_perform(hnd);
var unirest = require("unirest");
var req = unirest("POST", "https://www.fast2sms.com/dev/voice");
req.headers({
"authorization": "YOUR_API_KEY"
});
req.form({
"variables_values": "5599",
"route": "otp",
"numbers": "9999999999",
});
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/voice
Headers
Parameter | Required | Description |
---|---|---|
authorization | true | Provide "YOUR_API_KEY ". Sign up for API Key |
variables_values | true | Pass OTP value like: "5599 "(only numeric value is allowed upto 10 digit) Call will be delivered as: Your one time password is: 5599 |
route | true | For OTP Voice Call use "otp " |
numbers | true | You can put mobile number to send OTP: "8888888888 " |
DLT SMS (Manual) API
You can use DLT SMS (Manual) API to send your DLT Approved SMS without Fast2SMS Approval & without Fast2SMS message id.
NOTE: Below API will pass parameters & its value directly to the operator without Fast2SMS approval or verification.
Passing incorrect/invalid details or wrong message text (which is not approved in DLT) will result in failure of your SMS & we'll not refund or provide support for these type of failed SMS as we're not verifying it at our end.
DLT Scrubber will verify your passed details at their end & mark the SMS as Delivered or Failed which you can see in Fast2SMS Delivery Reports.
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_APPROVED_SENDER_ID&message=DLT_APPROVED_MESSAGE&template_id=DLT_CONTENT_TEMPLATE_ID&entity_id=DLT_ENTITY_ID&route=dlt_manual&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_APPROVED_SENDER_ID&message=".urlencode('DLT_APPROVED_MESSAGE')."&template_id=DLT_CONTENT_TEMPLATE_ID&entity_id=DLT_ENTITY_ID&route=dlt_manual&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_APPROVED_SENDER_ID&message=DLT_APPROVED_MESSAGE&template_id=DLT_CONTENT_TEMPLATE_ID&entity_id=DLT_ENTITY_ID&route=dlt_manual&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_APPROVED_SENDER_ID&message=DLT_APPROVED_MESSAGE&template_id=DLT_CONTENT_TEMPLATE_ID&entity_id=DLT_ENTITY_ID&route=dlt_manual&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_APPROVED_SENDER_ID","message":"DLT_APPROVED_MESSAGE","template_id":"DLT_CONTENT_TEMPLATE_ID","entity_id":"DLT_ENTITY_ID","route":"dlt_manual","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_APPROVED_SENDER_ID&message=DLT_APPROVED_MESSAGE&template_id=DLT_CONTENT_TEMPLATE_ID&entity_id=DLT_ENTITY_ID&route=dlt_manual&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_APPROVED_SENDER_ID&message=DLT_APPROVED_MESSAGE&template_id=DLT_CONTENT_TEMPLATE_ID&entity_id=DLT_ENTITY_ID&route=dlt_manual&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_APPROVED_SENDER_ID&message=DLT_APPROVED_MESSAGE&template_id=DLT_CONTENT_TEMPLATE_ID&entity_id=DLT_ENTITY_ID&route=dlt_manual&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_APPROVED_SENDER_ID",
"message": "DLT_APPROVED_MESSAGE",
"template_id": "DLT_CONTENT_TEMPLATE_ID",
"entity_id": "DLT_ENTITY_ID",
"route": "dlt_manual",
"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 SMS (Manual) 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 | "DLT_APPROVED_SENDER_ID ". You need to pass your DLT approved 3-6 letter sender id in this field. |
message | true | "DLT_APPROVED_MESSAGE ". Pass your Full DLT Approved SMS by changing {#var#} into real values (missing any charcter which is not approved in DLT will result in failure of SMS).If you've DLT approved SMS: Your OTP is {#var#} for {#var#} then pass following SMS in this field: Your OTP is 5566 for Login |
template_id | true | "DLT_CONTENT_TEMPLATE_ID ". Pass correct DLT Content Template ID which you can get inside DLT Panel.This ID will change for each approved SMS. |
entity_id | true | "DLT_ENTITY_ID ". Pass correct DLT Principal Entity ID which you can get inside DLT Panel.This ID will remain same for all messages. |
route | true | For DLT SMS (Manual) route always use "dlt_manual " |
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_APPROVED_SENDER_ID&message=DLT_APPROVED_MESSAGE&template_id=DLT_CONTENT_TEMPLATE_ID&entity_id=DLT_ENTITY_ID&route=dlt_manual&numbers=9999999999,8888888888,7777777777'
<?php
$fields = array(
"sender_id" => "DLT_APPROVED_SENDER_ID",
"message" => "DLT_APPROVED_MESSAGE",
"template_id" => "DLT_CONTENT_TEMPLATE_ID",
"entity_id" => "DLT_ENTITY_ID",
"route" => "dlt_manual",
"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_APPROVED_SENDER_ID",
"message": "DLT_APPROVED_MESSAGE",
"template_id": "DLT_CONTENT_TEMPLATE_ID",
"entity_id": "DLT_ENTITY_ID",
"route": "dlt_manual",
"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_APPROVED_SENDER_ID&message=DLT_APPROVED_MESSAGE&template_id=DLT_CONTENT_TEMPLATE_ID&entity_id=DLT_ENTITY_ID&route=dlt_manual&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_APPROVED_SENDER_ID&message=DLT_APPROVED_MESSAGE&template_id=DLT_CONTENT_TEMPLATE_ID&entity_id=DLT_ENTITY_ID&route=dlt_manual&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_APPROVED_SENDER_ID&message=DLT_APPROVED_MESSAGE&template_id=DLT_CONTENT_TEMPLATE_ID&entity_id=DLT_ENTITY_ID&route=dlt_manual&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_APPROVED_SENDER_ID");
request.AddParameter(message", "DLT_APPROVED_MESSAGE");
request.AddParameter("template_id", "DLT_CONTENT_TEMPLATE_ID");
request.AddParameter("entity_id", "DLT_ENTITY_ID");
request.AddParameter("route", "dlt_manual");
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_APPROVED_SENDER_ID&message=DLT_APPROVED_MESSAGE&template_id=DLT_CONTENT_TEMPLATE_ID&entity_id=DLT_ENTITY_ID&route=dlt_manual&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({
"authorization": "YOUR_API_KEY",
"sender_id": "DLT_APPROVED_SENDER_ID",
"message": "DLT_APPROVED_MESSAGE",
"template_id": "DLT_CONTENT_TEMPLATE_ID",
"entity_id": "DLT_ENTITY_ID",
"route": "dlt_manual",
"numbers": "9999999999,8888888888,7777777777"
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
DLT SMS (Manual) 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 |
---|---|---|
authorization | true | Provide "YOUR_API_KEY ". Sign up for API Key |
sender_id | true | "DLT_APPROVED_SENDER_ID ". You need to pass your DLT approved 3-6 letter sender id in this field. |
message | true | "DLT_APPROVED_MESSAGE ". Pass your Full DLT Approved SMS by changing {#var#} into real values (missing any charcter which is not approved in DLT will result in failure of SMS).If you've DLT approved SMS: Your OTP is {#var#} for {#var#} then pass following SMS in this field: Your OTP is 5566 for Login |
template_id | true | "DLT_CONTENT_TEMPLATE_ID ". Pass correct DLT Content Template ID which you can get inside DLT Panel.This ID will change for each approved SMS. |
entity_id | true | "DLT_ENTITY_ID ". Pass correct DLT Principal Entity ID which you can get inside DLT Panel.This ID will remain same for all messages. |
route | true | For DLT SMS (Manual) route always use "dlt_manual " |
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 |
400 | 500 | Template/Sender id blacklisted at DLT |
400 | 990 | You're hitting old API. Refer updated documentation |
400 | 995 | Spamming detected (sending multiple sms to same number is not allowed) |
400 | 996 | Before using OTP SMS API, complete KYC here. |
400 | 997 | Only numeric variables_values is allowed in OTP route |
400 | 998 | Use DLT or Quick SMS route for sending Bulk SMS |
400 | 999 | Complete single transaction of minimum 100 INR in Fast2SMS wallet before using API |