Facebookpixel Dev DOC - SMSMobileAPI
 

Send SMS

This endpoint allows you to send an SMS from your mobile phone.

Endpoint: 

GET POST https://api.smsmobileapi.com/sendsms/

Parameters:

ParameterDescription
apikey
Required
Your unique API key.
recipients
Required
The recipient's phone number.
message
Required
The message to send (no 160-char limit).
port Define the SIM port to use for sending the SMS: 1, 2, or leave it empty.
If left empty, the SMS will be sent using the available SIM port automatically.

This parameter is available starting from Android version 4.1.15.0 and works when the app is in the foreground (first plan).
shorturl1 = convert URLs to short links
0 or empty = no conversion
sIdentifiantSelect which connected phone sends the SMS. Leave empty for first available device. Requires app 3.0.35.3+.
sendwa1 = send via WhatsApp.
sendsms1 = send via SMS (default if empty). Set to 0 to block SMS.
encrypt_messageyes = recipient needs a key to decrypt. Learn more
schedule_timestampUNIX timestamp (GMT 0) from which the SMS should be sent.

Example:

GET https://api.smsmobileapi.com/sendsms?apikey=YOUR_API_KEY&recipients=+1234567890&message=Hello%20World
Note: in case of delivery error caused by your operator, a default function retries up to 3 times.
 

Resend an unsent SMS

This API endpoint is used to resend an unsent SMS (only if the message has an error status).

Endpoint:

GET POST https://api.smsmobileapi.com/resend/

Parameter: 

ParameterDescription
guid
Required
GUID of the message to be resent.

Example: 

GET https://api.smsmobileapi.com/resend/?apikey=YOUR_API_KEY&guid=GUID_OF_THE_MESSAGE
 

Log of SMS sent from the API

This API endpoint is used to retrieve the log of SMS messages sent via the API.

Endpoint: 

GET https://api.smsmobileapi.com/log/sent/sms/

Parameter:

ParameterDescription
apikey
Required
Your API key.
guid_messageFilter by the unique identifier of the message.
beforeRetrieve messages sent before this timestamp or GUID.
error_api1 = list SMS with API request error.
error_mobile1 = list SMS with mobile processing error.
keywordFilter by recipient number or message content.

Example:

GET https://api.smsmobileapi.com/log/sent/sms?apikey=YOUR_API_KEY
 

SMS Received

This API endpoint is used to retrieve SMS messages received on the smartphone. 

Endpoint:

GET https://api.smsmobileapi.com/getsms/

Parameter: 

ParameterDescription
apikey
Required
The API key you have or will receive.
sIdentifiantPhoneIsolate a phone linked to received SMS.
after_timestamp_unixList received SMS after a UNIX timestamp.
onlyunread"yes" = list only SMS not marked as read (API status).

Example:

GET https://api.smsmobileapi.com/getsms/?apikey=YOUR_API_KEY
 

Mark SMS Messages Received as Read

This API endpoint is used to mark one received SMS message as read in the API status only.
This does not change the read status on the smartphone.  

Endpoint:

GET https://api.smsmobileapi.com/getsms/set-read/

Parameter: 

ParameterDescription
apikey
Required
The API key you have or will receive.
guid_message
Required
GUID of the message to mark as read.

Example:

GET https://api.smsmobileapi.com/getsms/set-read/?apikey=YOUR_APIKEY&guid_message=GUID_MESSAGE
 

Delete SMS

This API endpoint is used to delete SMS messages from the server log of SMS Mobile API.

Endpoint: 

GET https://api.smsmobileapi.com/deletesms/

Parameter:

ParameterDescription
apikey
Required
The API key you have.
guid_messageThe unique ID of the message to delete.
date_startIf used alone, deletes all messages from the specified day.
date_start and date_endCombined to delete messages within a specified period.

Example:

GET https://api.smsmobileapi.com/deletesms/?apikey=YOUR_API_KEY

Note: Deleted SMS are only those stored in server logs. SMS on the device will not be deleted.

Gateway – List connected mobiles

List mobiles connected to your SMS Gateway.

Endpoint:

GET POST https://api.smsmobileapi.com/gateway/mobile/list/

Parameters:

ParameterDescription
apikey
Required
Your API key.
sidFilter by exact SID (sIdentifiant_pour_check).
searchSearch in fields (sid, date, battery, version, label...).

