Pricing plans  Services  API  Partners  About the service  Contacts 
8 (800) 700 7672
Free in Russia
 

Integration with the service (API)

The API allows you to send messages through your projects and services over the HTTP/HTTPS, SMTP, and SMPP protocols. Ready-made libraries in different programming languages connect to your project and help you send messages from anywhere with a single command.


HTTP/HTTPS SMTP SMPP SOAP OMS SMS Commands Libraries and code examples

SENDING MESSAGES

MANAGING MAILING LISTS

MESSAGE STATUSES

CHECKING THE BALANCE STATUS

CONTACT MANAGEMENT

CLIENT MANAGEMENT

MANAGING SENDER NAMES (SENDER ID)

GETTING DATA

VARIOUS

Various

Connecting dedicated numbers for receiving messages

You can use special API commands to get a list of available dedicated numbers for receiving SMS messages and connect any number to your username, paying the cost for the remaining days in the current month. When you connect a dedicated number, you automatically agree to the terms of use of such numbers.

To get a list of available allocated numbers, call the following address using the GET or POST method: https://smscentre.com/sys/receive_phones.php?get=1&login=<login>&psw=<password>
To connect a dedicated number, you need to call the address using the GET or POST method: https://smscentre.com/sys/receive_phones.php?buy=1&login=<login>&psw=<password>&phone=<phone>
To change the attribute of the extension of the allocated number for the next month, you must call the address by the GET or POST method: https://smscentre.com/sys/receive_phones.php?chg=1&login=<login>&psw=<password>&phone=<phone>&noprolong=<noprolong>
Description of the parameters passed to the Server:

OptionThe value
loginCustomer Login.
pswClient Password (you can add or change it on this page).
phonePlug-in number.
noprolongIndicates whether the allocated number is extended for the next month. This parameter can also be specified when connecting the number in the buy command.
0 (default) - enable automatic number renewal.
1 – disable automatic number renewal.

If an error occurs, the Server returns the following string:
  • ERROR = N (description)

  • When fmt = 1:
    0,-N

  • When fmt = 2:
    <result>
    <error>description</error>
    <error_code>N</error_code>
    </result>

  • When fmt = 3:
    {
    "error": "description",
    "error_code": N
    }
N – error number, can take the following values:

The valueDescription
1Error in parameters.
2Invalid username or password. Also occurs when trying to send a message from an IP address that is not included in the list of allowed by the Client (if such a list was previously configured by the Client).
3Insufficient funds in the account to rent a room.
4The IP address is temporarily blocked.
9Attempt to send more than two identical requests to get a list of available rooms for rent, or to connect a number, or to change the properties of a dedicated number within a minute.
This error also occurs when you try to send fifteen or more requests simultaneously from different connections under the same username (too many concurrent requests).

If the request is successful, the Server returns a response in the form of a string.

To get a list of available numbers:
  • when fmt = 0:
    phone = <phone>, type = <type>, cost = <cost>, current_cost = <current_cost>, info = <info>
    ...

  • when fmt = 1:
    <phone>,<type>,<cost>,<current_cost>,<info>
    ...

  • when fmt = 2:
    <list>
    <receive_phone>
    <phone>phone</phone>
    <type>type</type>
    <cost>cost</cost>
    <current_cost>current_cost</current_cost>
    <info>info</info>
    </receive_phone>
    ...
    </list>

  • when fmt = 3:
    [{
    "phone": "<phone>",
    "type": <type>,
    "cost": "<cost>",
    "current_cost": "<current_cost>"
    "info": "<info>"
    },
    ...]

Where:
<phone> – phone number.
<type> – number type: 1,4-dedicated virtual number, 2-number on the SIM hosting service.
<cost> – the cost of renting a room for a full month.
<current_cost> – the cost of renting a room for the remaining days until the end of the current month.
<info> – operator name and supported notification types.

To rent a room:
  • when fmt = 0: cost = <cost>

  • when fmt = 1: <cost>

  • when fmt = 2:
    <phone>
    <cost>cost</cost>
    </phone>

  • when fmt = 3:
    {
    "cost": "<cost>"
    }

