+(923) 111 88 4444
TecniForge, 79/5-L, Sahiwal 57000
ahmad@tecniforge.com

SMS – Send Single Message

SMS – Send Single Message

Send a single sms message. Requires “sms_send” API permission.POST https://androidapi.net/api/send/sms

Parameter #

FieldTypeDescription
secretStringThe API secret you copied from (Tools -> API Keys) page
modeStringMode 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"
phoneStringRecipient 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
messageStringMessage you want to send, spintax is also supported.
device (optional)StringLinked 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|NumberPartner 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
simNumberSim slot number you want to use. For “devices” mode only.Allowed values: 12
priority (optional)NumberIf you want to send the messages as priority, 1 for yes and 2 for no. For “devices” mode only.Default value: 1Allowed values: 12
shortener (optional)NumberShortener 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 #

FieldTypeDescription
statusNumberList of Codes
200 = Success
messageStringResponse message
dataArrayArray of data

Error Response Format #

NameTypeDescription
statusNumberList of Codes
400 = Invalid parameters
401 = Invalid API secret
403 = Access denied
404 = Device doesn’t exist
500 = Something went wrong
messageStringResponse message
dataArrayArray 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
}

Leave A Comment