NAV
bash php javascript

Introduction

Welcome to Loftysms.com developer page

We are improving our Documentation, API references, learning resources to help you more effectively use our services. We want to help you find everything you need to integrate Loftysms APIs into your code.

As we start this transition, we’d love to hear from you with thoughts & suggestions. If you’ve got something, positive or negative, to tell us, please tell us by shooting us a mail at info@loftysms.com

You can also contact us here

Authentication

There are two ways to be Authenticated to integrate your API with our application to use some of our services available over the API. Some API endpoints allow you to attach your username and password as a GET parameter to the request. This is a very simple way of getting the JOB done The other method of getting authorized to access other APIs protected by OAUth2 is to follow the following guidelines.

Log-in to your account. If you don't have an account yet, click here to create an account

Click here to create a personal access token for your account

The access token should always be attached as an Authorization header using the following format.

['Headers'=>['Authorization'=>'Bearer your_generated_access_token_here']]

General

This APIs are publicly available to be query by visitors. To query this API, you do not need to have an account on Loftysms.com

Get Supported Countries

This API returns a collection of supported countries on our platform

Example request:

curl -X GET "https://api.loftysms.com/countries/supported" \
-H "Accept: application/json"
Loftysms uses Authentication Tokens to allow access to the API. You can register a new client at our portal.
visit https://www.loftysms.com/user/apps to create an APP

use GuzzleHttp\Client;

$token = "your_auth_token";

