API Sendbox SMS Documentation

General principles of sending

JSON documents are sent to a specific server address (description of JSON documents, their purpose and server addresses are given below). The POST method is used.

The headers of the data sent must contain:

Content-Type: application/json; charset=utf-8

JSON document encoding is UTF-8.

Example of transferring a JSON document to php

$param = array(
  'security' => array('login' => 'Login', 'password' => 'Password'),
  'type' => 'sms'
);

$param_json = json_encode($param, true);
// JSON document

$href = 'https://hostname/sendsmsjson.php'; // server address

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json','charset=utf-8','Expect:'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $param_json);
curl_setopt($ch, CURLOPT_TIMEOUT, 600);
curl_setopt($ch, CURLOPT_URL, $href);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
$res = curl_exec($ch);
$result = json_decode($res, true);
curl_close($ch);
print_r($result);

Sending SMS, Flash SMS, WAP-Push

Server address:

https://hostname/sendsmsjson.php

JSON document:

{
  "security":{
    "login":"login",
    "password":"password"
  },
  "type":"sms",
  "message":[
    {
      "type":"sms",
      "sender":"Sender 1",
      "text":"Message text 1",
      "name_delivery":"Mailing 1",
      "translite":"1",
      "abonent":[
        {"phone":"79001234567","number_sms":"1","client_id_sms":"100","time_send":"2016-11-09 12:40","validity_period":"2016-11-09 13:30"},
        {"phone":"79001234568","number_sms":"2","client_id_sms":"101"}
      ],
      "base":[
        {"base":"4","time_send":"2016-11-09 12:40"},
        {"base":"5"}
      ],
      "stop_base":[
        {"base":"6"},
        {"base":"7"}
      ]
    },
    {
      "type":"sms",
      "sender":"Sender 2",
      "text":"Message text 2",
      "name_delivery":"Mailing 2",
      "abonent":[
        {"phone":"79001234569","number_sms":"1","client_id_sms":"111"},
        {"phone":"79001234570","number_sms":"2","client_id_sms":"112"}
      ]
    }
  ]
}

PHP-data:

$param = array(
  'security' => array('login' => 'login', 'password' => 'password'),
  'type' => 'sms',
  'message' => array(
    array(
      'type' => 'sms',
      'sender' => 'Sender 1',
      'text' => 'Message text 1',
      'name_divery' => 'Mailing 1',
      'translite' => '1',
      'abonent' => array(
        array('phone' => '79001234567', 'number_sms' => '1', 'client_id_sms' => '100', 'time_send' => '2016-11-09 12:40', 'validity_period' => '2016-11-09 13:30'),
        array('phone' => '79001234568', 'number_sms' => '2', 'client_id_sms' => '101')
      ),
      'base' => array(
        array('base' => '4', 'time_send' => '2016-11-09 12:40'),
        array('base' => '5')
      ),
      'stop_base' => array(
        array('base' => '6'),
        array('base' => '7')
      )
    ),
    array(
      'type' => 'sms',
      'sender' => 'Sender 2',
      'text' => 'Message text 2',
      'name_delivery' => 'Mailing 2',
      'abonent' => array(
        array('phone' => '79001234569', 'number_sms' => '1', 'client_id_sms' => '111'),
        array('phone' => '79001234570', 'number_sms' => '2', 'client_id_sms' => '112')
      )
    )
  )
);

Where:

  • security -- credentials for authorization:
    • login -- your login to the system;
    • password -- your password in the system;
  • Instead of login and password, you can use the Token generated in the Personal Account. It is necessary to use the variable Authorization: Bearer <TOKEN>
  • type - request type (sms - sending SMS);
  • message - data of the SMS sent:
    • type - type of SMS message being sent (sms - regular SMS);
    • sender -- SMS sender. This value will be displayed on the abonent's phone in the "from" field of the SMS;
    • text -- SMS text. When sending to your database, you can use variables from the database, for example #number#, #name#;
    • name_delivery -- Name of the SMS campaign. By default, "Gateway";
    • translate - transliteration of the SMS text from Cyrillic to Latin (optional parameter). For transliteration, this parameter must be equal to 1;
    • abonent - SMS recipients;
      • phone -- the number of the abonent to whom the SMS is addressed. In international format, for example, 79000000001 (for Russia), 380441234567 (for Ukraine), etc.;
      • number_sms - message number within the JSON document being sent;
      • client_id_sms - number. An optional parameter that allows you to avoid resending. If an SMS with this number has already been sent from this account, then resending is not performed, but the number of the previously sent SMS is returned;
      • time_send -- date and time of sending in the format: YYYY-MM-DD hh:mm where, YYYY-year, MM-month, DD-day, hh-hours, mm-minutes. If not specified, the SMS is sent immediately;
      • validity_period -- date and time after which no attempts will be made to deliver SMS in the format: YYYY-MM-DD hh:mm, where YYYY is the year, MM is the month, DD is the day, hh is the hour, mm is the minute. If not specified, the SMS has a maximum lifespan;
    • base -- mailing base;
      • base -- base ID that can be found in the Personal Account. Check with your manager whether the platform supports the ability to send to the base;
      • time_send -- date and time of sending in the format: YYYY-MM-DD hh:mm where, YYYY-year, MM-month, DD-day, hh-hours, mm-minutes. If not specified, the SMS is sent immediately;
    • stop_base - stop list base (Ignoring numbers from sent numbers). Check with your manager whether the stop list bases are supported;
      • base -- base ID that can be found in the Personal Account. Check with your manager whether the platform supports the ability to send to the base.

The response may be one of the following JSON documents:

If an error occurs in the JSON document being sent

JSON:

{
  "error":"error text"
}

PHP (array obtained via php function json_decode):

array ('error' => 'error text')

error - the error text can take the following values:

  1. Invalid JSON document format;
  2. Incorrect login or password;
  3. POST data missing;
If you receive a valid JSON document:

JSON:

{
  "sms":[
    {"number_sms":"1","id_sms":"SMS ID in the system for checking the status","parts":"1","action":"Status/error message"},
    {"number_sms":"2","id_sms":"SMS ID in the system for checking the status","parts":"1","action":"Status/error message"}
    {"base":"4","phone":79801234567,"id_sms":"SMS ID in the system for checking the status","parts":"1","action":"Status/error message"}
    {"base":"4","phone":79801234568,"id_sms":"SMS ID in the system for checking the status","parts":"1","action":"Status/error message"}
  ]
}

PHP (array obtained via php function json_decode):

Array(
  [sms] => Array(
    [0] => Array( [number_sms] => 1 [id_sms] => SMS ID in the system to check the status [parts] => 1 [action] => Status/error message )
    [1] => Array( [number_sms] => 2 [id_sms] => SMS ID in the system to check the status [parts] => 1 [action] => Status/error message )
    [2] => Array( [base] => 4 [phone] => 79801234567 [id_sms] => SMS ID in the system for checking the status [parts] => 1 [action] => Status/error message )
    [3] => Array( [base] => 4 [phone] => 79801234568 [id_sms] => SMS ID in the system for checking the status [parts] => 1 [action] => Status/error message )
  )
)

Where:

  • number_sms - message number specified when sending a JSON document;
  • id_sms - SMS message number. Used to check the SMS status. If an error occurs during sending the SMS, id_sms is not transmitted;
  • parts - number of SMS parts;
  • base - Mailing list base, if the mailing was sent to a base;
  • phone - Phone number;
  • action - message status ("send"), if the SMS was sent. Or an error message if an error occurred during the SMS sending process:
    1. We have run out of SMS. Please contact the manager to resolve the issue.
    2. SMS have run out.
    3. Account blocked.
    4. Enter your phone number.
    5. The phone number is on the stop list.
    6. This direction is closed to you.
    7. This direction is closed.
    8. Not enough funds to send SMS. SMS will be sent as soon as you top up your account in this direction.
    9. SMS text rejected by moderator.
    10. No sender.
    11. The sender must not exceed 15 characters for digital numbers and 11 characters for alphanumeric ones.
    12. The phone number must be less than 15 characters.
    13. No message text.
    14. No link.
    15. There is no such sender.
    16. The sender has not passed moderation.
    17. This message has already been sent.

Request for SMS message status

Server address:

https://hostname/sendsmsjson.php

JSON document:

{
  "security":{
    "login":"login",
    "password":"password"
  },
  "type":"state",
  "get_state":["SMS ID in the system for checking the status","SMS ID in the system for checking the status"]
}

PHP data:

$param = array(
  'security' => array('login' => 'login', 'password' => 'password'),
  'type' => 'state',
  'get_state' => array('SMS ID in the system to check the status', 'SMS ID in the system to check the status')
);