Example:

GET https://api.smsmobileapi.com/gateway/mobile/list/?apikey=YOUR_API_KEY
Note: Received SMS statistics are available starting from version 3.0.33.3+ of the mobile app.

Gateway – Update a mobile label

Update the label (nom_reference) of a connected mobile.

Endpoint:

GET POST https://api.smsmobileapi.com/gateway/mobile/update/

Parameters:

ParameterDescription
apikey
Required
Your API key.
sid
Required
The device SID (sIdentifiant_pour_check).
label
Required
New label (can be empty).

Example:

GET https://api.smsmobileapi.com/gateway/mobile/update/?apikey=YOUR_API_KEY&sid=SID&label=OfficePhone

Important: label is required but can be empty (label=).

Gateway – Delete a connected mobile

Remove a connected mobile from your gateway (deletes all history rows for this SID).

Endpoint:

GET POST https://api.smsmobileapi.com/gateway/mobile/delete/

Parameters:

ParameterDescription
apikey
Required
Your API key.
sid
Required
The device SID (sIdentifiant_pour_check).

Example:

GET https://api.smsmobileapi.com/gateway/mobile/delete/?apikey=YOUR_API_KEY&sid=SID
 

Webhook – SMS Received

This webhook system sends a POST request to the configured URL whenever an SMS is received. The system ensures real-time updates by delivering the SMS details to the specified webhook URL.

How to Configure the Webhook in the Dashboard

Follow these steps to set up your webhook URL in the dashboard:

  1. Log in to your account on the SMS Mobile API Dashboard.
  2. Navigate to the Webhook Settings section.
  3. Enter your webhook URL (e.g., https://example.com/webhook-endpoint).
  4. Click on the Save Webhook button. 
  5. Once saved, the system will start sending SMS details to the configured URL.

Webhook Payload

When an SMS is received, the system sends the following JSON payload to your webhook URL:

{
    "date": "2025-01-20",
    "hour": "10:15:00",
    "time_received": "2025-01-20 10:14:50",
    "message": "Hello, this is a test.",
    "number": "+123456789",
    "guid": "abcde12345"
}

Payload Fields:

  • date: Date when the SMS was added (YYYY-MM-DD).
  • hour: Hour when the SMS was added (HH:mm:ss).
  • time_received: Time when the SMS was received.
  • message: Content of the SMS. 
  • number: Sender's phone number.
  • guid: Unique identifier of the SMS.

Example Webhook Endpoint

Your server should be ready to handle incoming POST requests. Below is an example PHP script to process the webhook payload:

<?php
$payload = file_get_contents('php://input');
$data = json_decode($payload, true);

if ($data) {
    file_put_contents('sms_log.txt', print_r($data, true), FILE_APPEND);
    http_response_code(200);
    echo "Webhook received successfully.";
} else {
    http_response_code(400);
    echo "Invalid payload.";
}
?>

Testing the Webhook

To test your webhook configuration, use tools like:

Troubleshooting

  • Ensure the webhook URL is correct and publicly accessible.
  • Verify that your server is returning an HTTP 200 status code for successful requests.
  • Check your server logs for any errors in processing the payload.

Enriched SMS

Coming soon

Authentication

 

The SMSMobile API supports two authentication methods: using a simple API Key or the OAuth2 protocol with a client ID and client secret.

1. API Key Authentication

 This method requires an API Key that can be included as a parameter in either a GET or POST request.

2. OAuth2 Authentication

OAuth2 provides a more secure authentication method.
Use a client ID and client secret to obtain an access token, then include it in the Authorization header.

The client_id and client_secret are available in your dashboard.
Download the mobile app now or access your dashboard.

Obtaining an Access Token

curl -X POST https://api.smsmobileapi.com/oauth2/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials" \
-d "client_id=YOUR_CLIENT_ID" \
-d "client_secret=YOUR_CLIENT_SECRET"

Using the Access Token:

curl -X POST https://api.smsmobileapi.com/sendsms \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "recipients=+1234567890" \
-d "message=Hello"

Which Method Should You Use?

- Use API Key Authentication for quick and straightforward integrations.

- Use OAuth2 Authentication for enhanced security and scalability.

Send SMS

WSDL URL

https://api.smsmobileapi.com/sendsms/wsdl/sendsms.wsdl

Parameters:

- recipients: The mobile number of the recipient.
- message: The message to send.
- apikey: The API key you have or will receive.

Example

require_once "lib/nusoap.php";

$client = new nusoap_client("https://api.smsmobileapi.com/sendsms/wsdl/sendsms.wsdl", true);
$error = $client->getError();

$result = $client->call("sendSms", array("recipients" =>$_GET['recipients'],"message" =>$_GET['message'],"apikey" =>$_GET['apikey']));

print_r($result);

Send SMS & WhatsApp

Basic cURL Command

curl -X POST https://api.smsmobileapi.com/sendsms/ \
-d "recipients=PHONE_NUMBER" \
-d "message=YOUR_MESSAGE" \
-d "apikey=YOUR_API_KEY"
-d "sendwa=1"
-d "sendsms=1"

Send SMS & WhatsApp

Use our official Python Module : https://smsmobileapi.com/python/

import requests

url = "https://api.smsmobileapi.com/sendsms/"

payload = {"recipients":"PHONE_NUMBER","message":"YOUR_MESSAGE","apikey":"YOUR_API_KEY"}

response = requests.post(url, data=payload)
print(response.text)

SMS Mobile API - PHP SDK (Composer)

composer require smsmobileapi/sdk

GitHub: https://github.com/SmsMobileApi/smsmobileapi-php/tree/main

Send SMS & WhatsApp

const url = "https://api.smsmobileapi.com/sendsms/";
const data = {recipients:"PHONE_NUMBER", message:"YOUR_MESSAGE", apikey:"YOUR_API_KEY"};
fetch(url,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(data)})
.then(r=>r.text()).then(console.log);