$client = new GuzzleHttp\Client();
$res = $client->request(GET, 'https://api.loftysms.com/countries/supported', [
'Headers' => ['Authorization'=>Bearer.' '.$token, 'Content-Type'=>'application/json'],
]);
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.loftysms.com/countries/supported",
    "method": "GET",
    "headers": {
        "accept": "application/json"
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

Example response:

null

HTTP Request

GET countries/supported

HEAD countries/supported

HLR LOOKUPS API

These APIs are only available to registered users. Users may need to provide username & password or Authentication token which must be attached to every request.

HLR LookUp

This API endpoint provides functionality to perform HLR LookUP on our application.

There are 3 types of HLR LookUp as explained below,

  1. we provide a Free Query to remove invalid numbers. The lookup_type parameter must be set to 3
  2. Query the country and the Network of the Number. lookup_type parameter must be set at 2. This is not free
  3. Find if a particular number is available, check portability and network information. The lookup_type parameter must be set to 1

Example request:

curl -X POST "https://api.loftysms.com/hlr/lookups" \
-H "Accept: application/json" \
    -d "contacts"="tempore" \
    -d "file"="tempore" \
    -d "recipient"="tempore" \
    -d "sync"="1" \
    -d "lookup_type"="9710812" \
Loftysms uses Authentication Tokens to allow access to the API. You can register a new client at our portal.
visit https://www.loftysms.com/user/apps to create an APP

use GuzzleHttp\Client;

$token = "your_auth_token";

$client = new GuzzleHttp\Client();
$res = $client->request(POST, 'https://api.loftysms.com/hlr/lookups', [
'Headers' => ['Authorization'=>Bearer.' '.$token, 'Content-Type'=>'application/json'],
    'Body'=>[
    "contacts"=>"tempore",
    "file"=>"tempore",
    "recipient"=>"tempore",
    "sync"=>"1",
    "lookup_type"=>"9710812",
    ]
]);
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.loftysms.com/hlr/lookups",
    "method": "POST",
    "data": {
        "contacts": "tempore",
        "file": "tempore",
        "recipient": "tempore",
        "sync": true,
        "lookup_type": 9710812
},
    "headers": {
        "accept": "application/json"
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

HTTP Request

POST hlr/lookups

Parameters

Parameter Type Status Description
contacts array optional Required if the parameters file and recipient are not present.
file file optional Must be a file upload Allowed mime types: txt Required if the parameters recipient and contacts are not present.
recipient string optional Required if the parameters file and contacts are not present.
sync boolean optional
lookup_type numeric required 1, 2 or 3

SMS API

These APIs are only available to registered users. Users may need to provide username & password or Authentication token which must be attached to every request.

Send SMS (SIMPLE API)

This API is available for simple SMS submission on our platform. It is useful for SPC owners and other developers that may need it.

To use the API, you don't need to generate any token. Only attach your username and password to the GET Request in the following format

https://api.loftysms.com/simple/sendsms?username=YourUsername&password=YourPassword&sender=SenderID&recipient=081xxxx,070xxxxx&message=YourURLencodedMessage

Example request:

curl -X GET "https://api.loftysms.com/simple/sendsms" \
-H "Accept: application/json" \
    -d "username"="alias" \
    -d "password"="alias" \
    -d "sender"="alias" \
    -d "message"="alias" \
    -d "corporate"="1" \
    -d "sms_type"="1" \
    -d "recipient"="alias" \
    -d "chkschedule"="1" \
    -d "schedule_date"="2017201720172017-NovNov-ThuThu" \
    -d "schedule_time"="0909:1111" \
Loftysms uses Authentication Tokens to allow access to the API. You can register a new client at our portal.
visit https://www.loftysms.com/user/apps to create an APP

use GuzzleHttp\Client;

$token = "your_auth_token";

$client = new GuzzleHttp\Client();
$res = $client->request(GET, 'https://api.loftysms.com/simple/sendsms', [
'Headers' => ['Authorization'=>Bearer.' '.$token, 'Content-Type'=>'application/json'],
    'Body'=>[
    "username"=>"alias",
    "password"=>"alias",
    "sender"=>"alias",
    "message"=>"alias",
    "corporate"=>"1",
    "sms_type"=>"1",
    "recipient"=>"alias",
    "chkschedule"=>"1",
    "schedule_date"=>"2017201720172017-NovNov-ThuThu",
    "schedule_time"=>"0909:1111",
    ]
]);
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.loftysms.com/simple/sendsms",
    "method": "GET",
    "data": {
        "username": "alias",
        "password": "alias",
        "sender": "alias",
        "message": "alias",
        "corporate": "1",
        "sms_type": "1",
        "recipient": "alias",
        "chkschedule": true,
        "schedule_date": "2017201720172017-NovNov-ThuThu",
        "schedule_time": "0909:1111"
},
    "headers": {
        "accept": "application/json"
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

Example response:

null

HTTP Request

GET simple/sendsms

HEAD simple/sendsms

Parameters

Parameter Type Status Description
username string required
password string required
sender string required Maximum: 11
message string required
corporate numeric optional 1, 2 or 3
sms_type numeric optional 1 or 2
recipient string required
chkschedule boolean optional
schedule_date date optional Date format: YYYY-MM-DD
schedule_time date optional Date format: HH:mm

Get Balance

Get your Loftysms Balance with this API endpoint

To use the API, you don't need to generate any token. Only attach your username and password to the GET Request in the following format

https://api.loftysms.com/simple/getbalance?username=YourUsername&password=YourPassword

Example request:

curl -X GET "https://api.loftysms.com/simple/getbalance" \
-H "Accept: application/json" \
    -d "username"="qui" \
    -d "password"="qui" \
Loftysms uses Authentication Tokens to allow access to the API. You can register a new client at our portal.
visit https://www.loftysms.com/user/apps to create an APP

use GuzzleHttp\Client;

$token = "your_auth_token";

$client = new GuzzleHttp\Client();
$res = $client->request(GET, 'https://api.loftysms.com/simple/getbalance', [
'Headers' => ['Authorization'=>Bearer.' '.$token, 'Content-Type'=>'application/json'],
    'Body'=>[
    "username"=>"qui",
    "password"=>"qui",
    ]
]);
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.loftysms.com/simple/getbalance",
    "method": "GET",
    "data": {
        "username": "qui",
        "password": "qui"
},
    "headers": {
        "accept": "application/json"
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

Example response:

null

HTTP Request

GET simple/getbalance

HEAD simple/getbalance

Parameters

Parameter Type Status Description
username string required
password string required

Get User

This Get the details of the current Authenticated User

Example request:

curl -X GET "https://api.loftysms.com/me" \
-H "Accept: application/json"
Loftysms uses Authentication Tokens to allow access to the API. You can register a new client at our portal.
visit https://www.loftysms.com/user/apps to create an APP

use GuzzleHttp\Client;

$token = "your_auth_token";

$client = new GuzzleHttp\Client();
$res = $client->request(GET, 'https://api.loftysms.com/me', [
'Headers' => ['Authorization'=>Bearer.' '.$token, 'Content-Type'=>'application/json'],
]);
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.loftysms.com/me",
    "method": "GET",
    "headers": {
        "accept": "application/json"
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

Example response:

null

HTTP Request

GET me

HEAD me

Send BulkSMS

Submit Bulk SMS API

Example request:

curl -X POST "https://api.loftysms.com/me/sendsms" \
-H "Accept: application/json" \
    -d "sender"="recusandae" \
    -d "message"="recusandae" \
    -d "corporate"="3" \
    -d "sms_type"="2" \
    -d "contacts"="recusandae" \
    -d "file"="recusandae" \
    -d "recipient"="recusandae" \
    -d "chkschedule"="1" \
    -d "schedule_date"="2017201720172017-NovNov-ThuThu" \
    -d "schedule_time"="0909:1111" \
Loftysms uses Authentication Tokens to allow access to the API. You can register a new client at our portal.
visit https://www.loftysms.com/user/apps to create an APP

use GuzzleHttp\Client;

$token = "your_auth_token";

$client = new GuzzleHttp\Client();
$res = $client->request(POST, 'https://api.loftysms.com/me/sendsms', [
'Headers' => ['Authorization'=>Bearer.' '.$token, 'Content-Type'=>'application/json'],
    'Body'=>[
    "sender"=>"recusandae",
    "message"=>"recusandae",
    "corporate"=>"3",
    "sms_type"=>"2",
    "contacts"=>"recusandae",
    "file"=>"recusandae",
    "recipient"=>"recusandae",
    "chkschedule"=>"1",
    "schedule_date"=>"2017201720172017-NovNov-ThuThu",
    "schedule_time"=>"0909:1111",
    ]
]);
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.loftysms.com/me/sendsms",
    "method": "POST",
    "data": {
        "sender": "recusandae",
        "message": "recusandae",
        "corporate": "3",
        "sms_type": "2",
        "contacts": "recusandae",
        "file": "recusandae",
        "recipient": "recusandae",
        "chkschedule": true,
        "schedule_date": "2017201720172017-NovNov-ThuThu",
        "schedule_time": "0909:1111"
},
    "headers": {
        "accept": "application/json"
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

HTTP Request

POST me/sendsms

Parameters

Parameter Type Status Description
sender string required Maximum: 11
message string required
corporate numeric optional 1, 2 or 3
sms_type numeric optional 1 or 2
contacts array optional Required if the parameters file and recipient are not present.
file file optional Must be a file upload Allowed mime types: txt Required if the parameters recipient and contacts are not present.
recipient string optional Required if the parameters file and contacts are not present.
chkschedule boolean optional
schedule_date date optional Date format: YYYY-MM-DD
schedule_time date optional Date format: HH:mm

Error Codes

The Loftysms.com API uses the following error codes:

Error Code Meaning
200 OK -- Your request is successful
400 Bad Request
401 Unauthorized -- Your Access Token is wrong or username and password incorrect
404 Not Found -- The specified API could not be found
405 Method Not Allowed -- You tried to access a API with an invalid method
406 Not Acceptable -- You requested a format that isn't json
422 Invalid data -- The data supplied is invalid
500 Internal Server Error -- We had a problem with our server. Try again.
503 Service Unavailable -- We're temporarially offline for maintanance. Please try again later.