NAV
cURL PHP JavaScript Ruby Python JAVA NodeJS

Overview

Fast2SMS provide powerful and robust APIs to send Promotional, Transactional & Quick Transactional SMS. Our motto is "Simple Platform Instant Delivery." We have focused on building a platform which is easy to use for the masses & we ensure 99.99% delivery rate.

Authentication Key

Fast2SMS expects for the API key to be included in all API requests to the server in a header for POST requests AND in query parameters for GET requests. Get Your Authentication Key that looks like the following:

POST Authorization: YOUR_API_KEY

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

Bulk SMS

Fast2SMS provide multiple ways to send Bulk SMS via RestAPI. You can send Single SMS, Bulk SMS, OTP, Transactional SMS, Promotional SMS using Fast2SMS fast and Reliable API

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=8962239013,7773854335&flash=1'
<?php

$fields = array(
    "sender_id" => "FSTSMS",
    "message" => "This is Test message",
    "language" => "english",
    "route" => "p",
    "numbers" => "8962239013,7773854335",
    "flash" => "1"
);

$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 message from Fast2SMS",
    "language": "english",
    "route": "p",
    "numbers": "8962239013,7773854335",
    "flash": "1"
  }
}

$.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=8962239013,7773854335&flash=1"

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=896223212,7773854325&flash=1"
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=8962239013%2C7773854335&flash=1")
  .asString();
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 message from Fast2SMS",
  "language": "english",
  "route": "p",
  "numbers": "8962239013,7773854335",
  "flash": "1"
});

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

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

Sample Success Response
{
    "return": true,
    "request_id": "lwdtp7cjyqxvfe9",
    "message": [
        "Message has been sent successfully."
    ]
}

This endpoint will send bulk SMS using POST method.

HTTP Request

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

Headers

Parameter Description
Authorization Provide your API KEY. Get Your Authentication Key

Body

Parameter Required Description
sender_id true Provide your custom Sender ID from which sms will be send. You can use FSTSMS as your default Sender ID.
message true Message to be sent.
language true You can choose between two languages English or Unicode. Default language is English if you wish to send SMS in any other language then English use Unicode
route true Provide from which route SMS will be sent Promotional or Transactional. For Promotional use p, Transactional use t
numbers true Send multiple mobile number seperated by comma Ex: 6962221913,7978787876,8234568922
flash false If is set to 1 system will send flash message

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=8962239013,7773854335&flash=1'
<?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('8962239013,7773854335')."&flash=1",
  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=8962239013,7773854335&flash=1",
  "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=8962239013,7773854335&flash=1")

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 a message from Fast2SMS","language":"english","route":"p","numbers":"8962239013,7773854335","flash":"1"}

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=8962239013,7773854335&flash=1")
  .header("cache-control", "no-cache")
  .asString();
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 message from Fast2SMS",
  "language": "english",
  "route": "p",
  "numbers": "8962239013,7773854335",
  "flash": "1"
});

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


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

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

Sample Success Response
{
    "return": true,
    "request_id": "lwdtp7cjyqxvfe9",
    "message": [
        "Message has been sent successfully."
    ]
}

This endpoint will send bulk SMS using GET method.

HTTP Request

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

Query Paramters

Parameter Required Description
authorization true Provide your API KEY. Get Your Authentication Key
sender_id true Provide your custom Sender ID from which sms will be send. You can use FSTSMS as your default Sender ID.
message true Message to be sent.
language true You can choose between two languages English or Unicode. Default language is English if you wish to send SMS in any other language then English use Unicode
route true Provide from which route SMS will be sent Promotional or Transactional. For Promotional use p, Transactional use t
numbers true Send multiple mobile number seperated by comma Ex: 6962221913,7978787876,8234568922
flash false If is set to 1 system will send flash message

Quick Transactional SMS

Fast2SMS provide functionality to send Quick Transaction SMS via RestAPI. You can send OTP, Alerts using this API without DND approval.

Post Method

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&message=YOUR_QT_SMS_ID&language=english&route=qt&numbers=8962239013,7773854335&flash=1&variables={#AA#}|{#CC#}&variables_values=123456787|asdaswdx'
<?php

$field = array(
    "sender_id" => "FSTSMS",
    "message" => "YOUR_QT_SMS_ID",
    "language" => "english",
    "route" => "qt",
    "numbers" => "8962239013,7773854335",
    "flash" => "1",
    "variables" => "{#AA#}|{#CC#}",
    "variables_values" => "123456787|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",
    "message": "YOUR_QT_SMS_ID",
    "language": "english",
    "route": "qt",
    "numbers": "8962239013,7773854335",
    "flash": "1",
    "variables": "{#AA#}|{#CC#}",
    "variables_values": "123456787|asdaswdx"
  }
}

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

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

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