Send SMS & WhatsApp

const axios = require("axios");
axios.post("https://api.smsmobileapi.com/sendsms/", {recipients:"PHONE_NUMBER", message:"YOUR_MESSAGE", apikey:"YOUR_API_KEY"})
.then(r=>console.log(r.data));

Send SMS & WhatsApp

require "net/http"
require "uri"
uri = URI.parse("https://api.smsmobileapi.com/sendsms/")
req = Net::HTTP::Post.new(uri)
req.set_form_data({"recipients"=>"PHONE_NUMBER","message"=>"YOUR_MESSAGE","apikey"=>"YOUR_API_KEY"})
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true){|http| http.request(req)}
puts res.body
Depending on the version of Android installed on a mobile phone, the operating system may hinder the proper functioning of automatic sending and receiving of SMS messages when the SmsMobileApi application is not in the foreground.
This issue arises from a process that attempts to run in the background when the application is not actively launched. However, due to Android's battery optimization measures, which vary across different versions, this background process may not initiate correctly. Android's battery optimization is designed to limit the background activity of apps to conserve battery life, which can inadvertently affect apps that require background processes to function properly.

To address this issue, users can manually configure their Android settings to allow the SmsMobileApi to use resources without restrictions.
This involves adjusting the battery optimization settings for the specific app, essentially instructing Android that the SmsMobileApi is permitted to run in the background and use resources as needed. By doing so, the application should be able to automatically send and receive SMS messages even when it is not the active application in the foreground. This adjustment ensures that the necessary background process can operate uninterrupted, circumventing the battery optimization features that might otherwise prevent its proper execution.


FAQ For Developer

Accordion Sample DescriptionTo generate an API key, download our application onto your mobile phone and create an account at no cost. An API key will be automatically generated and linked to your mobile phone. You will also receive an email with all the necessary information. This process ensures that you can quickly and easily start using our services with minimal setup.
In your mobile application, navigate to the SETTINGS or HELP menu, where your API key is visible at all times. This ensures that you can easily access your API key whenever you need it for integrating or using our services.
Yes, we do not require any proof of identity for creating an API key. The communication between our API and your mobile phone is therefore 100% anonymous. This approach allows users to maintain their privacy while utilizing our services.

Get Started with SMSmobileAPI Today!

Experience the freedom and flexibility of managing your SMS services on the go. Download our mobile app now and take the first step towards seamless SMS integration.

Download the App
💬 Live Chat
💬 Live Chat Available
Have any questions or need assistance ?
Our team is here to help you!

Enter your email address
to help us follow up on your request :
Dashboard