Table of Contents
Send a single sms message. Requires “sms_send” API permission.POST https://androidapi.net/api/send/sms
Parameter #
Field | Type | Description |
---|---|---|
secret | String | The API secret you copied from (Tools -> API Keys) page |
mode | String | Mode of sending the message, it can be “devices” which will allow you to use your linked android devices or “credits” which will allow you to use gateways and partner devices. “credits” requires you to have enough credit balance to send messages.Allowed values: "devices" , "credits" |
phone | String | Recipient mobile number, it will accept E.164 formatted number or locally formatted numbers using the country code from your profile settings. Example for Philippines E.164: +639184661533 Local: 09184661533 |
message | String | Message you want to send, spintax is also supported. |
device (optional) | String | Linked device unique ID, this is required if you will send with “devices” mode. You can get linked device unique ID from /get/devices (Your devices). |
gateway (optional) | String|Number | Partner device unique ID or gateway ID, this is required if you will send with “credits” mode. You can get a partner device unique ID and gateway ID from /get/rates |
sim | Number | Sim slot number you want to use. For “devices” mode only.Allowed values: 1 , 2 |
priority (optional) | Number | If you want to send the messages as priority, 1 for yes and 2 for no. For “devices” mode only.Default value: 1 Allowed values: 1 , 2 |
shortener (optional) | Number | Shortener ID, specify the shortener you want to use if you want to shorten the links in your message. You can get the list of available shorteners from /get/shortenersDefault value: none |
Success Response Format #
Field | Type | Description |
---|---|---|
status | Number | List of Codes 200 = Success |
message | String | Response message |
data | Array | Array of data |
Error Response Format #
Name | Type | Description |
---|---|---|
status | Number | List of Codes 400 = Invalid parameters 401 = Invalid API secret 403 = Access denied 404 = Device doesn’t exist 500 = Something went wrong |
message | String | Response message |
data | Array | Array of data |
PHP Sample #
<?php
$message = [
"secret" => "API_SECRET", // your API secret from (Tools -> API Keys) page
"mode" => "devices",
"device" => "00000000-0000-0000-d57d-f30cb6a89289",
"sim" => 1,
"priority" => 1,
"phone" => "+923012345678",
"message" => "Hello World!"
];
$cURL = curl_init("https://androidapi.net/api/send/sms");
curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cURL, CURLOPT_POSTFIELDS, $message);
$response = curl_exec($cURL);
curl_close($cURL);
$result = json_decode($response, true);
// do something with response
print_r($result);
Python Sample #
import requests
# your API secret from (Tools -> API Keys) page
apiSecret = "API_SECRET"
message = {
"secret": apiSecret,
"mode": "devices",
"device": "00000000-0000-0000-d57d-f30cb6a89289",
"sim": 1,
"priority": 1,
"phone": "+923012345678",
"message": "Hello World!"
}
r = requests.post(url = "https://androidapi.net/api/send/sms", params = message)
# do something with response object
result = r.json()
Successful Response #
{
"status": 200,
"message": "Message has been queued for sending!",
"data": false
}
Error Response #
{
"status": 400,
"message": "Invalid Parameters!",
"data": false
}