Start sending SMS using our API
Integrate SMS functionality into your application using your programming language.
Base URL
All URLs referenced in the API documentation have the following base url.
https://portal.richmo.lk
Method 01 : Integration with Bearer Authentication (token authentication)
Send a Single Message
HTTP request
GET /api/sms/send/
Parameters
Parameter | Type | Description | Required |
---|---|---|---|
dst | String | Recipent phone number. | Required |
from | String | The Sender name.(Mask) | Required |
msg | String | The body of the message. | Required |
Returns
Code | Description | Message Example |
---|---|---|
200 | Success | { "message": "success", "id": 69412 } |
400 | Bad Request such as missing required parameter. | { "errors": { "destination": [ "This field may not be blank." ] } } |
401 | Unauthorized : Errors like invalid token | { "detail": "Invalid token." } |
Code Sample
curl --request GET 'https://portal.richmo.lk/api/sms/send/?dst=947xxxxxxxx&from=[mask]&msg=[UTF-8 URL Encoded Message]' --header 'Authorization: Bearer [API TOKEN]'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://portal.richmo.lk/api/sms/send/?dst=947xxxxxxxx&from=[mask]&msg=[UTF-8 URL Encoded Message]',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer [API TOKEN]'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://portal.richmo.lk/api/sms/send/?dst=947xxxxxxxx&from=[mask]&msg=[Your Message]"
payload={}
headers = {
'Authorization': 'Bearer [API TOKEN]'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
Method 02 : Simple Integration – authentication token send via request parameters
HTTP request
GET /api/v1/sms/send/
Parameters
Parameter | Type | Description | Required |
---|---|---|---|
dst | String | Recipent phone number. | Required |
from | String | The Sender name.(Mask) | Required |
msg | String | The body of the message. | Required |
key | String | Authentication token | Required |
Returns
Code | Description | Message Example |
---|---|---|
200 | Success | { "message": "success", "id": 69412 } |
400 | Bad Request such as missing required parameter. | { "errors": { "destination": [ "This field may not be blank." ] } } |
401 | Unauthorized : Errors like invalid token | { "detail": "Invalid token." } |
Code Sample
curl --request GET 'https://portal.richmo.lk/api/v1/sms/send/?dst=947xxxxxxxx&from=[mask]&msg=[UTF-8 URL Encoded Message]&key=[API TOKEN]'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://portal.richmo.lk/api/v1/sms/send/?dst=947xxxxxxxx&from=[mask]&msg=[UTF-8 URL Encoded Message]&key=[API TOKEN]',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => 'GET',
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://portal.richmo.lk/api/v1/sms/send/?dst=947xxxxxxxx&from=[mask]&msg=[Your Message]&key=[API TOKEN]"
payload={}
headers = {}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
Check account balance
HTTP request
GET /api/account/balance/
Parameters
Returns
Code | Description | Message Example |
---|---|---|
200 | Success | { "message": "success", "id": 69412 } |
401 | Unauthorized : Errors like invalid token | { "detail": "Invalid token." } |
Code Sample
curl --location --request GET 'https://portal.richmo.lk/api/account/balance' --header 'Authorization: Bearer [API TOKEN]'
$curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => ‘https://portal.richmo.lk/api/account/balance’, CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_CUSTOMREQUEST => ‘GET’, CURLOPT_HTTPHEADER => array( ‘Authorization: Bearer [API TOKEN]’ ), )); $response = curl_exec($curl); curl_close($curl); echo $response;
import requests url = "https://portal.richmo.lk/api/v1/sms/send/?dst=947xxxxxxxx&from=[mask]&msg=[Your Message]&key=[API TOKEN]" payload={} headers = {} response = requests.request("GET", url, headers=headers, data=payload) print(response.text)