Where:

  • security - authorization data:
    • login - your login in the system;
    • password - your password in the system;
  • Instead of login and password, you can use the Token generated in the Personal Account. It is necessary to use the variable Authorization: Bearer <TOKEN>
  • type - request type (state - SMS message statuses);
  • get_state - SMS message numbers received in the response JSON document during the process of sending an SMS message.

The response may be one of the following JSON documents:

If an error occurs in the JSON document being sent:

JSON:

{
  "error":"error text"
}

PHP (array obtained via php function json_decode):

array ('error' => 'error text')

error - the error text can take the following values:

  1. Invalid JSON document format;
  2. Incorrect login or password;
  3. POST data missing;
If you receive a valid JSON document:

JSON:

{
  "state":[
    {"id_sms":"SMS ID in the system for checking the status","time":"2016-03-02 18:31:38","state":"Status/error message","num_parts":"2","price":"1.15"},
    {"id_sms":"SMS ID in the system for checking the status","time":"2016-03-02 18:31:39","state":"Status/error message","num_parts":"1","price":"1.15"}
  ]
}

PHP (array obtained via php function json_decode):

Array (
  [state] => Array (
    [0] => Array( [id_sms] => SMS ID in the system to check the status [time] => 2016-03-02 18:31:38 [state] => Status/error message [num_parts] => 2 [price] => 1.15 )
    [1] => Array( [id_sms] => SMS ID in the system to check the status [time] => 2016-03-02 18:31:39 [state] => Status/error message [num_parts] => 1 [price] => 1.15 )
  )
)