payload = "sender_id=FSTSMS&message=YOUR_QT_SMS_ID&language=english&route=qt&numbers=".urlencode('8962239013,7773854335')."&flash=1&variables=".urlencode('{#AA#}|{#CC#}')."&variables_values=".urlencode('123456787|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&message=YOUR_QT_SMS_ID&language=english&route=qt&numbers=8962239013,7773854335&flash=1&variables={#AA#}|{#CC#}&variables_values=123456787|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",
  "message": "YOUR_QT_SMS_ID",
  "language": "english",
  "route": "qt",
  "numbers": "8962239013,7773854335",
  "flash": "1",
  "variables": "{#AA#}|{#CC#}",
  "variables_values": "123456787|asdaswdx"
});

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

Sample Success Response
{
    "return": true,
    "request_id": "lwdtp7cjyqxvfe9",
    "message": [
        "Message has been 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. Get Your Authentication Key

Body

Parameter Required Description
sender_id true Provide your custom Sender ID from which sms will be send. You can use FSTSMS as your default Sender ID.
message true Quick Transaction message id
language true You can choose between two languages English or Unicode. Default language is English if you wish to send SMS in any other language then English use Unicode
route true Route will be qt
numbers true Send multiple mobile number seperated by comma Ex: 6962221913,7978787876,8234568922
flash false If is set to 1 system will send flash message
variables true Variable seperated by pipe EX: {#AA#}|{#CC#}
variables_values true Variables Values seperated by pipe EX: 123456787|asdaswdx

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=YOUR_QT_TEMPLATE_ID&language=english&route=qt&numbers=7773853532%2C8962239913&flash=1&variables={AA}|{CC}&variables_values=123456787|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&message=YOUR_QT_TEMPLATE_ID&language=english&route=qt&numbers=".urlencode('7773853532,8962239913')."&flash=1&variables=".urlencode('{AA}|{CC}')."&variables_values=".urlencode('123456787|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;
}
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://www.fast2sms.com/dev/bulk?authorization=YOUR_API_KEY&sender_id=FSTSMS&message=YOUR_QT_TEMPLATE_ID&language=english&route=qt&numbers=7773853532,8962239913&flash=1&variables={AA}|{CC}&variables_values=123456787|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&message=YOUR_QT_TEMPLATE_ID&language=english&route=qt&numbers=7773853532,8962239913&flash=1&variables={AA}|{CC}&variables_values=123456787|asdaswdx")

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

request = Net::HTTP::Get.new(url)
request["cache-control"] = 'no-cache'
request["postman-token"] = '1edbade0-015d-9a87-b3a0-58c3f6c3e8b5'

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":"YOUR_QT_TEMPLATE_ID","language":"english","route":"qt","numbers":"7773853532,8962239913","flash":"1","variables":"{AA}|{CC}","variables_values":"123456787|asdaswdx"}

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=YOUR_QT_TEMPLATE_ID&language=english&route=qt&numbers=7773853532,8962239913&flash=1&variables={AA}|{CC}&variables_values=123456787|asdaswdx")
  .header("cache-control", "no-cache")
  .asString();

            var unirest = require("unirest");

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

req.query({
  "sender_id": "FSTSMS",
  "message": "YOUR_QT_TEMPLATE_ID",
  "language": "english",
  "route": "qt",
  "numbers": "7773853532,8962239913",
  "flash": "1",
  "variables": "VARIABLES",
  "variables_values": "VALUES",
  "authorization": "YOUR_API_KEY"
});

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


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

  console.log(res.body);
});
Sample Success Response
{
    "return": true,
    "request_id": "lwdtp7cjyqxvfe9",
    "message": [
        "Message has been sent successfully."
    ]
}

This endpoint will send bulk SMS using GET method.

HTTP Request

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

Query Paramters

Parameter Required Description
authorization true Provide your API KEY. Get Your Authentication Key
sender_id true Provide your custom Sender ID from which sms will be send. You can use FSTSMS as your default Sender ID.
message true Quick Transaction message id
language true You can choose between two languages English or Unicode. Default language is English if you wish to send SMS in any other language then English use Unicode
route true Route will be qt
numbers true Send multiple mobile number seperated by comma Ex: 6962221913,7978787876,8234568922
flash false If is set to 1 system will send flash message
variables true Variable seperated by pipe EX: {AA}|{CC}
variables_values true Variables Values seperated by pipe EX: 123456787|asdaswdx

