API protocol for working with SMS-Activate
API is a protocol between your software and our server
API is needed for automatization of the sms, otp, and pva receiving process on your side
Our API is fully compatible with competitor sites
All requests must go to https://api.sms-activate.ae/stubs/handler_api.php
POST or GET request.
All requests must contain an API key in the form of the api_key GET parameter
Download implementation of the protocol in php Download ready-made implementation of the protocol in PythonActivation API
Parameters:
$api_key - API key
$country * - country number see table
$operator * mobile operator numbers, you can specify several numbers separated by commas (available only for:
** available for $country = 0, $country = 1, $country = 2
ANSWER:
The response of the service will be in json format, example:
{"vk_0":76,"ok_0":139,"wa_0":90,"vi_0":223,"tg_0":158,"wb_0":106,"go_0":182,"av_0":244,"av_1":211,"fb_0":107}
Where to the dash is the name of the service, after the designation whether it is necessary to include redirection. 0 - no. 1 - yes.
Parameters:
$api_key - API key
$service * - Service see table
* optional parameter. If not specified, the top countries for all services will be displayed by default.
$freePrice * - optional parameter. If provided true, quantity and price will be provided according to Free Price
ANSWER:
The response of the service will be in json format, example:
{
0: {
"country: 0,
"count": 43575,
"price": 15.00,
"retail_price": 30.00
}, ...
}
$freePrice = true:
{
0: {
"country: 0,
"count": 43575,
"price": 15.00,
"retail_price": 30.00,
"freePriceMap": {
"15.00": 43242,
"18.00": 333
}
}, ...
}
Balance request with cashback account:
* returns the balance taking into account the accumulated cashback, if the checkbox in the cashback account settings 'Spend cashback on activation' is ticked
Parameters:
$api_key - API key
ANSWER:
ACCESS_BALANCE: 'account balance'
POSSIBLE MISTAKES:
BAD_KEY - invalid API key
ERROR_SQL - sql-server error
* returns all operators available for the transferred country, if the country is not transferred - will return all operators available for each country
Parameters:
$api_key - API key
$country - country code
ANSWER:
The response of the service will be in json format:
{"status":"success", "countryOperators": {
"Country1Code": ["operator1Name","operator2Name","operator3Name", ...],
"Country2Code": ["operator1Name","operator2Name","operator3Name", ...],
...
}}
Example:
{"status":"success", "countryOperators": {
"0": ["beeline","megafon","mts", ...],
"1": ["life","mts","kyivstar","utel" ...],
...
}}
* inside 'countryOperators' - the key will be the country code
POSSIBLE MISTAKES:
BAD_KEY - invalid API key
ERROR_SQL - sql-server error
OPERATORS_NOT_FOUND - no records found (e.g. non-existent country transferred)
Parameters:
$api_key - API key
ANSWER:
The response of the service will be in json format:
{"status":"success", "activeActivations": [
{
"activationId" : "635468021",
"serviceCode" : "vk",
"phoneNumber" : "79********1",
"activationCost" : 12.50,
"activationStatus" : "4",
"smsCode" : ["CODE"],
"smsText" : "[Your CODE registration code]",
"activationTime" : "2022-06-01 16:59:16",
"discount" : "0.00",
"repeated" : "0",
"countryCode" : "0",
"countryName" : "Russia",
"canGetAnotherSms" : "1",
"currency": 840
//ISO 4217 Num
}]
POSSIBLE MISTAKES:
BAD_KEY - invalid API key
ERROR_SQL - sql-server error
NO_ACTIVATIONS - entries not found (no active activations)
Parameters:
$api_key - API key
$service - service for ordering see table
$forward * - is it necessary to request a number with forwarding
* optional parameter, accepts 0 (do not execute, set by default), 1 (execute)
$maxPrice * - the maximum price for which you are ready to buy a number at Free Price
* optional parameter, if it is not specified, the purchase will take place at the regular price
$phoneException * - excluding prefixes for Russian numbers. Enter with a comma. Record format: country code and 3 to 6 digits of the mask (e.g. 7918, 7900111). The default value is the value specified in the account.
$operator* is a mobile operator of the number, you can specify several of them with a comma (only available for **)
$activationType - activation type: 0 - with sms (default), 1 - with number, 2 - with voice
$language - parsing language (required for activation with voice) see table
$userId * - user ID to ban for poor activation statistics, but the reseller's own account is not affected.
* optional field
** available for $country = 0, $country = 1, $country = 2
$ref - transfer the referral ID. More details
$country - country number see table
$useCashBack* - takes the boolean value, if the parameter is 'true', the number purchase will be made spending the cashback. After you run out of money on cashback balance, all subsequent purchases will be made using the balance. It is IMPORTANT to remember that all subsequent purchases will first of all use cashback, and after that the main balance is used (even if pass the parameter 'false' after that).
* optional parameter, accepts 'true'
By getting the number through the API, you agree with the project rules
POSSIBLE MISTAKES:
WRONG_MAX_PRICE:$min- the specified maximum price is less than the allowed one
$min - minimum allowable price
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 - incorrect exclusion prefixes
NO_BALANCE_FORWARD - not enough funds to buy call forwarding
CHANNELS_LIMIT - account blocked
NO_NUMBERS - no numbers
If you try to get the number of a specific operator that does not operate in the selected country or which does not have the selected service, the number of the first operator that matches the request parameters will be returned
the method works similarly to the method getNumber, accepts the same parameters and additional ones described below, but returns additional activation information
Parameters:
$orderId- activation id from the reseller's system. When purchasing, this data is compared to the activation id and a reseller in our system. Thus, we want to achieve idempotence (the same order will not be processed again).
ANSWER:
If the request is successful, the response will be in the following format:
{
"activationId": 635468024,
"phoneNumber": "79584******",
"activationCost": 12.50,
"currency": 840, //ISO 4217 Num
"countryCode": "0",
"canGetAnotherSms": "1",
"activationTime": "2022-06-01 17:30:57",
"activationOperator": "mtt"
}
If you try to get the number of a specific operator that does not operate in the selected country or which does not have the selected service, the number of the first operator that matches the request parameters will be returned
POSSIBLE MISTAKES:
ORDER_ALREADY_EXISTS- order has already been created
When you receive an SMS to a number, if you have enabled the Webhooks function in the settings, we will send information about the SMS via a POST-request to the addresses that you have specified
ANSWER:
The response format will be as follows:
{
"activationId": 123456,
"service": "go",
"text": "Sms text",
"code": "12345",
"country": 0,
"receivedAt": "2023-01-01 12:00:00"
}
When sending a request, we will wait for a response from your script with the HTTP status 200. If your script does not respond, we will send the request within 2 hours, but no more than 8 times.
In case there are errors in requests, you will receive a notification from the Telegram bot if it is connected to your account (no more than once every 5 minutes).
You can enable this functionality inthe profile settings
Parameters:
$api_key - API key
$service - service for ordering see table
$forward * - is it necessary to request a number with forwarding
* optional parameter, forwarding characters are 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. Takes 0 (do not execute, default), 1 (execute)
$operator * - mobile operator of the number, you can specify several numbers separated by commas (available only for **):
$ref - transfer the referral ID. More details
$country - country number see table
By getting the number through the API, you agree with the project rules
ANSWER:
NO_NUMBERS - no numbers
NO_BALANCE - balance has ended
{{'phone':phone,'activation':activation,'service':service},
{'phone':phone,'activation':activation,'service':service}}, where (phone - id operations, activation - Phone number, service - Service)
POSSIBLE MISTAKES:
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
Parameters:
$api_key - API key
$id - Activation ID
$forward * - phone number to which you want to forward
* required only if a parameter was passed with getNumber forward=1.
$status - activation status
1 - notify about the number availability (sms sent to the number)
3 - request one more code (for free)
6 - finish the activation *
8 - report the fact that the number has been already used and cancel the activation
* if there was a status 'code received' - marks it successfully and completes, if there was a 'preparation' - deletes and marks an error, if there was a status 'awaiting retry' - transfers activation to SMS pending
** It is not possible to change the activation status for which the verification method by call was selected if the number has already arrived
The simple logic of the chronology of working with API:
Getting a number using the getNumber method, then the following actions are available:
8 - cancel activation (if the number is not suitable for you)
1 - inform that SMS has been sent (optional)
To activation with status 1:
8 - cancel the activation
Immediately after receiving the code:
3 - request one more SMS
6 - confirm the SMS-code and finish the activation
To activation with status 3:
6 - confirm the SMS-code and finish the activation
ANSWER:
ACCESS_READY - numbers readiness confirmed
ACCESS_RETRY_GET - waiting for a new SMS
ACCESS_ACTIVATION - the service has been successfully activated
ACCESS_CANCEL - activation canceled
POSSIBLE MISTAKES:
EARLY_CANCEL_DENIED - it is not allowed to cancel a number within first 2 minutes
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
WRONG_ACTIVATION_ID- invalid ID or ID is not a number.
Parameters:
$api_key - API key
$id - Activation ID
ANSWER:
STATUS_WAIT_CODE - waiting for SMS
STATUS_WAIT_RETRY: 'past, unmatched code' - waiting for code clarification
STATUS_WAIT_RESEND - waiting for re-sending SMS *
* the software must press re-send SMS and change the status to 6
STATUS_CANCEL - activation canceled
STATUS_OK: 'activation code' - code received
POSSIBLE MISTAKES:
NO_ACTIVATION - activation id does not exist
ERROR_SQL - sql-server error
BAD_KEY - invalid API key
BAD_ACTION - incorrect action
Parameters:
$api_key - API key
$id - Activation ID
ANSWER:
The response format will be as follows:
{
"verificationType": 2,
"sms": {
"dateTime": "0000-00-00 00:00:00",
"code": "code",
"text": "sms text",
},
"call": {
"from": "phone",
"text": "voice text",
"code": "12345",
"dateTime": "0000-00-00 00:00:00",
"url": "voice file url",
"parsingCount": 1,
}
}
STATUS_CANCEL - activation canceled
POSSIBLE MISTAKES:
NO_ACTIVATION - activation id does not exist
ERROR_SQL - sql-server error
BAD_KEY - invalid API key
BAD_ACTION - incorrect action
Parameters:
$api_key - API key
$start * - timestamp in Unix Timestamp format (optional) - which date to consider activations from
$end * - timestamp in Unix Timestamp format (optional) - till which date to consider activations
$offset - offset of the first element returned in the response. Default is 0
$limit - maximum number returned records. Maximum is 100. Default is 50.
* dates are limited to 30 days
ANSWER:
The response format will be as follows:
[{
"id": 635468024,
"date": "2022-11-12 15:58:39",
"phone": "79918529716",
"sms": "sms":"["Your sms code"]",
"cost": 100
//For active ones cost = 0
"status": "4",
"currency": 840
//ISO 4217 Num
}]
POSSIBLE MISTAKES:
ERROR_SQL - sql-server error
BAD_KEY - invalid API key
BAD_ACTION - incorrect action
WRONG_DATE- date format is not timestamp or one of the dates is later than 30 days
Parameters:
$api_key - API key
$service - service name
ANSWER:
The response format will be as follows:
[{
"country": 0,
"share": 50
, // (Purchases of the chosen service by country as a percentage of the total quantity of purchases at our service)
"rate": 50
// (% of successful activations among the total number of activations by the country)
}]
POSSIBLE MISTAKES:
ERROR_SQL - sql-server error
BAD_KEY - invalid API key
WRONG_SERVICE - incorrect service
BAD_ACTION - incorrect action
Parameters:
$api_key - API key
$id - Activation ID
ANSWER:
The response of the service will be in json format, example:
{"status":"2","phone":false}
POSSIBLE STATUSES:
2 - new activation
3 - successfully finished
4 - canceled
5 - returned
POSSIBLE MISTAKES:
BAD_KEY - invalid API key
INVALID_ACTIVATION_ID - Invalid activation ID
Parameters:
$api_key - API key
$serviceShort name of the service (Optional, by default all services) see table
$countryCountry code name (Optional, defaults to all countries) see table
ANSWER:
JSON - object in format
{"Country":{"Service":{"cost":Cost,"count":Count}}}
Parameters:
$api_key - API key
$serviceShort name of the service (Optional, by default all services) see table
ANSWER:
JSON - object in format
{"Service":{"Country":{"count":Quantity,"price":"Price"}}}
Parameters:
$api_key - API key
ANSWER:
JSON - object in format {{'Страна':{'id':0,'rus':"Россия","eng:"Russia","chn":"俄罗斯","visible":1,"retry":1,"rent":1,"multiService":1}},
where (
id : country id;
rus : country name in Russian;
eng : country name in English;
chn : country name in Chinese;
visible : 0 - country is not displayed on the site, 1 - displayed;
retry : 0 - repeated SMS is NOT available, 1 - available;
rent : 0 - country not leased, 1 - leased;
multiService : 0-country is NOT available for multiservice, 1- available.)
Parameters:
$api_key- API key
$country *- Country ID. If you have passed the country, we return the services that have a price for the chosen country
$lang *- which language to use to provide `name`. Possible values: 'ru', 'en', 'es', 'cn'. The default is 'en'
* optional parameter
ANSWER:
JSON - object in format { "status": "success", "services": [ { "code": "aoo", "name": "Pegasus Airlines" } ] }
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
Parameters:
$api_key - API key
$service - for the short name of the service, see the table see table
$id - Parent Activation ID
ANSWER:
ADDITIONAL:$id:$phone - a new activation was successfully created. Where ID is ID of additional activation, phone is a phone number
POSSIBLE MISTAKES:
WRONG_ADDITIONAL_SERVICE - Invalid additional service (only services for forwarding are allowed)
WRONG_ACTIVATION_ID - Incorrect parental activation ID
WRONG_SECURITY - an error occured when attempting to transmit an activation ID without redirection, or a completed/inactive activation
REPEAT_ADDITIONAL_SERVICE - error occurs when trying to order a purchased service again NO_BALANCE - Not sufficient funds
ERROR_SQL- database error, contact the customer service
If you have made a successful activation on the number, then you can do it again.
The cost of additional activation is determined depending on the country and service. The specific cost can be obtained from this query.
Parameters:
$api_key - API key
$activationId - Parent Activation ID
ANSWER:
ACCESS_NUMBER:$id:$phone - a new activation has been successfully created. Where $id is ID of additional activation, $phone is a phone number
POSSIBLE MISTAKES:
RENEW_ACTIVATION_NOT_AVAILABLE- the number is not available for additional activation
WRONG_ACTIVATION_ID - Incorrect parental activation ID
ERROR_SQL- database error, contact the customer service
NEW_ACTIVATION_IMPOSSIBLE- it is impossible to make additional activation
NO_BALANCE - no money in the account
You can find out the availability of the number for additional activation and get its cost
Parameters:
$api_key - API key
$activationId - Parent Activation ID
ANSWER:
JSON - object in format {'status': 'success', 'cost':200,"service":"tw","phone":777777777,"country":14},
POSSIBLE MISTAKES:
RENEW_ACTIVATION_NOT_AVAILABLE- the number is not available for additional activation
WRONG_ACTIVATION_ID - Incorrect parental activation ID
SIM_OFFLINE - SIM card offline
ANSWER:
The response format will be as follows:
{
"result": "OK"
}
STATUS_CANCEL - activation canceled
NO_CALL- no call was received
PARSE_COUNT_EXCEED- limit of parsing attempts (maximum is 4)
POSSIBLE MISTAKES:
WRONG_ACTIVATION_ID - invalid activation id, it does not exist or it is not active
ERROR_SQL - sql-server error
BAD_KEY - invalid API key
BAD_ACTION - incorrect action
Rent Api
Parameters:
$api_key - API key
$time* - rental time (by default: 4 hours)
$operator* - mobile operator of the number, you can specify several of them separated by commas (by default: Any)
$country* - country (by default: Russia)
$currency* - iso code of the currency in which to display prices
$incomingCall * - if transferred "true"get a number supporting a function to receive a call
ANSWER:
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 } }, "currency": 840 }
POSSIBLE MISTAKES:
BAD_KEY - invalid API key
OUT_OF_STOCK - numbers for that country are unavailable
Parameters:
$api_key - API key
$service - the service for which you need to get a number
$time* - rental time in hours (default: 4 hours). The next available time period is 12 hours, then 24 hours. When requesting a rental for a day or more, you must transfer: 24, 48, 72, etc.
$operator* - mobile operator of the number, you can specify several of them separated by commas (by default: Any)
$country* - country (by default: Russia)
$url * - a link for the webhook (is not considered by default)
$incomingCall * - if transferred "true"get a number supporting a function to receive a call
* optional parameter. If not specified, the default parameter will be used.
ANSWER:
The response of the service will be in json format, example:
{ "status": "success", "phone": { "id": 1049, "endDate": "2020-01-31T12:01:52", "number": "79959707564" } }
POSSIBLE MISTAKES:
BAD_KEY - invalid API key
Answer in json format:
{ "status": "error", "message": "*possible_answer*" }
Possible answers in the field "message":
BAD_SERVICE - service not specified or name is incorrect
NO_BALANCE - no money in the account
NO_NUMBERS - no numbers
ACCOUNT_INACTIVE- the account is not active
SERVER_ERROR - server error
CHANNELS_LIMIT - account blocked
Parameters:
$api_key - API key
$id - Rental ID received in the reply when ordering a number
$page* - number of the page from which the selection begins (page numbering starts from 0, from new to old; default is 0)
$size* - page size (default 10)
* optional parameter. If not specified, the default parameter will be used.
ANSWER:
The response of the service will be in json format, example:
{ "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 when there is a sms (box 'quantity' > 0).
POSSIBLE MISTAKES:
BAD_KEY - invalid API key
Answer in json format:
{ "status": "error", "message": "*possible_answer*" } Possible answers in the field "message": NO_ID_RENT - rent ID is not specified INVALID_PHONE - the number is rented not by you (invalid rent ID) STATUS_FINISH - rent paid and completed STATUS_CANCEL - rent canceled with a refund STATUS_WAIT_CODE - waiting for the first SMS STATUS_REVOKE - The number is blocked, your funds have been returned
Parameters:
$api_key - API key
$id - Rental ID received in the reply when ordering a number
$status - code for changing the status (number)
The status can be:
ANSWER:
The response of the service will be in json format:
{ "status": "success" }
POSSIBLE MISTAKES:
BAD_KEY - invalid API key
Answer in json format:
{ "status": "error", "message": "*possible_answer*" }
Possible answers in the field "message":
NO_ID_RENT - rent ID is not specified
INCORECT_STATUS - missing or incorrectly specified status
CANT_CANCEL - it is impossible to cancel the lease (more than 20 min.)
INVALID_PHONE - the number is rented not by you (invalid rent ID)
ALREADY_FINISH - the lease has already been completed
ALREADY_CANCEL - the lease has already been canceled
SERVER_ERROR - server error
👉Attention! This method displays only the last 10 numbers. If you need more numbers, use the getRentStatus method to check statuses.
Parameters:
$api_key - API key
ANSWER:
The response of the service will be in json format:
{ "status": "success", "values": { "0": { "id": "12345", "phone": "79181234567" }, "1": { "id": "12345", "phone": "79181234568" } } }
POSSIBLE MISTAKES:
BAD_KEY - invalid API key
BAD_ACTION - incorrect action
Answer in json format:
{ "status": "error", "message": "*possible_answer*" }
Possible answers in the field "message":
NO_NUMBERS - no rented numbers
SERVER_ERROR - server error
Parameters:
$api_key - API key
$id - id rent
$rent_time- rental time (by default: 4 hours)
ANSWER:
The response of the service will be in json format:
{ "status": "success", "phone": { "id": 1049, "endDate": "2020-01-31T12:01:52", "number": "79959707564"} }
When a completed rent is prolonged, it will be reordered, a new id will be provided
POSSIBLE MISTAKES:
BAD_KEY - invalid API key
BAD_ACTION - incorrect action
SERVER_ERROR - server error
Answer in json format:
{ "status": "error", "message": "*possible_answer*", "info": "*details*" }
Possible answers in the field "message":
NO_ID_RENT - there is no rent ID
INVALID_TIME - wrong time. Available number of hours from 4 to 1344
MAX_HOURS_EXCEED - The maximum of available time was exceeded
max - maximum available time
INVALID_PHONE - incorrect rent ID
RENT_DIE - rent cannot be extended because the number has expired
NO_BALANCE - insufficient funds
CHANNELS_LIMIT - account blocked
Parameters:
$api_key - API key
$id - id rent
$rent_time - rent time
$currency* - iso code of the currency in which to display the price
ANSWER:
The response of the service will be in json format:
{ "status": "success", "price": 6.33, "currency": 840 }
POSSIBLE MISTAKES:
BAD_KEY - invalid API key
BAD_ACTION - incorrect action
SERVER_ERROR - server error
Answer in json format:
{ "status": "error", "message": "*possible_answer*" }
Possible answers in the field "message":
NO_ID_RENT - there is no rent ID
INVALID_PHONE - incorrect rent ID
INVALID_TIME - incorrect time setting
RENT_DIE - rent cannot be extended because the number has expired
MAX_HOURS_EXCEED - The maximum of available time was exceeded
max - maximum available time
CHANNELS_LIMIT - account blocked
API Partner software
Parameters:
$api_key - API key
$id- Id of the software that you need to purchase
ANSWER:
The response of the service will be in json format, example:
{ "status": "success", "key": "F5qrzFoY6afj3zrEq7SeMplbx", "manual": "Software download link:" }
POSSIBLE MISTAKES:
BAD_DATA - Incorrect ID or ID is not a number
BAD_ACTION - invalid action or the reseller is not verified.
<?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
$array=$activate->getTopCountriesByService(); //Get an array whose elements contain information for each country
$balance = $sms->getBalance();//Get balance
echo "On the account " . $balance." $.\n";//Show balance
$balance = $sms->getBalanceAndCashBack();//Request a balance with cashback account
echo "On the account " . $balance." $.\n";//Request a balance with cashback account
$operators = $sms->getOperators();
//Get operators for all countries
if (in_array('mts', $operators['countryOperators'][0])) {
//check if 'mts' is available for Russia
//perform an action
}
if (in_array('chinamobile', $operators['countryOperators'][3])) {
//check if 'chinamobile' is available for China
//perform an action
}
$activations = $sms->getActiveActivations();
$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
$result = $sms->getNumber('vk', 0 , 1);
if (!is_array($result)) {
echo 'Ошибка: ' . $result . '\n';//If an error occurs, a string will be returned, if successful, an array will be returned.
} else {
echo 'Id: ' . $result['id'] ."\n";
echo 'Номер: ' . $result['number'] ."\n";
}
$result = $sms->getNumberV2('vk', 0 , 1);
$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)
$status = $sms->getStatus($number['id']);//Get activation status by id
if (is_array($status) {
echo "статус : " . $status['status'];//Can be STATUS_OK or STATUS_WAIT_RETRY, otherwise a line with error text will be returned
echo "код: " . $status['code'];
} else {
echo $status ."\n";
}
$incomingCall = $sms->getIncomingCallStatus($id);//Get activation data by call
echo $incomingCall['phone'] //Show incoming number
$prices = $sms->getPrices(1, 'vk');//Get the current price for the service
echo "Price for VK (Ukraine) : " .$prices[1]['vk']['cost']."$quantity: ". $prices[1]['vk']['count'];//Show the result
$countries = $sms->getCountries();//Get a list of all countries
$additional = $sms->getAdditionalService('fx', $id);//Get additional activation for PGbonus service based on id activation
echo "Activation no.: " . $additional[id] . " Telephone: " . $additional[number];//Show the result
$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 number for rent for Vkontakte for 10 hours, operator 'Yota', country - Russia
if ($getRentNumber['status'] === 'success'){
echo "The rental was successful! Your phone number is: " . $getRentNumber['phone']['number']." \nRent expiration : ". $getRentNumber['phone']['endDate']." \nId numbers :" .$getRentNumber['phone']['id'] ; }//Display rental information
else
echo "Error code : " . $getRentNumber['message'];
$getRentStatus = $sms->getRentStatus($getRentNumber['phone']['id']);//Get the rent 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'] . "Date - " . $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 numbers
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'];
$result = $sms->continueRentNumber($id);//Extend the lease of activation id for 4 hours (by default)
if ($result['status'] == 'success') {
echo "Number: " . $result['phone']['number']"//Display number
echo "id: " . $result['phone']['id']"//Display activation id
echo "The lease is valid until: " . $result['phone']['endDate']"//Display the date and time of the end of the lease
} else {
echo "Error code : " . $result['msg'];
}
$result = $sms->getContinueRentPriceNumber($id, 12);//Get the cost of renewing the lease to activate the id for 12 hours
if ($result['status'] == 'success') {
echo " Renewal cost " . $result['price'];//Withdraw the cost
} else {
echo "Error code: " . $result['message']; //Display error code
}
from smsactivate.api import SMSActivateAPI
# SMSActivateAPI Contains all basic tools for working with the SMSActivate API
sa = SMSActivateAPI(API_KEY)
sa.debug_mode = True
# Used for debugging. When debug_mode is active, all responses from the server and class will be output to the console
print(sa.version())
# Returns the current version of the library
status = sa.getNumbersStatus(country=0, operator='tele2')
try:
print(status['vk_0']) # 274789
except:
print(status['message']) # Error text
result = sa.getTopCountriesByService('vk')
try:
print(result[0]['count']) # 2350
except:
print(result['message']) # Error text
balance = sa.getBalance() # {'balance': '100.00'}
try:
print(balance['balance']) # 100.00
except:
print(balance['message']) # Error text
balance = sa.getBalanceAndCashBack() # {'balance': '100.00'}
try:
print(balance['balance']) # 100.00
except:
print(balance['message']) # Error text
operators = sa.getOperators(country=0)
try:
print(operators['countryOperators']['0'])
except:
print(operators['error']) # Error status
activations = sa.getActiveActivations()
try:
print(activations['activeActivations'])
except:
print(activations['error']) # Error status
number = sa.getNumber(service='vk', operator='tele2', country=0, verification="true") # {'activation_id': 000000000, 'phone': 79999999999}
try:
print(number['phone']) # 79999999999
except:
print(number['message']) # Error text
number = sa.getNumberV2(service='vk', country=0)
try:
print(number['phoneNumber']) # 79999999999
except:
print(number['message']) # Error text
multinumber = sa.getMultiServiceNumber(service='fb,ig', operator='tele2', country=0) # [{'phone': '79999999999', 'activation': 000000000, 'service': 'fb'}, {'phone': '79999999999', 'activation': 000000001, 'service': 'ig'}]
try:
print(multinumber[0]['phone']) # 79999999999
except:
print(multinumber['message']) # Error text
status = sa.setStatus(id=000000000, status=1) # ACCESS_READY
try:
print(status) # ACCESS_READY
except:
print(status['message']) # Error text
status = sa.getStatus(id=000000000) # STATUS_WAIT_CODE
try:
print(sa.activationStatus(status)) # {'status': 'STATUS_WAIT_CODE', 'message': 'Ожидание смс'}
except:
print(status['message']) # Error text
status = sa.getIncomingCallStatus(id=000000000)
try:
print(status['status']) # 2
except:
print(status['message']) # Error text
prices = sa.getPrices(service='fb', country=0)
try:
print(prices['0']) # {'fb': {'cost': 9, 'count': 27934}}
except:
print(prices['message']) # Error text
countries = sa.getCountries()
try:
print(countries['0']['eng']) # Russia
except:
print(countries['message']) # Error text
service = sa.getAdditionalService(id=000000000, service='ig')
try:
print(service['phone']) # 79999999999
except:
print(service['message']) # Error text
service = sa.getRentServicesAndCountries(time=4, operator='tele2', country=0)
try:
print(service['services']['full']['cost']) # 100.00
except:
print(service['message']) # Error text
rent = sa.getRentNumber(service='ig', time=4, operator='tele2', country=0)
try:
print(rent['phone']['number']) # 79999999999
except:
print(rent['message']) # Error text
status = sa.getRentStatus(000000000)
try:
print(status['values']['0']['text']) # SMS
except:
print(status['message']) # Error text
status = sa.setRentStatus(id=000000000, status=1)
try:
print(status['status']) # success
except:
print(status['message']) # Error text
rent = sa.getRentList()
try:
print(rent['values']['0']['phone']) # 79999999999
except:
print(rent['message']) # Error text
rent = sa.continueRentNumber(id=000000000, time=4)
try:
print(rent['phone']['number']) # 79999999999
except:
print(rent['message']) # Error text
rent = sa.getContinueRentPriceNumber(000000000)
try:
print(status['price']) # 4.00
except:
print(status['message']) # Error text