Where:

  • id_sms - SMS message number received in the response JSON document during the process of sending the SMS message.
  • time - time of status change.
  • state - message status:
    1. "send" - message status not received. In this case, an empty time is transmitted (time="");
    2. "not_deliver" - the message was not delivered. Final status (does not change over time);
    3. "expired" - the abonent was not online at the time the delivery attempt was made. End Status (does not change over time;
    4. "deliver" - the message has been delivered. Final status (does not change over time);
    5. "partly_deliver" - the message was sent, but the status was not received. The final status (does not change over time). In this case, to clarify the reasons for the lack of status, you must contact technical support;
  • num_parts - Number of parts in SMS.
  • price - Price for one part of SMS.

Balance Check Request

Server address:

https://hostname/sendsmsjson.php

JSON document:

{
  "security":{
    "login":"login",
    "password":"password"
  },
  "type":"balance"
}

PHP data:

$param = array(
  'security' => array('login' => 'login', 'password' => 'password'),
  'type' => 'balance'
);

Where:

  • security - authorization data:
    • login - your login in the system;
    • password - your password in the system;
  • Instead of login and password, you can use the Token generated in the Personal Account. It is necessary to use the variable Authorization: Bearer <TOKEN>
  • type - request type (balance - balance and number of available SMS by operators).

The response may be one of the following JSON documents:

If an error occurs in the JSON document being sent:

JSON:

{
  "error":"error text"
}

PHP (array obtained via php function json_decode):

array ('error' => 'error text')

error - the error text can take the following values:

  1. Invalid JSON document format;
  2. Incorrect login or password;
  3. POST data missing;
If you receive a valid JSON document:

JSON:

{
  "money":{"currency":"RUR","value":"356.1"},
  "sms":[
    {"area":"MTS","number":"323","price":"1.1","type_sms":"sms","type_text":"Advertising","MCC":"250","MNC":"1"},
    {"area":"Megafon","number":"178","price":"2","type_sms":"sms","type_text":"Service","MCC":"250","MNC":"2"}
  ]
}

PHP (array obtained via php function json_decode):

Array (
  [money] => Array ( [currency] => RUR [value] => 356.1 )
  [sms] => Array (
    [0] => Array( [area] => MTS [number] => 323 [price] => 1.1 [type_sms] => sms [type_text] => Advertising [MCC] => 250 [MNC] => 1 )
    [1] => Array( [area] => Megafon [number] => 178 [price] => 2 [type_sms] => sms [type_text] => Service [MCC] => 250 [MNC] => 2 )
  )
)

Where:

  • money - user balance:
    • currency - balance currency;
    • value - amount of funds;
  • sms - number of available SMS messages in directions:
    • area - the direction in which the SMS can be sent;
    • number - the number of messages available for this direction;
    • price - price per message;
    • type_sms - message type (sms / viber / vk / whatsapp);
    • type_text - type of text in the message (Advertising / Service / Transactional);
    • MCC - (English: Mobile Country Code) mobile country code;
    • MNC - (English Mobile Network Code) mobile network code.

The number of SMS messages cannot be summed up in different directions. When sending SMS messages in one direction, the number of available SMS messages in all other directions is reduced in accordance with their cost.

Request for balance top-up link

Server address:

https://hostname/sendsmsjson.php

JSON document:

{
  "security":{
    "login":"login",
    "password":"password"
  },
  "type":"pay",
  "sum":100
}

PHP data:

$param = array(
  'security' => array('login' => 'login', 'password' => 'password'),
  'type' => 'pay',
  'sum' => 100
);

Where:

  • security - authorization data:
    • login - your login in the system;
    • password - your password in the system;
  • Instead of login and password, you can use the Token generated in the Personal Account. It is necessary to use the variable Authorization: Bearer <TOKEN>
  • type - request type (pay - Request to receive a link for further balance replenishment);
  • sum - Amount of balance replenishment (payment amount may be increased due to store commission).

The response may be one of the following JSON documents:

If an error occurs in the JSON document being sent:

JSON:

{
  "error":"error text"
}

PHP (array obtained via php function json_decode):

array ('error' => 'error text')
If you receive a valid JSON document:

JSON:

{
  "sum_pay":101,
  "url":"LINK"
}

PHP (array obtained via php function json_decode):

Array (
  [sum_pay] => 101
  [url] => LINK
)

Where:

  • sum_pay - The amount that you must pay in the payment system to top up the balance of the amount you specified;
  • url - Link to the payment system.

Request to get a list of senders

Server address:

https://hostname/sendsmsjson.php

JSON document:

{
  "security":{
    "login":"login",
    "password":"password"
  },
  "type":"originator"
}

PHP data:

$param = array(
  'security' => array('login' => 'login', 'password' => 'password'),
  'type' => 'originator'
);

Where:

  • security - authorization data:
    • login - your login in the system;
    • password - your password in the system;
  • Instead of login and password, you can use the Token generated in the Personal Account. It is necessary to use the variable Authorization: Bearer <TOKEN>
  • type - request type (originator - list of senders).

The response may be one of the following JSON documents:

If an error occurs in the JSON document being sent:

JSON:

{
  "error":"error text"
}

PHP (array obtained via php function json_decode):

array ('error' => 'error text')

error - the error text can take the following values:

  1. Invalid JSON document format;
  2. Incorrect login or password;
  3. POST data missing;
If you receive a valid JSON document:

JSON:

{
  "any_originator":"FALSE",
  "list_originator":[
    {"state":"completed","originator":"Sender 1"},
    {"state":"order","originator":"Sender 2"},
    {"state":"rejected","originator":"Sender 3"}
  ]
}

PHP (array obtained via php function json_decode):

Array (
  [any_originator] => FALSE
  [list_originator] => Array (
    [0] => Array( [state] => completed [originator] => Sender 1 )
    [1] => Array( [state] => order [originator] => Sender 2 )
    [2] => Array( [state] => rejected [originator] => Sender 3 )
  )
)

Where:

  • any_originator - TRUE/FALSE - whether the client can send from any sender or only from pre-approved ones. If TRUE, the client can use any sender. In this case, the list of senders is not returned. FALSE - only senders with the status "completed" can be used;
  • state - sender status:
    1. "order" - is being processed;
    2. "completed" - ready for use;
    3. "rejected" - rejected.

Request for incoming SMS

Server address:

https://hostname/sendsmsjson.php

JSON document:

{
  "security":{
    "login":"login",
    "password":"password"
  },
  "type":"incoming",
  "time":{
    "start":"2016-08-25 15:28:38",
    "end":"2018-02-31 12:24:00"
  }
}

PHP data:

$param = array(
  'security' => array('login' => 'login', 'password' => 'password'),
  'type' => 'incoming',
  'time' => array('start' => '2016-08-25 15:28:38', 'end' => '2018-02-31 12:24:00')
);

Where:

  • security - authorization data:
    • login - your login in the system;
    • password - your password in the system;
  • Instead of login and password, you can use the Token generated in the Personal Account. It is necessary to use the variable Authorization in the request header: Bearer <TOKEN>
  • type - request type (incoming - list of incoming SMS);
  • time - time of incoming SMS:
    • start - time (not inclusive) from which incoming SMS are requested;
    • end - time (not inclusive) up to which incoming SMS are requested. Optional parameter. If not specified, all SMS will be returned.

The response may be one of the following JSON documents:

If an error occurs in the JSON document being sent:

JSON:

{
  "error":"error text"
}

PHP (array obtained via php function json_decode):

array ('error' => 'error text')

error - the error text can take the following values:

  1. Invalid JSON document format;
  2. Incorrect login or password;
  3. POST data missing;
If you receive a valid JSON document:

JSON:

{
  "sms":[
    {"id_sms":"1234","date_receive":"2016-08-25 15:28:38","originator":"79001234567","prefix":"IGRA","phone":"3434","text_sms":"TextSMS."},
    {"id_sms":"1235","date_receive":"2016-08-25 15:29:38","originator":"79001234568","prefix":"IGRA","phone":"3434","text_sms":"TextSMS."}
  ]
}

PHP (array obtained via php function json_decode):

Array(
  [sms] => Array(
    [0] => Array( [id_sms] => 1234 [date_receive] => 2016-08-25 15:28:38 [originator] => 79001234567 [prefix] => IGRA [phone] => 3434 [text_sms] => TextSMS. )
    [1] => Array( [id_sms] => 1235 [date_receive] => 2016-08-25 15:29:38 [originator] => 79001234568 [prefix] => IGRA [phone] => 3434 [text_sms] => TextSMS. )
  )
)

Where:

  • id_sms - a unique number consisting only of numbers;
  • date_receive - date and time of receiving the SMS;
  • originator - the telephone number of the abonent who sent the SMS;
  • prefix - prefix. The initial part of the SMS text, by which it was determined that this SMS belongs to this particular client. (Used if the same number is used by different clients.);
  • phone - the phone number to which the SMS was sent;
  • text_sms - SMS text.

Request for receiving information by phone number

Server address:

https://hostname/sendsmsjson.php

JSON document:

{
  "security":{
    "login":"login",
    "password":"password"
  },
  "type":"def",
  "phones":["79001234567","79001234568"]
}

PHP data:

$param = array(
  'security' => array('login' => 'login', 'password' => 'password'),
  'type' => 'def',
  'phones' => array('79001234567', '79001234568')
);

Where:

  • security - authorization data:
    • login - your login in the system;
    • password - your password in the system;
  • Instead of login and password, you can use the Token generated in the Personal Account. It is necessary to use the variable Authorization in the request header: Bearer <TOKEN>
  • type - request type (def - information on the specified phone numbers);
  • phones - Telephone numbers.

The response may be one of the following JSON documents:

If an error occurs in the JSON document being sent:

JSON:

{
  "error":"error text"
}

PHP (array obtained via php function json_decode):

array ('error' => 'error text')

error - the error text can take the following values:

  1. Invalid JSON document format;
  2. Incorrect login or password;
  3. POST data missing;
If you receive a valid JSON document:

JSON:

{
  "phones":[
    {"phone":"79001234567","operator":"BeeLine","region":"Moscow region","time_zone":"3"},
    {"phone":"79001234568","operator":"BeeLine","region":"Moscow region","time_zone":"3"}
  ]
}

PHP (array obtained via php function json_decode):

Array(
  [phones] => Array(
    [0] => Array( [phone] => 79001234567 [operator] => BeeLine [region] => Moscow region [time_zone] => 3 )
    [1] => Array( [phone] => 79001234568 [operator] => BeeLine [region] => Moscow region [time_zone] => 3 )
  )
)

Where:

  • phone- telephone number;
  • operator- Operator;
  • region- Region;
  • time_zone- Time shift in hours relative to the time in Moscow.

Request to get a list of databases

Server address:

https://hostname/sendsmsjson.php

JSON document:

{
  "security":{
    "login":"login",
    "password":"password"
  },
  "type":"list_bases"
}

PHP data:

$param = array(
  'security' => array('login' => 'login', 'password' => 'password'),
  'type' => 'list_bases'
);

Where:

  • security - authorization data:
    • login - your login in the system;
    • password - your password in the system;
  • Instead of login and password, you can use the Token generated in the Personal Account. It is necessary to use the variable Authorization: Bearer <TOKEN>
  • type - request type (list_bases - list of bases).

The response may be one of the following JSON documents:

If an error occurs in the JSON document being sent:

JSON:

{
  "error":"error text"
}

PHP (array obtained via php function json_decode):

array ('error' => 'error text')

error - the error text can take the following values:

  1. Invalid JSON document format;
  2. Incorrect login or password;
  3. POST data missing;
If you receive a valid JSON document:

JSON:

{
  "base":[
    {"id_base":"1234","name_base":"Head Office Base","time_birth":"12:48","local_time_birth":"yes","day_before":"0","originator_birth":"fitnes","on_birth":"yes","text_birth":"Congratulations!"},
    {"id_base":"1235","name_base":"MoscowOfficeBase","time_birth":"12:48","local_time_birth":"no","day_before":"0","originator_birth":"fitnes","on_birth":"no","text_birth":"Congratulations!"}
  ]
}

PHP (array obtained via php function json_decode):

Array (
  [base] => Array (
    [0] => Array( [id_sms] => 1234 [name_base] => HeadquartersBase [time_birth] => 12:48 [local_time_birth] => yes [day_before] => 0 [originator_birth] => fitnes [on_birth] => yes [text_birth] => Congratulations! )
    [1] => Array( [id_sms] => 1235 [name_base] => MoscowOfficeBase [time_birth] => 12:48 [local_time_birth] => yes [day_before] => 1 [originator_birth] => fitnes [on_birth] => no [text_birth] => Congratulations! )
  )
)

Where:

  • id_base - unique database number in the system;
  • name_base - name of the base;
  • time_birth - time for congratulations;
  • local_time_birth - read the time of congratulations relative to the abonent's local time (yes) or relative to the system time (no);
  • day_before - how many days before a birthday should you congratulate;
  • originator_birth - sender of congratulations;
  • on_birth - are congratulations enabled? yes -- enabled, no -- disabled;
  • base - congratulatory text.

Request to change parameters/add/remove databases

Server address:

https://hostname/sendsmsjson.php

JSON document:

{
  "security":{
    "login":"login",
    "password":"password"
  },
  "type":"bases",
  "bases":[
    {"id_base":"1234","name_base":"Head Office Base","time_birth":"12:48","local_time_birth":"yes","day_before":"0","originator_birth":"fitnes","on_birth":"yes","text_birth":"Congratulations!"},
    {"number_base":"1","name_base":"MoscowOfficeBase","time_birth":"12:48","local_time_birth":"no","day_before":"1","originator_birth":"fitnes","on_birth":"no","text_birth":"Congratulations!"}
  ],
  "delete_bases":[
    {"id_base":"1236"},
    {"id_base":"1237"}
  ]
}

PHP data:

$param = array(
  'security' => array('login' => 'login', 'password' => 'password'),
  'type' => 'bases',
  'bases' => array(
    array('id_base' => '1234', 'name_base' => 'HeadquartersBase', 'time_birth' => '12:48', 'local_time_birth' => 'yes', 'day_before' => '1', 'originator_birth' => 'fitnes', 'on_birth' => 'yes', 'text_birth' => 'Congratulations!'),
    array('number_base' => '1', 'name_base' => 'MoscowOfficeBase', 'time_birth' => '12:48', 'local_time_birth' => 'yes', 'day_before' => '1', 'originator_birth' => 'fitnes', 'on_birth' => 'yes', 'text_birth' => 'Congratulations!')
  ),
  'delete_bases' => array(
    array('id_base' => '1236'),
    array('id_base' => '1237')
  )
);

Where:

  • security - authorization data:
    • login - your login in the system;
    • password - your password in the system;
  • Instead of login and password, you can use the Token generated in the Personal Account. It is necessary to use the variable Authorization in the request header: Bearer <TOKEN>
  • type - request type (bases - working with databases);
  • bases - Adding or changing database parameters:
    • id_base - unique database number in the system. If not specified, the database will be added. In this case, you need to specify the number_base parameter;
    • number_base - the database number in the JSON request. Used to match the IDs of the added databases (if there were several in the request);
    • name_base - name of the base;
    • time_birth - time for congratulations;
    • local_time_birth - calculate the time of congratulations relative to the abonent's local time (yes) or relative to the system time (no);
    • originator_birth - sender of congratulations;
    • on_birth - are congratulations enabled? yes -- enabled, no -- disabled;
    • text_birth - congratulatory text;
  • delete_bases - deletion of the specified databases:
    • id_base - unique database number in the system.

The response may be one of the following JSON documents:

If an error occurs in the JSON document being sent:

JSON:

{
  "error":"error text"
}

PHP (array obtained via php function json_decode):

array ('error' => 'error text')

error - the error text can take the following values:

  1. Invalid JSON document format;
  2. Incorrect login or password;
  3. POST data missing;
If you receive a valid JSON document:

JSON:

{
  "bases":[
    {"id_base":"1234","action":"edit"},
    {"id_base":"1235","action":"insert","number_base":"1"},
    {"id_base":"1236","action":"delete"},
    {"id_base":"1237","action":"not_found"}
  ]
}

PHP (array obtained via php function json_decode):

Array (
  [bases] => Array (
    [0] => Array( [id_base] => 1234 [action] => edit )
    [1] => Array( [id_base] => 1235 [action] => insert [number_base] => 1 )
    [2] => Array( [id_base] => 1236 [action] => delete )
    [3] => Array( [id_base] => 1237 [action] => not_found )
  )
)

Where:

  • id_base - unique database number in the system;
  • action - action performed with the base:
    1. "edit" - change database parameters;
    2. "insert" - adding a database;
    3. "delete" - the database is deleted;
    4. "not_found" - the database with the specified identifier was not found;
  • number_base - the base number in the JSON request. Used to match the IDs of the added bases (if there were several in the request).

Request to obtain a list of database abonents

Server address:

https://hostname/sendsmsjson.php

JSON document:

{
  "security":{
    "login":"login",
    "password":"password"
  },
  "type":"list_phones",
  "base":{"id_base":"1234","page":"1","last_update":"2016-10-18 12:14:25"}
}

PHP data:

$param = array(
  'security' => array('login' => 'login', 'password' => 'password'),
  'type' => 'list_phones',
  'base' => array('id_base' => '1234', 'page' => '1', 'last_update' => '2016-10-18 12:14:25')
);

Where:

  • security - authorization data:
    • login - your login in the system;
    • password - your password in the system;
  • Instead of login and password, you can use the Token generated in the Personal Account. It is necessary to use the variable Authorization: Bearer <TOKEN>
  • type - request type (list_phones - list of abonents in the database);
  • base - base:
    • id_base - unique database number in the system;
    • page - page number. The entire list of database numbers is divided into pages. It is impossible to request the entire database. It is only possible to request a separate page. The numbering starts with one;
    • last_update - minimum date and time of registration (or last change) of abonent data that you need to request. Optional parameter.

The response may be one of the following JSON documents:

If an error occurs in the JSON document being sent:

JSON:

{
  "error":"error text"
}

PHP (array obtained via php function json_decode):

array ('error' => 'error text')

error - the error text can take the following values:

  1. Invalid JSON document format;
  2. Incorrect login or password;
  3. POST data missing;
  4. There is no database with this number;
If you receive a valid JSON document:

JSON:

{
  "page":"1",
  "num_pages":"100",
  "phones":[
    {"phone":"79001234567","region":"Moscow","operator":"Megafon","name":"Ivan","surname":"Ivanov","patronymic":"Ivanovich","date_birth":"1984-08-21","male":"m","addition_1":"First additional field","addition_2":"second","addition_3":"third","addition_4":"fourth","addition_5":"fifth","last_update":"2016-11-15 11:02:29"},
    {"phone":"79001234568","region":"Moscow","operator":"Megafon","name":"Ivan","surname":"Ivanov","patronymic":"Ivanovich","date_birth":"1984-08-21","male":"m","addition_1":"First additional field","addition_2":"second","addition_3":"third","addition_4":"fourth","addition_5":"fifth","last_update":"2016-11-15 11:02:29"}
  ]
}

PHP (array obtained via php function json_decode):

Array (
  [page] => 1
  [num_pages] => 100
  [phones] => Array (
    [0] => Array( [phone] => 79001234567 [region] => Moscow [operator] => Megafon [name] => Ivan [surname] => Ivanov [patronymic] => Ivanovich [date_birth] => 1984-08-21 [male] => m [addition_1] => Firstadditionalfield [addition_2] => Second [addition_3] => Third [addition_4] => Fourth [addition_5] => Fifth [last_update] => 2016-11-15 11:02:29 )
    [1] => Array( [phone] => 79001234568 [region] => Moscow [operator] => Megafon [name] => Ivan [surname] => Ivanov [patronymic] => Ivanovich [date_birth] => 1984-08-21 [male] => m [addition_1] => Firstadditionalfield [addition_2] => Second [addition_3] => Third [addition_4] => Fourth [addition_5] => Fifth [last_update] => 2016-11-15 11:02:29 )
  )
)

Where:

  • page - page number;
  • num_pages - total pages;
  • phone - abonent's telephone number;
  • region - region;
  • operator - operator;
  • name - abonent's name;
  • surname - abonent's surname;
  • patronymic - abonent's patronymic;
  • date_birth - date of birth;
  • male - gender. "m" - male, "f" - female;
  • addition_1 -- the first additional field;
  • addition_2 -- the second additional field;
  • addition_3 -- the third additional field;
  • addition_4 -- the fourth additional field;
  • addition_5 -- the fifth additional field;
  • last_update - date and time of registration (or last change) of abonent data.

Request to add/edit/delete abonents from the database

Server address:

https://hostname/sendsmsjson.php

JSON document:

{
  "security":{
    "login":"login",
    "password":"password"
  },
  "type":"phones",
  "id_base":"1234",
  "phones":[
    {"phone":"79001234567","region":"Moscow","operator":"Megafon","name":"Ivan","surname":"Ivanov","patronymic":"Ivanovich","date_birth":"1985-09-21","male":"male","addition_1":"First additional field","addition_2":"second","addition_3":"third","addition_4":"fourth","addition_5":"fifth","number_phone":"1"},
    {"phone":"79001234568","region":"Moscow","operator":"Megafon","name":"Ivan","surname":"Ivanov","patronymic":"Ivanovich","date_birth":"1985-09-21","male":"male","addition_1":"First additional field","addition_2":"second","addition_3":"third","addition_4":"fourth","addition_5":"fifth","number_phone":"2"},
    {"phone":"79612242245","action":"delete","number_phone":"5"},
    {"phone":"79612242246","action":"delete","number_phone":"6"}
  ]
}

PHP data:

$param = array(
  'security' => array('login' => 'login', 'password' => 'password'),
  'type' => 'phones',
  'id_base' => '1234',
  'phones' => array(
    array('phone' => '79001234567', 'region' => 'Moscow', 'operator' => 'Megafon', 'name' => 'Ivan', 'surname' => 'Ivanov', 'patronymic' => 'Ivanovich', 'date_birth' => '1985-09-21', 'male' => 'male', 'addition_1' => 'Firstadditionfield', 'addition_2' => 'second', 'addition_3' => 'third', 'addition_4' => 'fourth', 'addition_5' => 'fifth', 'number_phone' => '1'),
    array('phone' => '79001234568', 'region' => 'Moscow', 'operator' => 'Megafon', 'name' => 'Ivan', 'surname' => 'Ivanov', 'patronymic' => 'Ivanovich', 'date_birth' => '1985-09-21', 'male' => 'male', 'addition_1' => 'Firstadditionfield', 'addition_2' => 'second', 'addition_3' => 'third', 'addition_4' => 'fourth', 'addition_5' => 'fifth', 'number_phone' => '2'),
    array('phone' => '79001234569', 'action' => 'delete', 'number_phone' => '5'),
    array('phone' => '79001234570', 'action' => 'delete', 'number_phone' => '6')
  )
);

Where:

  • security - authorization data:
    • login - your login in the system;
    • password - your password in the system;
  • Instead of login and password, you can use the Token generated in the Personal Account. It is necessary to use the variable Authorization: Bearer <TOKEN>
  • type - request type (phones - working with abonent base);
  • id_base - base number in the system;
  • phones - telephone numbers;
    • phone - abonent's phone number. If a abonent with such a number already exists, it will be edited;
    • region - region. Optional field. If not specified, it is determined automatically;
    • operator - operator. Optional field. If not specified, it is determined automatically;
    • name - abonent name. Optional field;
    • surname - abonent's surname. Optional field;
    • patronymic - abonent's patronymic. Optional field;
    • date_birth - date of birth. Optional field;
    • male - gender. "male" or "female". Optional field;
    • addition_1 - the first additional field. Optional field;
    • addition_2 - the second additional field. Optional field;
    • addition_3 -- third additional field. Optional field;
    • addition_4 -- the fourth additional field. An optional field;
    • addition_5 -- the fifth additional field. An optional field;
    • action - Action performed on the phone (delete - remove the phone number from the database);
    • number_phone - phone number in JSON request. Used to match working number IDs.

The response may be one of the following JSON documents:

If an error occurs in the JSON document being sent:

JSON:

{
  "error":"error text"
}

PHP (array obtained via php function json_decode):

array ('error' => 'error text')

error - the error text can take the following values:

  1. Invalid JSON document format;
  2. Incorrect login or password;
  3. POST data missing;
  4. There is no database with this number;
If you receive a valid JSON document:

JSON:

{
  "id_base":"1234",
  "phones":[
    {"phone":"79001234567","number_phone":"1","action":"edit"},
    {"phone":"79001234568","number_phone":"2","action":"insert"},
    {"phone":"79001234569","number_phone":"5","action":"delete"},
    {"phone":"79001234570","number_phone":"6","action":"not_found"}
  ]
}

PHP (array obtained via php function json_decode):

Array (
  [id_base] => 1234
  [phones] => Array (
    [0] => Array( [phone] => 79001234567 [number_phone] => 1 [action] => edit )
    [1] => Array( [phone] => 79001234568 [number_phone] => 2 [action] => insert )
    [2] => Array( [phone] => 79001234569 [number_phone] => 5 [action] => delete )
    [3] => Array( [phone] => 79001234570 [number_phone] => 6 [action] => not_found )
  )
)

Where:

  • id_base - base number in the system;
  • phones - telephone numbers;
    • phone - abonent's telephone number;
    • action - action performed with the phone number:
      1. "edit" - change phone parameters;
      2. "insert" - adding a phone;
      3. "delete" - the phone is deleted;
      4. "not_found" - the phone with the specified number was not found;
    • number_phone - phone number in JSON request. Used to match working number IDs.

Request to get a list of numbers from the STOP list

Server address:

https://hostname/sendsmsjson.php

JSON document:

{
  "security":{
    "login":"login",
    "password":"password"
  },
  "type":"list_stop"
}

PHP data:

$param = array(
  'security' => array('login' => 'login', 'password' => 'password'),
  'type' => 'list_stop'
);

Where:

  • security - authorization data:
    • login - your login in the system;
    • password - your password in the system;
  • Instead of login and password, you can use the Token generated in the Personal Account. It is necessary to use the variable Authorization in the request header: Bearer <TOKEN>
  • type - request type (list_stop - list of numbers in the stop list).

The response may be one of the following JSON documents:

If an error occurs in the JSON document being sent:

JSON:

{
  "error":"error text"
}

PHP (array obtained via php function json_decode):

array ('error' => 'error text')

error - the error text can take the following values:

  1. Invalid JSON document format;
  2. Incorrect login or password;
  3. POST data missing;
If you receive a valid JSON document:

JSON:

{
  "phones":["79000000001","79000000002","79000000003","79001234567"]
}

PHP (array obtained via php function json_decode):

Array (
  [phones] => Array( [0] => 79000000001 [1] => 79000000002 [2] => 79000000003 [3] => 79001234567 )
)

Where:

  • phones - phone number from the STOP list.

Request to add/remove abonents from the STOP list

Server address:

https://hostname/sendsmsjson.php

JSON document:

{
  "security":{
    "login":"login",
    "password":"password"
  },
  "type":"stop",
  "add_stop":["79001234567","79001234568","79001234569"],
  "delete_stop":["79001234566","79001234565"]
}

PHP data:

$param = array(
  'security' => array('login' => 'login', 'password' => 'password'),
  'type' => 'stop',
  'add_stop' => array('79001234567', '79001234568', '79001234569'),
  'delete_stop' => array('79001234566', '79001234565')
);

Where:

  • security - authorization data:
    • login - your login in the system;
    • password - your password in the system;
  • Instead of login and password, you can use the Token generated in the Personal Account. It is necessary to use the variable Authorization: Bearer <TOKEN>
  • type - request type (stop - working with the STOP list);
  • add_stop - telephone numbers of abonents that need to be added to the STOP list;
  • delete_stop - telephone numbers of abonents that need to be removed from the STOP list.

The response may be one of the following JSON documents:

If an error occurs in the JSON document being sent:

JSON:

{
  "error":"error text"
}

PHP (array obtained via php function json_decode):

array ('error' => 'error text')

error - the error text can take the following values:

  1. Invalid JSON document format;
  2. Incorrect login or password;
  3. POST data missing;
If you receive a valid JSON document:

JSON:

{
  "phones":[
    {"phone":"79001234567","action":"add"},
    {"phone":"79001234568","action":"add"},
    {"phone":"79001234569","action":"add"},
    {"phone":"79001234570","action":"delete"},
    {"phone":"79001234571","action":"not_found"}
  ]
}

PHP (array obtained via php function json_decode):

Array (
  [phones] => Array (
    [0] => Array( [phone] => 79001234567 [action] => add )
    [1] => Array( [phone] => 79001234568 [action] => add )
    [2] => Array( [phone] => 79001234569 [action] => add )
    [3] => Array( [phone] => 79001234570 [action] => delete )
    [4] => Array( [phone] => 79001234571 [action] => not_found )
  )
)

Where:

  • phones - telephone numbers;
    • phone - abonent's telephone number;
    • action - action performed with the phone number:
      1. "add" - adding a phone number to the STOP list;
      2. "delete" - the phone number is removed from the STOP list;
      3. "not_found" - the phone number to be deleted was not found in the STOP list.

Request to get a list of scheduled SMS

Server address:

https://hostname/sendsmsjson.php

JSON document:

{
  "security":{
    "login":"login",
    "password":"password"
  },
  "type":"list_scheduled",
  "page":"1"
}

PHP data:

$param = array(
  'security' => array('login' => 'login', 'password' => 'password'),
  'type' => 'list_scheduled',
  'page' => '1'
);

Where:

  • security - authorization data:
    • login - your login in the system;
    • password - your password in the system;
  • Instead of login and password, you can use the Token generated in the Personal Account. It is necessary to use the variable Authorization: Bearer <TOKEN>
  • type - request type (list_scheduled - list of scheduled SMS).
  • page - page number. The entire list of scheduled SMS is divided into pages. You cannot request the entire list. You can only request a separate page. The numbering starts with one.

The response may be one of the following JSON documents:

If an error occurs in the JSON document being sent:

JSON:

{
  "error":"error text"
}

PHP (array obtained via php function json_decode):

array ('error' => 'error text')

error - the error text can take the following values:

  1. Invalid JSON document format;
  2. Incorrect login or password;
  3. POST data missing;
If you receive a valid JSON document:

JSON:

{
  "page":"1",
  "num_pages":"100",
  "scheduled":[
    {"id_sms":"1234","time_put_turn":"2016-08-31 14:56:53","originator":"fitnes","phone":"79001234567","type_sms":"sms","text_sms":"TextSMS","count_sms":"2","name_delivery":"Nameofdelivery","time_send":"2016-08-30 21:00","validity_period":"2016-09-03 14:56:53"},
    {"id_sms":"1235","time_put_turn":"2016-08-31 14:56:53","originator":"fitnes","phone":"79001234568","type_sms":"sms","text_sms":"TextSMS","count_sms":"2","name_delivery":"Nameofdelivery","time_send":"2016-08-30 21:00","validity_period":"2016-09-03 14:56:53"}
  ]
}

PHP (array obtained via php function json_decode):

Array (
  [page] => 1
  [num_pages] => 100
  [scheduled] => Array (
    [0] => Array( [id_sms] => 1234 [time_put_turn] => 2016-08-31 14:56:53 [originator] => fitnes [phone] => 79001234567 [type_sms] => sms [text_sms] => TextSMS [count_sms] => 2 [name_delivery] => Name of the mailing [time_send] => 2016-08-30 21:00 [validity_period] => 2016-09-03 14:56:53 )
    [1] => Array( [id_sms] => 1235 [time_put_turn] => 2016-08-31 14:56:53 [originator] => fitnes [phone] => 79001234568 [type_sms] => sms [text_sms] => TextSMS [count_sms] => 2 [name_delivery] => Name of the mailing [time_send] => 2016-08-30 21:00 [validity_period] => 2016-09-03 14:56:53 )
  )
)

Where:

  • page - page number;
  • num_pages - total pages;
  • scheduled - list of scheduled SMS;
    • id_sms - SMS number. Used to delete a scheduled SMS;
    • time_put_turn - time of adding to the scheduler;
    • operator -- SMS sender. This is the value that will be displayed on the abonent's phone in the SMS from field;
    • phone - the number of the abonent to whom the SMS is addressed;
    • type -- type of SMS message being sent:
      1. "sms" - regular SMS;
      2. "flashsms" - flash SMS;
      3. «wappush» - WAP-Push;
      4. "vcard" - business card (vCard);
    • text_sms - SMS message text;
    • count_sms -- Number of SMS message parts;
    • name_delivery - Newsletter name;
    • time_send - date and time of sending in the format: YYYY-MM-DDHH:MM where YYYY is the year, MM is the month, DD is the day, HH is the hour, MM is the minute;
    • validity_period - date and time after which no attempts will be made to deliver SMS in the format: YYYY-MM-DDHH:MM:SS where YYYY is the year, MM is the month, DD is the day, HH is the hour, MM is the minute, SS is the second.

Request to delete scheduled SMS

Server address:

https://hostname/sendsmsjson.php

JSON document:

{
  "security":{
    "login":"login",
    "password":"password"
  },
  "type":"scheduled",
  "delete_schedule":[
    {"id_sms":"1234"},
    {"id_sms":"1235"}
  ]
}

PHP data:

$param = array(
  'security' => array('login' => 'login', 'password' => 'password'),
  'type' => 'scheduled',
  'delete_schedule' => array(
    array('id_sms' => '1234'),
    array('id_sms' => '1235')
  )
);

Where:

  • security - authorization data:
    • login - your login in the system;
    • password - your password in the system;
  • Instead of login and password, you can use the Token generated in the Personal Account. It is necessary to use the variable Authorization: Bearer <TOKEN>
  • type - request type (scheduled - deletion of scheduled SMS);
  • delete_schedule - List of scheduled SMS deletion:
    • id_sms - the number of the scheduled SMS to be deleted. Can be obtained when requesting a list of scheduled SMS.

The response may be one of the following JSON documents:

If an error occurs in the JSON document being sent:

JSON:

{
  "error":"error text"
}

PHP (array obtained via php function json_decode):

array ('error' => 'error text')

error - the error text can take the following values:

  1. Invalid JSON document format;
  2. Incorrect login or password;
  3. POST data missing;
If you receive a valid JSON document:

JSON:

{
  "scheduled":[
    {"id_sms":"1234","action":"delete"},
    {"id_sms":"1235","action":"not_found"}
  ]
}

PHP (array obtained via php function json_decode):

Array (
  [scheduled] => Array (
    [0] => Array( [id_sms] => 1234 [action] => delete )
    [1] => Array( [id_sms] => 1235 [action] => not_found )
  )
)

Where:

  • phones - telephone numbers;
    • id_sms - scheduled SMS number;
    • action - action performed with scheduled SMS:
      1. delete - scheduled SMS is deleted;
      2. "not_found" - scheduled SMS not found.

Request time check

Server address:

https://hostname/sendsmsjson.php

JSON document:

{
  "security":{
    "login":"login",
    "password":"password"
  },
  "type":"time"
}

PHP data:

$param = array(
  'security' => array('login' => 'login', 'password' => 'password'),
  'type' => 'time'
);

Where:

  • security - authorization data:
    • login - your login in the system;
    • password - your password in the system;
  • Instead of login and password, you can use the Token generated in the Personal Account. It is necessary to use the variable Authorization in the request header: Bearer <TOKEN>
  • type - request type (time - time check).

The response may be one of the following JSON documents:

If an error occurs in the JSON document being sent:

JSON:

{
  "error":"error text"
}

PHP (array obtained via php function json_decode):

array ('error' => 'error text')

error - the error text can take the following values:

  1. Invalid JSON document format;
  2. Incorrect login or password;
  3. POST data missing;
If you receive a valid JSON document:

JSON:

{
  "time":"2016-11-17 15:34:05"
}

PHP (array obtained via php function json_decode):

Array (
  [time] => 2016-11-17 15:34:05
)

Where:

  • time - user's local time.

In this case, the time is calculated as the time on the server minus the difference in time zones between the user and the server.

Example

The server is located in Moscow and its server time is Moscow time, at the time of the request it was: 15:34:27. And the user was listed in Novosibirsk and the time zone difference (between the server and the user) was +3. In this case, you will get back a JSON document with the following content:

{
  "time":"2016-11-17 18:34:27"
}

Request for statistics

Statistics can be obtained only for the last 3 months. SMS older than 3 months are transferred to the archive. You can request an unloading of statistics on SMS older than 3 months through your manager.

Server address:

https://hostname/sendsmsjson.php

JSON document:

{
  "security":{
    "login":"login",
    "password":"password"
  },
  "type":"list_stats",
  "stats":{"date_start":"2016-11-20","date_stop":"2016-11-25","from_hour":"00","from_minute":"00","to_hour":"23","to_minute":"59",state="","originator":"INCORE","phone":"","operator":""}
}

PHP data:

$param = array(
  'security' => array('login' => 'login', 'password' => 'password'),
  'type' => 'list_stats',
  'stats' => array('date_start' => '2016-11-20', 'date_stop' => '2016-11-25', 'from_hour' => '00', 'from_minute' => '00', 'to_hour' => '23', 'to_minute' => '59', 'state' => '', 'originator' => 'INCORE', 'phone' => '', 'operator' => '')
);

Where:

  • security - authorization data:
    • login - your login in the system;
    • password - your password in the system;
  • Instead of login and password, you can use the Token generated in the Personal Account. It is necessary to use the variable Authorization: Bearer <TOKEN>
  • type - request type (list_stats - detailed statistics);
  • stats - statistics download parameters:
    • date_start - date of sending the SMS, not earlier than the specified time period (by default, today's date);
    • date_stop -- the date of sending the SMS, no later than the specified time period (by default, today's date);
    • from_hour - hour of sending SMS, not earlier than the specified time period. Taken into account together with the specified date (default 00);
    • from_minute - minute of sending the SMS, not earlier than the specified time period. Taken into account together with the specified date and hour (default 00);
    • to_hour - the hour of sending the SMS, no later than the specified time period. Taken into account together with the specified date (default 59);
    • to_minute - minute of sending the SMS, no later than the specified time period. Taken into account together with the specified date and hour (default 59);
    • state - message status:
      • not_deliver - the message was not delivered. Final status (does not change over time);
      • expired - the abonent was offline at the time the delivery attempt was made. Final Status (does not change over time);
      • deliver - message delivered. Final status (does not change over time);
      • partly_deliver - the message was sent, but the status was never received. The final status (does not change over time). In this case, to clarify the reasons for the lack of status, you must contact the technical support service;
    • originator - sender's name;
    • phone - SMS recipient's phone number;
    • operator - SMS recipient's mobile operator (Beeline, Megafon, MTS).

The response may be one of the following JSON documents:

If an error occurs in the JSON document being sent:

JSON:

{
  "error":"error text"
}

PHP (array obtained via php function json_decode):

array ('error' => 'error text')

error - the error text can take the following values:

  1. Invalid JSON document format;
  2. Incorrect login or password;
  3. POST data missing;
  4. Incorrect date format;
  5. No such operator found;
If you receive a valid JSON document:

JSON:

{
  "num_stats":"1",
  "stats":[
    {"id_sms":"100123","id_state":"2000123","operator":"MTS","name_delivery":"Name of the delivery","phone":"79001234567","originator":"SENDER_1","time_change_state":"2016-03-09 20:37:17","time":"2016-03-09 20:37:02","status":"deliver","status_translate":"Delivered","text":"TextSMS","price":"1.5","num_parts":"2","part_no":"1"},
    {"id_sms":"100124","id_state":"2000124","operator":"MTS","name_delivery":"SendName","phone":"79001234568","originator":"SENDER_1","time_change_state":"2016-03-09 20:37:17","time":"2016-03-09 20:37:02","status":"deliver","status_translate":"Delivered","text":"TextSMS","price":"1.5","num_parts":"2","part_no":"2"}
  ]
}

PHP (array obtained via php function json_decode):

Array (
  [num_stats] => 1
  [[stats] => Array (
    [0] => Array( [id_sms] => 100123 [id_state] => 2000123 [operator] => MTS [name_delivery] => Name of the mailing [phone] => 79001234567 [originator] => SENDER_1 [time_change_state] => 2016-03-09 20:37:17 [time] => 2016-03-09 20:37:02 [status] => deliver [status_translate] => Delivered [text] => TextSMS [price] => 1.5 [num_parts] => 2 [part_no] => 1 )
    [1] => Array( [id_sms] => 100124 [id_state] => 2000124 [operator] => MTS [name_delivery] => Name of the mailing [phone] => 79001234568 [originator] => SENDER_1 [time_change_state] => 2016-03-09 20:37:17 [time] => 2016-03-09 20:37:02 [status] => deliver [status_translate] => Delivered [text] => TextSMS [price] => 1.5 [num_parts] => 2 [part_no] => 2 )
  )
)

Where:

  • num_stats - total SMS;
  • stats - list of detailed statistics:
    • id_sms - SMS message number;
    • id_state - SMS part identifier;
    • operator - operator;
    • phone - SMS recipient's phone number;
    • originator - sender's name;
    • time_change_state - the last time the SMS status changed;
    • time - time of sending SMS;
    • status - message status:
      • not_deliver - the message was not delivered. Final status (does not change over time);
      • expired - the abonent was offline at the time the delivery attempt was made. Final Status (does not change over time);
      • deliver - message delivered. Final status (does not change over time);
      • partly_deliver - the message was sent, but the status was never received. The final status (does not change over time). In this case, to clarify the reasons for the lack of status, you must contact the technical support service;
    • status_translate - message status, in Russian;
    • price - price for one part of SMS;
    • num_parts - number of SMS parts;
    • part_no - serial number of the SMS part.

Request to receive data of the last 10 SMS

Statistics can be obtained only for the last 3 months. SMS older than 3 months are transferred to the archive. You can request an unloading of statistics on SMS older than 3 months through your manager.

Server address:

https://hostname/sendsmsjson.php

JSON document:

{
  "security":{
    "login":"login",
    "password":"password"
  },
  "type":"list_stats_last"
}

PHP data:

$param = array(
  'security' => array('login' => 'login', 'password' => 'password'),
  'type' => 'list_stats_last'
);

Where:

  • security - authorization data:
    • login - your login in the system;
    • password - your password in the system;
  • Instead of login and password, you can use the Token generated in the Personal Account. It is necessary to use the variable Authorization: Bearer <TOKEN>
  • type - request type (list_stats_last - detailed statistics);

The response may be one of the following JSON documents:

If an error occurs in the JSON document being sent:

JSON:

{
  "error":"error text"
}

PHP (array obtained via php function json_decode):

array ('error' => 'error text')

error - the error text can take the following values:

  1. Invalid JSON document format;
  2. Incorrect login or password;
  3. POST data missing;
If you receive a valid JSON document:

JSON:

{
  "stats":[
    {"id_sms":"100123","operator":"MTS","name_delivery":"SendName","phone":"79001234567","originator":"SENDER_1","time":"2016-03-09 20:37:02","status":"deliver","status_translate":"Delivered","text":"TextSMS","price":"1.5","num_parts":"2"},
    {"id_sms":"100124","operator":"MTS","name_delivery":"SendName","phone":"79001234568","originator":"SENDER_1","time":"2016-03-09 20:37:02","status":"deliver","status_translate":"Delivered","text":"TextSMS","price":"1.5","num_parts":"2"}
  ]
}

PHP (array obtained via php function json_decode):

Array (
  [[stats] => Array (
    [0] => Array( [id_sms] => 100123 [operator] => MTS [name_delivery] => Mailing name [phone] => 79001234567 [originator] => SENDER_1 [time] => 2016-03-09 20:37:02 [status] => deliver [status_translate] => Delivered [text] => SMS text [price] => 1.5 [num_parts] => 2 )
    [1] => Array( [id_sms] => 100124 [operator] => MTS [name_delivery] => Mailing name [phone] => 79001234568 [originator] => SENDER_1 [time] => 2016-03-09 20:37:02 [status] => deliver [status_translate] => Delivered [text] => TextSMS [price] => 1.5 [num_parts] => 2 )
  )
)

Where:

  • num_stats - total SMS;
  • stats - list of detailed statistics:
    • id_sms - SMS message number;
    • operator - operator;
    • phone - SMS recipient's phone number;
    • originator - sender's name;
    • time - time of sending SMS;
    • status - message status:
      • not_deliver - the message was not delivered. Final status (does not change over time);
      • expired - the abonent was offline at the time the delivery attempt was made. Final Status (does not change over time);
      • deliver - message delivered. Final status (does not change over time);
      • partly_deliver - the message was sent, but the status was never received. The final status (does not change over time). In this case, to clarify the reasons for the lack of status, you must contact the technical support service;
    • status_translate - message status, in Russian;
    • price - price for one part of SMS;
    • num_parts - number of SMS parts.

Request to get a list of SMS templates

Server address:

https://hostname/sendsmsjson.php

JSON document:

{
  "security":{
    "login":"login",
    "password":"password"
  },
  "type":"list_patterns"
}

PHP data:

$param = array(
  'security' => array('login' => 'login', 'password' => 'password'),
  'type' => 'list_patterns'
);

Where:

  • security - authorization data:
    • login - your login in the system;
    • password - your password in the system;
  • Instead of login and password, you can use the Token generated in the Personal Account. It is necessary to use the variable Authorization: Bearer <TOKEN>
  • type - request type (list_patterns - sms templates).

The response may be one of the following JSON documents:

If an error occurs in the JSON document being sent:

JSON:

{
  "error":"error text"
}

PHP (array obtained via php function json_decode):

array ('error' => 'error text')

error - the error text can take the following values:

  1. Invalid JSON document format;
  2. Incorrect login or password;
  3. POST data missing;
If you receive a valid JSON document:

JSON:

{
  "patterns":[
    {"id_pattern":"1234","name":"Template Title","pattern":"Template Text"},
    {"id_pattern":"1235","name":"TitleTemplate","pattern":"TextTemplate"}
  ]
}

PHP (array obtained via php function json_decode):

Array (
  [patterns] => Array (
    [0] => Array( [id_pattern] => 1234 [name] => Template Title [pattern] => Template Text )
    [1] => Array( [id_pattern] => 1235 [name] => Template Title [pattern] => Template Text )
  )
)

Where:

  • patterns - SMS templates:
    • id_pattern - template identifier in the system;
    • name - template title;
    • pattern - sample;

Request to change parameters/add/delete SMS templates

Server address:

https://hostname/sendsmsjson.php

JSON document:

{
  "security":{
    "login":"login",
    "password":"password"
  },
  "type":"patterns",
  "patterns":[
    {"id_pattern":"1234","name":"PatternTitle1","pattern":"TextTemplate1"},
    {"number_pattern":"1","name":"PatternTitle2","pattern":"TextTemplate2"}
  ],
  "delete_patterns":[
    {"id_pattern":"1235"}
  ]
}

PHP data:

$param = array(
  'security' => array('login' => 'login', 'password' => 'password'),
  'type' => 'patterns',
  patterns' => array(
    array('id_pattern' => '1234', 'name' => 'TitleTemplate1', 'pattern' => 'TextTemplate1'),
    array('number_pattern' => '1', 'name' => 'TitleTemplate2', 'pattern' => 'TextTemplate2')
  ),
  'delete_patterns' => array(
    array('id_pattern' => '1235')
  )
);

Where:

  • security - authorization data:
    • login - your login in the system;
    • password - your password in the system;
  • Instead of login and password, you can use the Token generated in the Personal Account. It is necessary to use the variable Authorization: Bearer <TOKEN>
  • type - request type (patterns - working with SMS templates);
  • patterns - Adding or changing SMS templates:
    • id_pattern - unique pattern number in the system. If not specified, the database will be added. In this case, you need to specify the number_pattern parameter;
    • number_pattern - template number in the JSON request. Used to match the IDs of added templates (if there were several in the request);
    • name - template title;
    • pattern - sample;
  • delete_patterns - deletion of the specified databases:
    • id_pattern - unique template number in the system.

The response may be one of the following JSON documents:

If an error occurs in the JSON document being sent:

JSON:

{
  "error":"error text"
}

PHP (array obtained via php function json_decode):

array ('error' => 'error text')

error - the error text can take the following values:

  1. Invalid JSON document format;
  2. Incorrect login or password;
  3. POST data missing;
If you receive a valid JSON document:

JSON:

{
  "patterns":[
    {"id_pattern":"1234","action":"edit"},
    {"id_pattern":"1237","action":"insert","number_pattern":"1"},
    {"id_pattern":"1236","action":"delete"}
  ]
}

PHP (array obtained via php function json_decode):

Array (
  [patterns] => Array (
    [0] => Array( [id_pattern] => 1234 [action] => edit )
    [1] => Array( [id_pattern] => 1236 [action] => insert [number_pattern] => 1 )
    [2] => Array( [id_pattern] => 1235 [action] => delete )
  )
)

Where:

  • id_pattern - unique SMS template number in the system;
  • action - action performed with the template:
    1. "edit" - change template parameters;
    2. "insert" - adding a template;
    3. not_edit - template could not be updated. Perhaps the data is identical to the template being updated;
    4. "delete" - the template has been deleted;
    5. "not_found" - the template with the specified identifier was not found;
  • number_pattern - template number in JSON request. Used to match IDs of added templates (if there were several in the request).

Request for obtaining the register of sender names

Server address:

https://hostname/sendsmsjson.php

JSON document:

{
  "security":{
    "login":"login",
    "password":"password"
  },
  "type":"list_registry_originator",
  "registry_originator":{"operator":"Operator","originator":"Sender name","inn":"INN"}
}

PHP data:

$param = array(
  'security' => array('login' => 'login', 'password' => 'password'),
  'type' => 'list_registry_originator',
  'registry_originator' => array('operator' => 'Operator', 'originator' => 'Sender name', 'inn' => 'INN')
);

Where:

  • security - authorization data:
    • login - your login in the system;
    • password - your password in the system;
  • Instead of login and password, you can use the Token generated in the Personal Account. It is necessary to use the variable Authorization: Bearer <TOKEN>
  • type - request type (list_registry_originator - list of the registry of names);
  • registry_originator - Filter for output of the register of sender names:
    • operator - Operator. The following operators are available: mts - MTS, mega - Megafon, tele2 - Tele2. Optional field.
    • originator - Sender's name. Optional field.
    • inn - Taxpayer identification number. Optional field.

The response may be one of the following JSON documents:

If an error occurs in the JSON document being sent:

JSON:

{
  "error":"error text"
}

PHP (array obtained via php function json_decode):

array ('error' => 'error text')

error - the error text can take the following values:

  1. Invalid JSON document format;
  2. Incorrect login or password;
  3. POST data missing;
If you receive a valid JSON document:

JSON:

{
  "registry_originator":[
    {
      "operator":{"name":"mts","title":"MTS"},
      "originator":[
        {"originator":"Sender 1","date_from":"2017-05-20","legal_entity":"IP Ivanov","inn":"INN","comment":"Comment","status":"approval","status_text":"Agreed"},
        {"originator":"Sender 2","date_from":"2017-05-20","legal_entity":"IP Ivanov","inn":"INN","comment":"Comment","status":"posted_for_approval","status_text":"Submitted for approval"}
      ]
    },
    {
      "operator":{"name":"mega","title":"Megafon"},
      "originator":[
        {"originator":"Sender 1","date_from":"2017-05-20","legal_entity":"IP Ivanov","inn":"INN","comment":"Comment","status":"approval","status_text":"Agreed"},
        {"originator":"Sender 2","date_from":"2017-05-20","legal_entity":"IP Ivanov","inn":"INN","comment":"Comment","status":"posted_for_approval","status_text":"Submitted for approval"}
      ]
    }
  ]
}

PHP (array obtained via php function json_decode):

Array (
  [registry_originator] => Array (
    [0] => Array (
      [operator] => Array ( [name] => mts [title] => MTS )
      [originator] => Array (
        [0] => Array ( [originator] => Sender 1 [date_from] => 2017-05-20 [legal_entity] => IP Ivanov [inn] => INN [comment] => Comment [status] => approval [status_text] => Agreed )
        [1] => Array ( [originator] => Sender 2 [date_from] => 2017-05-20 [legal_entity] => IP Ivanov [inn] => INN [comment] => Comment [status] => approval [posted_for_approval] => Submitted for approval )
      )
    )
    [1] => Array (
      [operator] => Array ( [name] => mega [title] => Megafon )
      [originator] => Array (
        [0] => Array ( [originator] => Sender 1 [date_from] => 2017-05-20 [legal_entity] => IP Ivanov [inn] => INN [comment] => Comment [status] => approval [status_text] => Agreed )
        [1] => Array ( [originator] => Sender 2 [date_from] => 2017-05-20 [legal_entity] => IP Ivanov [inn] => INN [comment] => Comment [status] => approval [posted_for_approval] => Submitted for approval )
      )
    )
  )
)

Where:

  • operator name - Operator. mts, mega, tele2.
  • operator title - Operator title. MTS, Megafon, Tele2.
  • originator - Sender's name.
  • date_from - Start date.
  • legal_entity - Legal entity.
  • inn - Taxpayer identification number.
  • comment - Comment.
  • status - Status:
    1. "posted_for_approval" - Submitted for approval;
    2. "send_for_approval" - Sent for approval;
    3. "approval" - Agreed;
    4. "not_approval" - Not approved;
    5. "send_for_delete" - Submitted for deletion;
    6. "delete" - Deleted;
  • status_text - Status, description.

Request to add/remove sender names from the sender name registry

Server address:

https://hostname/sendsmsjson.php

JSON document:

{
  "security":{
    "login":"login",
    "password":"password"
  },
  "type":"registry_originator",
  "registry_originator":[
    {"originator":"Sender 1","legal_entity":"IP Ivanov","operator":"mts","inn":"INN","comment":"Comment"},
    {"originator":"Sender 1","legal_entity":"IP Ivanov","operator":"tele2","inn":"INN","comment":"Comment"},
    {"originator":"Sender 2","legal_entity":"IP Ivanov","operator":"mts","inn":"INN"}
  ],
  "delete_registry_originator":[
    {"originator":"Sender 3"},
    {"originator":"Sender 4","operator":"mega"}
  ]
}

PHP data:

$param = array(
  'security' => array('login' => 'login', 'password' => 'password'),
  'type' => 'registry_originator',
  'registry_originator' => array(
    array('originator' => 'Sender 1', 'legal_entity' => 'IP Ivanov', 'operator' => 'mts', 'inn' => 'INN', 'comment' => 'Comment'),
    array('originator' => 'Sender 1', 'legal_entity' => 'IP Ivanov', 'operator' => 'tele2', 'inn' => 'INN', 'comment' => 'Comment'),
    array('originator' => 'Sender 2', 'legal_entity' => 'IP Ivanov', 'operator' => 'mts', 'inn' => 'INN')
  ),
  'delete_registry_originator' => array(
    array('originator' => 'Sender 3'),
    array('originator' => 'Sender 3', 'operator' => 'mega')
  )
);

Where:

  • login - your login in the system.
  • password - your password in the system.
  • Instead of login and password, you can use the Token generated in the Personal Account. It is necessary to use the variable Authorizбоation in the request header: Bearer <TOKEN>
  • registry_originator - Adding the sender's name:
    • originator - Sender's name.
    • operator - Operator. The following operators are available: mts - MTS, mega - Megafon, tele2 - Tele2.
    • legal_entity - Legal entity.
    • inn - Taxpayer identification number.
    • comment - Comment. Optional field.
  • delete_registry_originator - Removing the sender's name:
    • originator - Sender's name.
    • operator - Operator. The following operators are available: mts - MTS, mega - Megafon, tele2 - Tele2. Optional field. If absent, the sender's name will be deleted for all operators.

The response may be one of the following JSON documents:

If an error occurs in the JSON document being sent:

JSON:

{
  "error":"error text"
}

PHP (array obtained via php function json_decode):

array ('error' => 'error text')

error - the error text can take the following values:

  1. Invalid JSON document format;
  2. Incorrect login or password;
  3. POST data missing;
If you receive a valid JSON document:

JSON:

{
  "registry_originator":[
    {"originator":"Sender 1","operator":"mts","inn":"INN","status":"add","error":""},
    {"originator":"Sender 1","operator":"tele2","inn":"INN","status":"error","error":"Error description"},
    {"originator":"Sender 2","operator":"mts","inn":"INN","status":"add","error":""},
  ],
  "delete_registry_originator":[
    {"originator":"Sender 3","operator":"","status":"delete","error":""},
    {"originator":"Sender 4","operator":"mega","status":"not_found","error":"Sender name not found"}
  ]
}

PHP (array obtained via php function json_decode):

Array (
  [registry_originator] => Array (
    [0] => Array ( [originator] => Sender 1 [operator] => mts [inn] => INN [status] => add [error] => )
    [1] => Array ( [originator] => Sender 1 [operator] => tele2 [inn] => INN [status] => error [error] => Error description )
    [2] => Array ( [originator] => Sender 2 [operator] => mts [inn] => INN [status] => add [error] => )
  )
  [delete_registry_originator] => Array (
    [0] => Array ( [originator] => Sender 3 [operator] => [status] => add [error] => )
    [1] => Array ( [originator] => Sender 4 [operator] => mega [status] => not_found [error] => Sender name not found )
  )
)

Where:

  • registry_originator - Added sender names:
    • originator - Sender's name.
    • operator - Operator. mts, mega, tele2.
    • inn - Taxpayer identification number.
    • status - Status. add - sender name added, error - error.
    • error - Description of the error.
  • delete_registry_originator - Removed sender names:
    • originator - Sender's name.
    • operator - Operator. mts, mega, tele2. If absent, the sender's name is removed for all operators.
    • status - Status. not_found - submitted for deletion, error - error.
    • error - Description of the error.