Quick Transactional List

Quick Transactional List API will provide list of all the approved Quick Transaction List

Post Method

POST https://www.fast2sms.com/dev/quick-templates

curl -X POST \
  https://www.fast2sms.com/dev/quick-templates \
  -H 'authorization: YOUR_API_KEY' \
  -H 'cache-control: no-cache'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://www.fast2sms.com/dev/quick-templates",
  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",
    "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/quick-templates",
  "method": "POST",
  "headers": {
    "authorization": "YOUR_API_KEY",
    "cache-control": "no-cache"
  }
}

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

url = URI("https://www.fast2sms.com/dev/quick-templates")

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

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

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

url = "https://www.fast2sms.com/dev/quick-templates"

headers = {
    'authorization': "YOUR_API_KEY",
    'cache-control': "no-cache"
    }

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

print(response.text)
HttpResponse response = Unirest.post("https://www.fast2sms.com/dev/quick-templates")
  .header("authorization", "YOUR_API_KEY")
  .header("cache-control", "no-cache")
  .asString();
var unirest = require("unirest");

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

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


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

  console.log(res.body);
});
Sample Success Response
{
    "return": true,
    "data": [
        {
            "template_id": 1,
            "message": "{#AA#} w efwe few few few {#BB#} fee fe fe  ewf we fwe efw ewf ewf few fe fe fwfwe fewefef ew ff f ew fwefewewf ewf wefew f",
            "created_at": "1513708613"
        },
        {
            "template_id": 2,
            "message": "bffgbbgb{#AA#}{#BB#}",
            "created_at": "1514473724"
        },
        {
            "template_id": 9,
            "message": "your mobile verification code is : {#BB#}",
            "created_at": "1518421265"
        }
    ]
}

This endpoint will return list of all approved Quick Transactional SMS using POST method.

HTTP Request

POST https://www.fast2sms.com/dev/quick-templates

Get Method

GET https://www.fast2sms.com/dev/quick-templates

curl -X GET \
  'https://www.fast2sms.com/dev/quick-templates?authorization=YOUR_API_KEY' \
  -H 'cache-control: no-cache'
<?php
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://www.fast2sms.com/dev/quick-templates?authorization=YOUR_API_KEY",
  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/quick-templates?authorization=YOUR_API_KEY",
  "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/quick-templates?authorization=YOUR_API_KEY")

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/quick-templates"

querystring = {"authorization":"YOUR_API_KEY"}

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/quick-templates?authorization=YOUR_API_KEY")
  .header("cache-control", "no-cache")
  .asString();

var unirest = require("unirest");

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

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

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


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

  console.log(res.body);
});
Sample Success Response
{
    "return": true,
    "data": [
        {
            "template_id": 1,
            "message": "{#AA#} w efwe few few few {#BB#} fee fe fe  ewf we fwe efw ewf ewf few fe fe fwfwe fewefef ew ff f ew fwefewewf ewf wefew f",
            "created_at": "1513708613"
        },
        {
            "template_id": 2,
            "message": "bffgbbgb{#AA#}{#BB#}",
            "created_at": "1514473724"
        },
        {
            "template_id": 9,
            "message": "your mobile verification code is : {#BB#}",
            "created_at": "1518421265"
        }
    ]
}

This endpoint will return list of all approved Quick Transactional SMS using GET method.

HTTP Request

GET https://www.fast2sms.com/dev/quick-templates

Query Paramters

Parameter Required Description
authorization true Provide your API KEY. Get Your Authentication Key

Wallet

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

HEADERS 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)
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);
});
Sample Success Response
{
    "return": true,
    "wallet": "493.20"
}

This api will return the current wallet balance of the user

Fast2SMS expects for the API key to be included in all API requests to the server in a header for POST requests AND in query parameters for GET requests that looks like the following:

POST Authorization: YOUR_API_KEY

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

Errors

412 Invalid Authentication (401 Status Code)

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

The Fast2SMS API uses the following error codes:

Status Code Error Code Message
400 401 Message 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.
401 413 Invalid Authentication, authorization key disabled.
400 414 IP is blacklisted.
400 415 Account disabled.
400 416 You does not have sufficient amount in your wallet.
400 417 Only English alphabets are allowed in message text or select Unicode SMS.
400 418 Invalid Quick Transactional Template.
400 419 Quick Transactional Template Variables Missing.
400 420 Invalid Variables.
400 421 Quick Transactional Template Variables Values Missing.
400 422 Invalid Variables Values or Some Values Missing.
400 423 Transactional Route is open you can send messages from transactional route.