SMS API
Releans makes sending SMS easy. Find the documentation, sample code, and developer tools you need to build exactly what you want, fast. We’ll handle the complexity of mobile carrier and global regulations. Let’s get building.
Send Single Message
Releans SMS is a few lines of code away. Choose your programming language and dive in. We’ve got helper libraries and Quickstarts to get you sending SMS and MMS in your web app, fast.
Good to know the parameters before
Parameter | Type | Description |
---|---|---|
sender Required |
string | Sender (from) to send the message Ex. Releans Sender ID must be registered in your account. You can register your company name as Sender ID from New Sender form in the dashboard |
mobile Required |
mobile number | Format mobile number with a + and a country code, (E.164 format). e.g, a US number would have the format +14155550101. A UK number would have the format +447700900123. |
content Required |
string | Your Message text. Each SMS message can hold a maximum of 160 characters including spaces, the maximum number of characters you can write down is 1377 (around 8 SMS). |
POST Request
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.releans.com/v2/message",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "sender=SenderName&mobile=+14155550101&content=Hello",
CURLOPT_HTTPHEADER => array(
"Authorization: Bearer Your_API_Key"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Example Response
{
"api_version": "2021-01-02",
"message": "Your message sent.",
"id": "kpPy7LDdw2Nvmb1YKXAxljV",
"from": "SMS",
"to": "+14155550101",
"region": "United States",
"operator": "null",
"date_created": "2021-01-08 03:47:18 pm",
"date_sent": "2021-01-08 03:47:18 pm",
"dlr_status": "sent",
"status_description": null,
"timezone": "America/Toronto",
"price": 0.01,
"price_unit": "USD",
"code": 77,
"status": 201
}
Send multiple messages
Send multiple messages to one or more destination addresses.
Good to know the parameters before
Parameter | Type | Description |
---|---|---|
sender Required |
string | Sender (from) to send the message Ex. Releans Sender ID must be registered in your account. You can register your company name as Sender ID from New Sender form in the dashboard |
mobile Required |
mobile number | Separate mobile numbers by comma, Format mobile number with a + and a country code, (E.164 format). e.g, a US number would have the format +14155550101. A UK number would have the format +447700900123. |
content Required |
string | Your Message text. Each SMS message can hold a maximum of 160 characters including spaces, the maximum number of characters you can write down is 1377 (around 8 SMS). |
POST Request
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.releans.com/v2/batch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "sender=SenderName&mobile=+14155550101,+14155550102&content=Hello",
CURLOPT_HTTPHEADER => array(
"Authorization: Bearer Your_API_Key"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Retrieve Messages
This guide will show you how you can use API to retrieve the messages you send with SMS.
List all Messages
Retrieving sent and received messages from history can be achieved by querying the Messages list resource. Here you can see how to retrieve all messages from your account
GET Request
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.releans.com/v2/message",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Authorization: Bearer Your_API_Key"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Retrieve Messages By Date
If you'd like to have Releans narrow down this list of messages for you, you can do so by specifying a sent date.
GET Request
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.releans.com/v2/message?date=YYYY-MM-DD",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Authorization: Bearer Your_API_Key"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Retrieve one message
If you'd like to have Releans narrow down this list of messages for you, you can do so by specifying a Message ID.
GET Request
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.releans.com/v2/message?id=MESSAGE_ID",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Authorization: Bearer Your_API_Key"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;