Get started
API Endpoint https://msg.mv/api/public/send
The MSG.MV API provides programmatic access to send SMS via MSG.MV, Get Delivery Reports, etc.
To use this API, you need an API KEY. Please go to SETTINGS and generate API KEY.
SEND SMS
# Here is a curl example
curl \
-X POST https://msg.mv/api/public/send \
-F 'api_key=29c915-382642-8c4fd4-e3ce0a-27773a' \
-F 'originator=TEST' \
-F 'receiver=7883242' \
-F 'message=This is a Test SMS From MSG.MV'
To Send SMS you need to make a POST call to the following url :
https://msg.mv/api/public/send
Test URL:
https://msg.mv/testapi/public/send
Result example :
{
"status":1,
"smsCount":1,
"smsType":"plain",
"balance":393.5,
"charge":0.25,
"message":"SMS Sent Successfully"
}
# Here is a php example
<?php
echo sendMSG("MSG",7883242,"Hello from MSG.MV");
function sendMSG($from,$to,$message, $apikey = "617dcb-5199c5-1e7a03-839f1f-bd605b") {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://msg.mv/api/public/send");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
http_build_query(array('receiver' => $to,
'originator' => $from,
'message' => $message,
'api_key' => $apikey)));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec($ch);
curl_close ($ch);
return $server_output;
}
?>
QUERY PARAMETERS
Field | Type | Description |
---|---|---|
api_key | String | Your API key. |
originator | String | This is the name or number your SMS message is to appear to come from, it can be alphanumeric (letters and numbers only) and can be up to a maximum of 11 characters.. |
receiver | String | This is the number you wish to send your SMS message, must NOT contain country code |
message | Boolean | This is the text of the SMS message to be sent and this text must be URL encoded. |
Errors
The MSG.MV API uses the following error codes:
Error Code | Meaning |
---|---|
1 | SMS Sent Successfully. |
2 |
Unauthorized, Invalid API Key . This error appears if you use an unknow API key or if your API key is Invalid.
|
3 | This error apears if your balance is not sufficient to send message. |
4 | This error appears if your message is longer than GSM Standard. |
5 | This error appears if your originator is longer than GSM Standard 11 Characters. |
6 | This error appears if your receiver number is invalid or longer than maldives number standard 7 characters. |