Method for getting account information
https://semysms.net/api/3/user.php - address for sending requests
Parameters:
Example GET request:
https://semysms.net/api/3/user.php?token=2d9d148edeb50768c22dc6d96f85d60b
Sample answer:
{"code":0,"id_user":1,"is_pay":1,"type_premium":1,"date_end_premium":null,"messages_premium":4998}
Response parameters:
Method to send a single SMS to one recipient
https://semysms.net/api/3/sms.php - url to send requests
Parameters:
Example GET request:
If one device:
https://semysms.net/api/3/sms.php?token=2d9d148edeb50768c22dc6d96f85d60b&device=1&phone=%2B7920123xxxx&msg=Message
If there are more than one device:
https://semysms.net/api/3/sms.php?token=2d9d148edeb50768c22dc6d96f85d60b&device=1,15,25&phone=%2B7920123xxxx&msg=Message
Example POST request:
<?php
$url = "https://semysms.net/api/3/sms.php"; //Url address for sending SMS
$phone = '+7920123xxxx'; // Phone number
$msg = 'Message'; // Message
$device = '1'; // Device code
$token = '2d9d148edeb50768c22dc6d96f85d60b'; // Your token (secret)
$data = array(
"phone" => $phone,
"msg" => $msg,
"device" => $device,
"token" => $token
);
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
$output = curl_exec($curl);
curl_close($curl);
echo $output;
?>
Sample answer:
{"code":"0","id":1201158}
A method to send multiple SMS messages
https://semysms.net/api/3/sms_more.php - url to send requests
Parameters:
Example POST request:
<?php
$url = "https://semysms.net/api/3/sms_more.php"; //Url address for sending SMS
$device = '1'; // Phone number
$token = '2d9d148edeb50768c22dc6d96f85d60b'; // Your token (secret)
$params = array('token' => $token);
for ($index = 1; $index <= $max_count; $index++) { // Fill the array in a loop with phone numbers, messages and codes devices
$params['data'][] = array(
'my_id' => 'SMS code from your accounting system (it will come back with semysms system code)',
'device' => $device, 'phone' => $phone, 'msg' => $msg);
}
$params = json_encode($params);
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($params))
);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $params);
$result = curl_exec($curl);
curl_close($curl);
echo $result;
?>
Sample answer:
{"code":"0", data:[{"my_id":"будет значение если задан в запросе", "id":1201158}]}
Method to receive outgoing SMS messages
https://semysms.net/api/3/outbox_sms.php - url to send requests
Parameters:
Attention - if parameters ( start_id, list_id, date_start, date_end ) are not set, then the method will return data only for today!
Example GET request:
https://semysms.net/api/3/outbox_sms.php?token=2d9d148edeb50768c22dc6d96f85d60b&device=1&start_id=1&end_id=371&date_start=2015-08-9 10:30&date_end=2015-08-9 22:30&phone=123457890
Sample answer:
{"count":1,
"data":[
{
"id":371,
"phone":"8920123xxxx",
"date":"2015-02-04 12:41:13.657724",
"msg":"test",
"id_device":1,
"send_to_phone":"2015-02-04 12:42:01.490436",
"is_send_to_phone":1,
"is_send":1,
"send":"2015-02-04 12:47:31",
"is_delivered":1,
"delivered":"2015-02-04 12:47:33",
"is_cancel":0,
"cancel":null,
"is_error":0,
"is_error_send":0,
"error_date":null,
"is_out":0, // the message is created externally (for example: if the message was created in WhatsApp manually in the phone, and then uploaded to the service)
"type":0 // message type (0 - SMS, 1 - WhatsApp, 2 - WhatsApp Business)
}
]
}
Method to receive incoming SMS messages
https://semysms.net/api/3/inbox_sms.php - url to send requests
Parameters:
Attention - if parameters ( start_id, date_start, date_end ) are not set, then the method will return data only for today!
Example GET request:
https://semysms.net/api/3/inbox_sms.php?token=2d9d148edeb50768c22dc6d96f85d60b&device=1&start_id=1&end_id=371&phone=123457890
Sample answer:
{"count":1,
"data":[
{
"id":15,
"phone":"+7920123xxxx",
"date":"2015-01-27 13:03:42",
"msg":"Test",
"id_device":1,
"type":0 // message type (0 - SMS, 1 - WhatsApp, 2 - WhatsApp Business)
}
]
}
Method for obtaining a list of devices
https://semysms.net/api/3/devices.php - url to send requests
Parameters:
Example GET request:
https://semysms.net/api/3/devices.php?token=2d9d148edeb50768c22dc6d96f85d60b&is_arhive=0&list_id=1,2,3
Sample answer:
{
"code":0,
"count":1,
"data":[
{
"id":351,
"is_arhive":0,
"is_deliv":1,
"is_work":1,
"power":1,
"device_name":"U8186",
"dop_name":"",
"speed_sms":1,
"date_last_active":"2015-09-11 14:25:29.548563",
"version":"40",
"limit_phone":null,
"limit_use":null,
"limit_date":"2015-09-08 14:33:39.54061",
"limit_period":" ",
"manufacturer":"HUAWEI",
"android_version":"2.3.6",
"bat":"58",
"type":0
}
]
}
Response parameters:
Method to cancel sending SMS, which was not sent to device
https://semysms.net/api/3/cancel_sms.php - url to send requests
Parameters:
Example GET request:
https://semysms.net/api/3/cancel_sms.php?token=2d9d148edeb50768c22dc6d96f85d60b&device=1
Method for deleting outgoing SMS messages
https://semysms.net/api/3/del_outbox_sms.php - url to send requests
Parameters:
Attention - if parameters ( start_id, list_id, date_start, date_end ) are not set, then the method will delete data only for today!
Example GET request:
https://semysms.net/api/3/del_outbox_sms.php?token=2d9d148edeb50768c22dc6d96f85d60b&device=1&start_id=1&end_id=371&date_start=2015-08-9 10:30&date_end=2015-08-9 22:30&phone=123457890
Sample answer:
{"count":1,
"data":[
{
"id":371,
"phone":"8920123xxxx",
"date":"2015-02-04 12:41:13.657724",
"msg":"test",
"id_device":1,
"send_to_phone":"2015-02-04 12:42:01.490436",
"is_send_to_phone":1,
"is_send":1,
"send":"2015-02-04 12:47:31",
"is_delivered":1,
"delivered":"2015-02-04 12:47:33",
"is_error":0,
"is_error_send":0,
"error_date":null
}
]
}
Method to deleting incoming SMS messages
https://semysms.net/api/3/del_inbox_sms.php - url to send requests
Parameters:
Attention - if parameters ( start_id, date_start, date_end ) are not set, then the method will delete data only for today!
Example GET request:
https://semysms.net/api/3/del_inbox_sms.php?token=2d9d148edeb50768c22dc6d96f85d60b&device=1&start_id=1&end_id=371&phone=123457890
Sample answer:
{"count":1,
"data":[
{
"id":15,
"phone":"+7920123xxxx",
"date":"2015-01-27 13:03:42",
"msg":"Test",
"id_device":1
}
]
}