Where:
<cost> – the amount debited from the Client's account for the rental of the room.

To change the extension attribute of the number:
  • when fmt = 0,1: OK

  • when fmt = 2:
    <result>OK</result>

  • when fmt = 3:
    {
    "result": "OK"
    }



Examples:

Getting a list of available rooms for rent:

https://smscentre.com/sys/receive_phones.php?get=1&login=alex&psw=123
Connecting the number " 79999999999":

https://smscentre.com/sys/receive_phones.php?buy=1&login=alex&psw=123&phone=79999999999
Disabling the ability to extend the allocated number "79999999999" for the next month:

https://smscentre.com/sys/receive_phones.php?chg=1&login=alex&psw=123&phone=79999999999&noprolong=1

The server does not accept more than two identical requests within a minute to get a list of available numbers for rent or to connect a number, or to change the properties of the allocated number to reduce the load and protect against errors and loops in the Client-side program.

Transmitting statuses and messages to the Client handler

In the Client's personal account in "User settings" it is possible to specify the http (s) address (URL) of the script for processing the delivery statuses of messages, incoming SMS messages, as well as service messages (when using the service "Confirm the number with a call") on the Client side. The specified script will be called by the Server after each receipt of the delivery status of a message previously sent by the Client, after receiving an incoming SMS message from the subscriber or a call from the subscriber (when using the "Number Confirmation by Call" service").

In the address of the handler, you can specify the charset parameter to select the encoding of the transmitted parameters: ?charset=utf-8
?charset=koi8-r
?charset=windows-1251
The default encoding is windows-1251.

Also, in the address of the status handler and incoming messages, you can pass the fmt parameter to specify the format of the returned parameters. Possible values: fmt=2 (for xml format) and fmt=3 (for json format). When transmitting the fmt parameter, the koi8-r encoding is not used.

To protect the transmitted data from spoofing , you can additionally specify any of the md5, sha1, or crc32 parameters in the handler address that define the algorithm for calculating the control parameter with the string hash:
"id:phone:status:<секретная строка>" − for the delivery status
"phone:mes:to:<секретная строка>" − for an incoming message
"phone:ts:<секретная строка>" − to confirm the number with a call
in the form of:
?md5=<секретная строка>
?sha1=<секретная строка>
?crc32=<секретная строка>
You can use Latin letters, numbers, minus signs, and underscores as secret string characters. The corresponding parameter will be passed to the handler, in which the secret string will be replaced with the hash value of the transmitted data.

All parameters are passed by the POST method.

Transmitted parameters for the SMS message status:

OptionThe value
idMessage ID.
phonePhone number.
statusMessage status.
timeTime of status change (or delivery of an SMS message to the subscriber).
Format: DD.MM.YY hh: mm: ss (by the time zone specified in the settings).
tsTime to change the status in the form of a stamp in seconds.
errError code if the message cannot be delivered (list). Passed if not equal to zero.
syserrAdditional error from the operator, not always present.
cntThe number of parts (when sending an SMS message) or the number of seconds (when sending a voice message (call)).
typeMessage type (0-SMS, 1-Flash-SMS, 2-Binary SMS, 3-Wap-push, 4 – HLR-request, 5-Ping-SMS, 6-MMS, 7- Call, 10-Viber, 12-Social Networks).
costMessage cost.
flagA flag in the form of a 2-byte number containing various information about the message. Combinations of bit values of different characteristics are possible.

0-3 bits (message type):
0 (by default) – SMS.
1 – Flash-SMS.
2 – Binary SMS.
3 – Wap-push.
4 – HLR-query.
5 – Ping-SMS.
6 – MMS.
7 – Call.
8 – E-mail.
10 – Viber.
12 – Social network.

