API - it's a protocol between your software and our server.
API needed for automatization process sms receiving on your side
Our API is fully compatible with competitor sites
All requests should go to https://sms-activate.ru/stubs/handler_api.php
POST or GET request.
All requests must have an API key as a parameter "api_key"
Download implementation of the protocol in phphttps://sms-activate.ru/stubs/handler_api.php?api_key=$api_key&action=getNumbersStatus&country=$country&operator=$operator
$api_key - API key
$country * - country numbers see table
* optional field. If not specified, then by default the quantity will be displayed in accordance with the setting in the left menu.
$operator * - mobile operator numbers, you can specify several numbers separated by commas (available only for **):
Russia | megafon, mts, beeline, tele2, rostelecom, any |
---|---|
Ukraine | kyivstar, life, utel, mts, vodafone |
Kazakhstan | tele2, beeline, aktiv, altel |
* optional field. If not specified, then by default the quantity will be displayed in accordance with the setting in the left menu.
** available for $country = 0, $country = 1, $country = 2
The response of the service will be in json format, example:
{"vk_0":228,"ok_0":219,"wa_0":255,"vi_0":9,"tg_0":86,"wb_0":201,"go_0":70,"av_0":208,"av_1":1,"fb_0":201}
Where to the dash is the name of the service, after the designation whether it is necessary to include redirection. 0 - no. 1 - yes.
Full list of serviceshttps://sms-activate.ru/stubs/handler_api.php?api_key=$api_key&action=getBalance
https://sms-activate.ru/stubs/handler_api.php?api_key=$api_key&action=getBalanceAndCashBack
* returns the balance, taking into account the accumulated cashback, if the checkbox is checked in the cashback account settings "Spend activation cashback"
$api_key - API key
ACCESS_BALANCE:'account balance'
BAD_KEY - Invalid API key
ERROR_SQL - SQL-server error
https://sms-activate.ru/stubs/handler_api.php?api_key=$api_key&action=getNumber&service=$service&forward=$forward&operator=$operator&ref=$ref&country=$country&phoneException=$phoneException
$api_key - API key
$service - ordering service see table
$forward * - Do I need to request a redirected number
$phoneException * - excluding prefixes for Russian numbers. Specify with commas. Recording format: country code and 3 to 6 digits of the mask (for example 7918,7900111). The default is the value set in the left menu.
* optional parameter accepts 0(not perform , set by default), 1(perform)
$operator * - mobile operator numbers, you can specify several numbers separated by commas (available only for **):
Russia | megafon, mts, beeline,tele2,any |
---|---|
Ukraine | kyivstar,life,utel,mts,vodafone |
Kazakhstan | tele2,beeline,aktiv,altel |
* optional field. If not specified, then by default the quantity will be displayed in accordance with the setting in the left menu.
** available for$country = 0, $country = 1, $country = 2
$ref - pass referral identifier. Read more
$country - country numbers see table
By getting the number through the API, you agree with the project rules project rules
NO_NUMBERS - no numbers
NO_BALANCE - balance ended
ACCESS_NUMBER:$id:$number , where ($id - id operations,$number - phone number)
BAD_ACTION - incorrect action
BAD_SERVICE - incorrect service name
BAD_KEY - Invalid API key
ERROR_SQL - SQL-server error
BANNED:'YYYY-m-d H-i-s' - time for which the account is blocked
WRONG_EXCEPTION_PHONE - invalid exclusion prefixes
NO_BALANCE_FORWARD - insufficient funds to buy call forwarding
https://sms-activate.ru/stubs/handler_api.php?api_key=$api_key&action=getMultiServiceNumber&multiService=$service&multiForward=$forward&operator=$operator&ref=$ref&country=$country
$api_key - API key
$service - services for ordering. Specify separated by commas, for example "vk, ok, vi, av" see table
$forward * - Do I need to request a redirected number
* optional parameter, forwarding characters are specified separated by commas, the number of forwarding digits must match the number of services transmitted in the parameter $service It is allowed to transmit only 1 service with redirection, for example "0,1,0,0" - correct, "0,1,1,0" - incorrect. Accepts 0(not perform , set by default), 1(perform)
$operator * - mobile operator numbers, you can specify several numbers separated by commas (available only for **):
Russia | megafon, mts, beeline,tele2,any |
---|---|
Ukraine | kyivstar,life,utel,mts,vodafone |
Kazakhstan | tele2,beeline,aktiv,altel |
* optional field. If not specified, then by default the quantity will be displayed in accordance with the setting in the left menu.
$ref - pass referral identifier. Read more
$country - country numbers see table
By getting the number through the API, you agree with the project rules project rules
NO_NUMBERS - no numbers
NO_BALANCE - balance ended
{{'phone':phone,'activation':activation,'service':service},{'phone':phone,'activation':activation,'service':service}}
, where (phone - id operations,activation - phone number,service - service)
BAD_ACTION - incorrect action
BAD_SERVICE - incorrect service name
BAD_KEY - Invalid API key
BAD_FORWARD - redirection specified incorrectly
NOT_AVAILABLE - multiservice purchase is not available for the country you are using
ERROR_SQL - SQL-server error
BANNED:'YYYY-m-d H-i-s' - time for which the account is blocked
https://sms-activate.ru/stubs/handler_api.php?api_key=$api_key&action=setStatus&status=$status&id=$id&forward=$forward
$api_key - API key
$id - activationID
$forward * - phone number to be redirected to
* Mandatory only if the parameter forward = 1 was passed with getNumber.
$status - activation status
1 | report the readiness of the number (SMS to the number sent) |
---|---|
3 | request another code (free) |
6 | complete activation* |
8 | report the number used and cancel the activation |
* complete activation (if the status was "code received" - marks successfully and finishes, if there was "preparation" - deletes and marks the error, if it was status "waiting for repetition" - translates activation into waiting for sms)
Simple logic of api chronology:
Get the number using the getNumber method
after this, the following actions are available:
8 - Cancel the activation (if the number does not match you)
1 - Notify that SMS has been sent (optional)
To activation with status 1:
8 - Cancel activation
Immediately after receiving the code:
3 - Request another SMS
6 - Confirm SMS code and complete activation
To activation with status 3:
6 - Confirm SMS code and complete activation
ACCESS_READY - number readiness confirmed
ACCESS_RETRY_GET - waiting for a new sms
ACCESS_ACTIVATION - service successfully activated
ACCESS_CANCEL - activation canceled
ERROR_SQL - SQL-server error
NO_ACTIVATION - activation id does not exist
BAD_SERVICE - incorrect service name
BAD_STATUS - incorrect status
BAD_KEY - Invalid API key
BAD_ACTION - incorrect action
https://sms-activate.ru/stubs/handler_api.php?api_key=$api_key&action=getStatus&id=$id
$api_key - API key
$id - activationID
STATUS_WAIT_CODE - waiting for sms
STATUS_WAIT_RETRY:'past, inappropriate code' - waiting for code clarification
STATUS_WAIT_RESEND - waiting for re-sending SMS *
* software should click send SMS again and change status to 6
STATUS_CANCEL - activation canceled
STATUS_OK:'activation code' - code received
NO_ACTIVATION - activation id does not exist
ERROR_SQL - SQL-server error
BAD_KEY - Invalid API key
BAD_ACTION - incorrect action
https://sms-activate.ru/stubs/handler_api.php?api_key=$api_key&action=getFullSms&id=$id
$api_key - API key
$id - activationID
STATUS_WAIT_CODE - waiting for sms
STATUS_CANCEL - activation canceled
FULL_SMS:full text received
NO_ACTIVATION - activation id does not exist
ERROR_SQL - SQL-server error
BAD_KEY - Invalid API key
BAD_ACTION - incorrect action
https://sms-activate.ru/stubs/handler_api.php?api_key=$api_key&action=getPrices&service=$service&country=$country
$api_key - API key
$service - short name of the service (optional, by default all services) see table
$country - Country code name (Optional, defaults to all countries) see table
JSON - object in the format:
{"A country":{"Service":{"cost":Cost,"count":Quant}},"retry":Repeated SMS reception}
https://sms-activate.ru/stubs/handler_api.php?api_key=$api_key&action=getCountries
$api_key - API key
JSON - object в формате
{{'Страна':{'id':0,'rus':"Россия","eng:"Russia","chn":"俄罗斯","visible":1,"retry":1,"rent":1,"multiService":1}}
, You can integrate this method with your payment API for qiwi wallet and top up your account on the site fully automatically
https://sms-activate.ru/stubs/handler_api.php?api_key=$api_key&action=getQiwiRequisites
$api_key - API key
JSON - object в формате
{"status":"статус","wallet":"PAYMENT WALLET NUMBER","upToDate":"DATE UNTIL WHICH DETAILS ARE RELEVANT","comment":"COMMENT SPECIFIED ON PAYMENT"}
ATTENTION! Details sometimes change and are valid only until the date in upToDate, to update the details, request again.
The status can be:
success | payment can be made |
---|---|
false | qiwi payments not possible |
Having received the first SMS for redirected numbers, you can buy other related services such as Yula, Yandex, Avito, Any other
The cost of additional service is only 5p
https://sms-activate.ru/stubs/handler_api.php?api_key=$api_key&action=getAdditionalService&service=$service&id=$id
$api_key - API key
$service - short name of the service see table
$id - Parent Activation ID
ADDITIONAL:$id:$phone - Successfully created a new activation. Where ID - ID of additional activation, phone - phone number
WRONG_ADDITIONAL_SERVICE - Invalid additional service (only services for redirection are allowed)
WRONG_ACTIVATION_ID - Invalid Parent Activation ID
WRONG_SECURITY - An error occurred while trying to transfer an activation ID without forwarding, or a completed / inactive activation
REPEAT_ADDITIONAL_SERVICE - An error occurs when trying to order a purchased service again
NO_BALANCE - Not enough money
ERROR_SQL - Database error, contact support
https://sms-activate.ru/stubs/handler_api.php?api_key=$api_key&action=getRentServicesAndCountries&rent_time=$time&operator=$operator&country=$country
$api_key - API key
$time * - rental time
* optional parameter. If not specified, then the default will be 1 hour.
$operator * - mobile operator numbers, you can specify several numbers separated by commas
$country * - country (Default: Russia)
* optional parameter. If not specified, then by default will be any.
The response of the service will be in json format, example:
{ "countries": { "0": 0 }, "operators": { "0": "aiva", "1": "any", "2": "beeline", ... "16": "yota" },
"services": { "full": { "cost": 42.93, "quant": 20 }, "vk": { "cost": 21.95, "quant": 20 }, "ok": {
"cost": 7.68, "quant": 55 }, "ot": { "cost": 5.2, "quant": 42 } } }
BAD_KEY - Invalid API key
https://sms-activate.ru/stubs/handler_api.php?api_key=$api_key&action=getRentNumber&service=$service&rent_time=$time&operator=$operator&country=$country&url=$url
$api_key - API key
$service - service for which you need to get a number
$time * - время аренды (По умолчанию: 4 часа)
$operator * - mobile operator numbers, you can specify several numbers separated by commas (Default: Any)
$country * - country (Default: Russia)
$url * - link for webhook (Not considered by default)What is webHook?
* optional parameter. If not specified, the default option will be used.
The response of the service will be in json format, example:
{ "status": "success", "phone": { "id": 1049, "endDate": "2020-01-31T12:01:52", "number": "79959707564"
} }
BAD_KEY - Invalid API key
Answer in json format:
{ "status": "error", "message": "*possible_answer*" }
BAD_SERVICE - service not specified or name is incorrect
NO_BALANCE - no money in the account
NO_NUMBERS - No numbers
ACCOUNT_INACTIVE - No numbers
SQL_ERROR - SQL-server error
https://sms-activate.ru/stubs/handler_api.php?api_key=$api_key&action=getRentStatus&id=$id
$api_key - API key
$id - rental id received in the response when ordering a phone
The response of the service will be in json format* :
{ "status": "success", "quantity": "2", "values": { "0": { "phoneFrom": "79180230628", "text": "5", "service": "ot", "date": "2020-01-30 14:31:58" }, "1": { "phoneFrom": "79180230628", "text": "4", "service": "ot", "date": "2020-01-30 14:04:16" } } }
* successful only if there is an SMS (field 'quantity'> 0).
BAD_KEY - Invalid API key
Answer in json format:
{ "status": "error", "message": "*possible_answer*" }
NO_ID_RENT - Rent id not specified
INVALID_PHONE - number is not rented by you (wrong rental id)
STATUS_FINISH - rent paid and completed
STATUS_CANCEL - rent canceled with refund
STATUS_WAIT_CODE - waiting for the first sms
https://sms-activate.ru/stubs/handler_api.php?api_key=$api_key&action=setRentStatus&id=$id&status=$status
$api_key - API key
$id - rental id received in the response when ordering a phone
$status - code for changing status (number)
The status can be:
1 | Finish |
---|---|
2 | Cancel |
The response of the service will be in json format:
{ "status": "success" }
BAD_KEY - Invalid API key
Ответ в json формате:
{ "status": "error", "message": "*possible_answer*" }
NO_ID_RENT - Rent id not specified
INCORECT_STATUS - missing or incorrect status
CANT_CANCEL - it is impossible to cancel the rental (more than 20 minutes)
INVALID_PHONE - number is not rented by you (wrong rental id)
ALREADY_FINISH - rental is already completed
ALREADY_CANCEL - rent already canceled
SQL_ERROR - SQL-server error
http://sms-activate.ru/stubs/handler_api.php?api_key=$api_key&action=getRentList
$api_key - API key
The response of the service will be in json format:
{
"status": "success",
"values": {
"0": {
"id": "123456",
"phone": "79181234567"
},
"1": {
"id": "123457",
"phone": "79181234568"
}
}
}
BAD_KEY - Invalid API key
BAD_ACTION - incorrect action
Ответ в json формате:
{ "status": "error", "message": "*possible_answer*" }
NO_NUMBERS - no rented numbers
SQL_ERROR - SQL-server error
http://sms-activate.ru/stubs/handler_api.php?api_key=$api_key&action=continueRentNumber&id=$id&rent_time=$time
* продление аренды доступно только для оператора MTT. Срок жизни номера - 3 месяца со дня первой покупки.
$api_key - API key
$id - id Аренды
$time * - время аренды (По умолчанию: 4 часа)
* optional parameter. If not specified, the default option will be used.
The response of the service will be in json format:
{ "status": "success", "phone": { "id": 1049, "endDate": "2020-01-31T12:01:52", "number": "79959707564"
} }
BAD_KEY - Invalid API key
BAD_ACTION - incorrect action
Ответ в json формате:
{ "status": "error", "message": "*possible_answer*" }
NO_ID_RENT - отсутствует id аренды
NO_BALANCE - недостаточно средств
RENT_DIE - аренду невозможно продлить, так как срок жизни номера истёк
INVALID_PHONE - неверный id аренды
WRONG_OPERATOR - оператор переданной аренды не MTT
INVALID_TIME - неверное время. Доступное количество часов от 4 до 2016
SQL_ERROR - SQL-server error
http://sms-activate.ru/stubs/handler_api.php?api_key=$api_key&action=getContinueRentPriceNumber&id=$id
* данный метод доступен только для аренды с оператором MTT.
$api_key - API key
$id - id Аренды
The response of the service will be in json format:
{ "status": "success", "price": 6.33 }
BAD_KEY - Invalid API key
BAD_ACTION - incorrect action
Ответ в json формате:
{ "status": "error", "message": "*possible_answer*" }
NO_ID_RENT - отсутствует id аренды
RENT_DIE - аренду невозможно продлить, так как срок жизни номера истёк
INVALID_PHONE - неверный id аренды
WRONG_OPERATOR - оператор переданной аренды не MTT
SQL_ERROR - SQL-server error
<?php
include_once ("smsactivateApi.php");//Inclusion of a class in a project
$sms = new SMSActivate($API_KEY);//Create class instance SMSActivate
$freeSlots = $sms->getNumbersStatus(0, 'tele2');//Get the number of available numbers for the country of Russia and the tele2 operator
echo "Номеров Вконтакте: " . $freeSlots['vk']."\n";//Show for Vk
echo "Номеров Whatsapp: " . $freeSlots['wa']."\n";//Show for whatsapp
var_dump($freeSlots); //Show all services with quantity
$balance = $sms->getBalance();//Get balance
echo "On the account " . $balance." rub.." ."\n";//Show balance
$balance = $sms->getBalanceAndCashBack();//Request a balance with cashback account
echo "On the account " . $balance." rub.." ."\n";//Request a balance with cashback account
$number = $sms->getNumber('ok',0, 0, 'tele2');//Get Odnoklassniki number without forwarding
echo "Activation № " . $number['id']. "phone ". $number['number'] \n";//Show id and activation number
try{
$newNumber = $sms->getNumber('vk',0, 1);
echo $newNumber['number'] ."\n";
} catch (Exception $e) {
echo $e->getResponseCode() ."\n"; }//Catch an error code (e.g. NO_BALANCE)
$number = $sms->getMultiServiceNumber('ok,vk,vi,av','0,0,0,1', 0, 'tele2');//Get a number for services Odnoklassniki, Vkontakte, Viber without call forwarding and Avito with call forwarding
foreach ($number as $value) {
echo "Activation № " . $value['activation']. "for service ". $value['service'] ."\n";
}
echo "Number " . $value['phone'] ."\n";//Show activation id and number
$status = $sms->setStatus($number['id'], 3);//Change activation status by id (get 1 more code)
try{
$status = $sms->getStatus($number['id']);//Get activation status by id
if ($status['status'] === 'STATUS_OK' && $status['code'])
echo "Ваш код: " .$status['code'];
} catch (Exception $e) {
echo $e->getResponseCode() ."\n"; }//Catch the error code
$prices = $sms->getPrices(1, 'vk');//Get the actual price for the service
echo "Price for VK (Ukraine) : " .$prices[1]['vk']['cost']."rub. quantity: ". $prices[1]['vk']['count'];//Show the result
$newQiwi = $sms->getQiwiRequisites();//Get up-to-date top-up wallet for Qiwi
if ($newQiwi['status'] === 'success')
echo "Wallet № " . $newQiwi['wallet']."\n";//Show wallet number
$getAvailableRentNumbers = $sms->getRentServicesAndCountries('2');//Request available countries for rent and services (for 2 hours for all operators)
echo "Full rental - Cost:" . $getAvailableRentNumbers['services']['full']['cost'] . " Quant :" .$getAvailableRentNumbers['services']['full']['quant'] ." \n"; //Display full price information
foreach( $getAvailableRentNumbers['operators'] as $value) {
echo " Operator " . $value ."\n"; }//List operators
$getRentNumber = $sms->getRentNumber('vk','10','0','yota');//Get a rental number for Vkontakte for 10 hours, the operator 'Yota', country - Russia
if ($getRentNumber['status'] === 'success'){
echo "The rental was successful! Your phone number is: " . $getRentNumber['phone']['number']." \nLease expiration : ". $getRentNumber['phone']['endDate']." \nId numbers :" .$getRentNumber['phone']['id'] ; }//Display rental information
else
echo "Код ошибки : " . $getRentNumber['message'];
$getRentStatus = $sms->getRentStatus($getRentNumber['phone']['id']);//Get the lease status with id from the received number
if ($getRentStatus['status'] == 'success'){
foreach( $getRentStatus['values']as $index => $value) {
echo " Message " . $index .": from the number - " . $value['phoneFrom'] . "Service - " . $value ['service'] . "Message text - " . $value['text'] . "дата - " . $value['date']; } }//display a list of messages received while renting a phone
else
echo "Error code : " . $getRentStatus['message'];
$setRentStatus = $sms->setRentStatus($getRentNumber['phone']['id'],1);//Set rental status 'finish' with id from received number
if ($setRentStatus['status'] == 'success')
echo " Status change was successful! ";
else
echo "Error code : " . $setRentStatus['message'];
$getRentList = $sms->getRentList();//Get a list of currently rented rooms
if (getRentList['status'] == 'success')
foreach( $getRentList['values'] as $value) {
echo " ID " . $value["id"] . " Number " . $value["phone"] ."\n"; }//List numbers
else
echo "Error code : " . $getRentList['message'];
<--Скоро-->