API Documentation


Sending SMS

List of outgoing SMS

List of incoming SMS

Cancel sending SMS, which was not sent to device


Method to send a single SMS to one recipient

https://semysms.net/api/3/sms.php - url to send requests

Parameters:


Example GET request:

https://semysms.net/api/3/sms.php?token=2d9d148edeb50768c22dc6d96f85d60b&device=1&phone=8920123xxxx&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:


Example GET request:

https://semysms.net/api/3/outbox_sms.php?token=2d9d148edeb50768c22dc6d96f85d60b&device=1&start_id=1&end_id=371
        

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 receive incoming SMS messages

https://semysms.net/api/3/inbox_sms.php - url to send requests

Parameters:


Example GET request:

https://semysms.net/api/3/inbox_sms.php?token=2d9d148edeb50768c22dc6d96f85d60b&device=1&start_id=1&end_id=371
        

Sample answer:

{"count":1,
 "data":[
         {
          "id":15,
          "phone":"+7920123xxxx",
          "date":"2015-01-27 13:03:42",
          "msg":"Test",
          "id_device":1
         }
        ]
}
        

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