Bit 5 – payment of the message from the second balance.
Bit 8 - indicates a template message.
senderThe sender's name displayed on the recipient's phone.
dtmfThe sequence of characters typed by the subscriber on the numeric keypad while listening to a voice message (phone call).
md5MD5-хеш строки "id:phone:status:<секретная строка>". Passed if it was specified as an additional parameter in the http (s) address of the handler.
sha1sha1-хеш строки "id:phone:status:<секретная строка>". Passed if it was specified as an additional parameter in the http (s) address of the handler.
crc32Контрольная сумма crc32 строки "id:phone:status:<секретная строка>". Passed if it was specified as an additional parameter in the http (s) address of the handler.
Additional parameters for HLR requests
imsiUnique IMSI code of the subscriber's SIM card.
mscThe number of the service center of the operator in whose network the subscriber is located.
mccNumeric code of the subscriber's country.
mncNumeric code of the subscriber's operator.
cnName of the country of registration of the subscriber.
netName of the subscriber registration operator.
rcnThe name of the roaming country of the subscriber when he is in a foreign network.
rnetThe name of the roaming operator of the subscriber when he is in someone else's network.

Transmitted parameters for an incoming SMS message:

OptionThe value
idUnique ID of the incoming message, assigned by the Server automatically.
sms_idID of the message to which the response was received. This parameter is omitted if the message from the subscriber was sent to a dedicated incoming number or if the subscriber specifies the prefix " login, colon and space".
phoneSubscriber's phone number.
mesText of the SMS message.
toThe incoming phone number to which the message was sent by the subscriber.
smscSMS center of the operator from which the incoming message was received.
sentSending a message to the subscriber in the form of a stamp in seconds.
timeThe time when the message was received by the Server in the form of a stamp in seconds.
md5MD5-хеш строки "phone:mes:to:<секретная строка>". Passed if it was specified as an additional parameter in the http (s) address of the handler.
sha1sha1-хеш строки "phone:mes:to:<секретная строка>". Passed if it was specified as an additional parameter in the http (s) address of the handler.
crc32Контрольная сумма crc32 строки "phone:mes:to:<секретная строка>". Passed if it was specified as an additional parameter in the http (s) address of the handler.

Transmitted parameters when using the service " Number confirmation with a call":

OptionThe value
waitcall1 – service message flag for the service " Number confirmation with a call".
phoneThe phone number of the subscriber from whom the call was received.
tsCall time.
md5MD5-хеш строки "phone:ts:<секретная строка>". Passed if it was specified as an additional parameter in the http (s) address of the handler.
sha1sha1-хеш строки "phone:ts:<секретная строка>". Passed if it was specified as an additional parameter in the http (s) address of the handler.
crc32Контрольная сумма crc32 строки "phone:ts:<секретная строка>". Passed if it was specified as an additional parameter in the http (s) address of the handler.

Additional parameters transmitted when using the voice menu function in calls:

OptionThe value
calltime The time of the call, after which the key was pressed on the numeric keypad of the subscriber's phone, or the total time of the call.
callmenuThe sequence of keys on the phone's numeric keypad that the caller pressed while navigating through the voice menu.
ringtimeWaiting time for the subscriber to pick up the phone.

In addition to the standard parameters described above, the Server will also send all the parameters specified in the http(s) address of the handler after the"? " sign using the POST method".

To distinguish between the status of a message, an incoming SMS message, or a service message (when using the "Confirm number by calling" service), you can check for the presence of the mes parameter (for an incoming message) and waitcall in the same handler (for the number confirmation service): if (isset($_POST["mes"])) {
   
// message
}
elseif (isset(
$_POST["waitcall"])) {
   
// confirmation
}
else {
   
// status
}

Statuses are forwarded to the Client handler only when sending messages over the HTTP/HTTPS, SMTP, or SMPP protocols. When sending messages from the personal account, the transfer of statuses to the Client's handler does not occur.

If the Client handler returns a response with an error code other than 200 or 404, the Server will repeat the request to the handler with a certain frequency (1 request every 4 minutes, total 50 attempts).

Подключение антиспам проверки (captcha) к сайту

Sometimes there is a need to send messages from your site at the request of users, and in such cases, to exclude automated spam mailings with the help of robots, you can easily implement anti-spam verification using our service.

To do this, it is enough to place a special code for displaying the image (captcha) and fields for entering the code on the form for sending messages:

Код с картинки <img src="https://smscentre.com/sys/imgcode.php?1.1" onclick="src+=1" width="50" height="18" border="1">
<
input type="text" size="9" name="code">
and pass it with other form data to the corresponding message sending script as the value of the imgcode parameter.

Also, with this parameter, you must pass the value of the IP address of the user to whom the image was displayed as the value of the userip parameter.

Examples:

Example of a script for sending messages using the code from the image (captcha) received from the form:

include_once "smsc_api.php";

if (
$_POST["sendsms"]) {
   
$r = send_sms($_POST["phone"], "Ваш код для регистрации на сайте mysite.com 123321.", 0, 0, 0, 0, false, "imgcode=".$_POST["code"]."&userip=".$_SERVER["REMOTE_ADDR"]);

if (
$r[1] > 0)
    echo
"<script>alert('Сообщение отправлено на номер ".$_POST["phone"]."')</script>";
elseif (
$r[1] == -10)
    echo
"<script>alert('Вы ввели неверный код с картинки!')</script>";
}

Confirm your phone number with a call

For various types of operations, such as password recovery, authorization in public Wi-Fi networks, confirmation of money transfers, logging in to your personal account, and so on, you need to send authentication data. Using our API, you can organize the procedure for confirming the phone number by calling the subscriber himself.

To create a request to receive a phone number, at which the subscriber will have to make a confirmation call, you need to call the address using the GET or POST method: https://smscentre.com/sys/wait_call.php?login=<login>&psw=<password>&phone=<phone>
The following parameters are passed to the server:

OptionThe value
loginCustomer Login.
pswClient Password (you can add or change it on this page).
phoneThe phone number of the subscriber from which the confirmation call will be made.

If an error occurs, the Server returns the following string:
  • ERROR = N (description)

  • When fmt = 1:
    0,-N

  • When fmt = 2:
    <result>
    <error>description</error>
    <error_code>N</error_code>
    </result>

  • When fmt = 3:
    {
    "error": "description",
    "error_code": N
    }
N – error number, can take the following values:

The valueDescription
1Error in parameters.
2Invalid username or password. Also occurs when trying to send a message from an IP address that is not included in the list of allowed by the Client (if such a list was previously configured by the Client).
3Insufficient funds on the Client's account.
4The IP address is temporarily blocked.
5The specified phone number of the subscriber is in the black list of the Client.
9Attempt to send more than fifty identical requests to get a phone number for confirmation within a minute.
This error also occurs when you try to send fifteen or more requests simultaneously from different connections under the same username (too many concurrent requests).

If the request is successful, the Server returns a response in the form of a string.

  • when fmt = 0: phone = <phone>, all_phones = <all_phones>

  • when fmt = 1 (the first is the number to which the subscriber needs to call): <all_phones>

  • when fmt = 2:
    <result>
    <phone>phone</phone>
    <all_phones>
    <phone>phone</phone>
    ...
    <phone>phone</phone>
    </all_phones>
    </result>

  • when fmt = 3:
    {
    "phone": "<phone>",
    "all_phones": [
    <phone>",
    ...
    "<phone>"
    ]
    }

Where:
<phone> – the phone number to which the subscriber must make a call within 15 minutes to confirm their phone number.
<all_phones> – a list of all possible phone numbers, one of which was assigned by the system to call the subscriber (depending on the country).

After the subscriber's call, the Server records the fact of the call in the form of an incoming message with the text "[waitcall] " and sends all the necessary information about this call to the Client's handler.

The server does not accept more than fifty identical requests to get a phone number for confirmation within a minute to reduce the load and protect against errors and loops in the Client-side program.




© 2003–2023 SMS Center LLC
License no. 166255
support@smscentre.com
Contacts
Design — Artemy Lebedev Studio
Site Information
SMS Center for Android Yandex. Metrica