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 should go to https://api.sms-activate.org/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 php Download ready-made implementation of the protocol in Python

Activation API

Request the available quantity of virtual numbers
https://api.sms-activate.org/stubs/handler_api.php?api_key=$api_key&action=getNumbersStatus&country=$country&operator=$operator

Parameters:

$api_key - API key

$country * - country number 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, activ, altel

** 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.

Full list of services

Request for top countries by service
https://api.sms-activate.org/stubs/handler_api.php?api_key=$api_key&action=getTopCountriesByService&service=$service&freePrice=$freePrice

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 true, the quantity and price will be transferred according to the Free Price **:

ANSWER:

The response of the service will be in json format, example:

{ 0: { "freePriceMap": { "15.00": 43242, "18.00": 333 }, "country: 0, "count": 43575, "price": 15.00 }... }
Balance inquiry
https://api.sms-activate.org/stubs/handler_api.php?api_key=$api_key&action=getBalance

Balance request with cashback account:

https://api.sms-activate.org/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 cashback on activation"

Parameters:

$api_key - API key

ANSWER:

ACCESS_BALANCE: 'account balance'

POSSIBLE MISTAKES:

BAD_KEY - invalid API key

ERROR_SQL - sql-server error

Request available operators
https://api.sms-activate.org/stubs/handler_api.php?api_key=$api_key&action=getOperators&country=$country

* 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)

Request active activations
https://api.sms-activate.org/stubs/handler_api.php?api_key=$api_key&action=getActiveActivations

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",
}]

POSSIBLE MISTAKES:

BAD_KEY - invalid API key

ERROR_SQL - sql-server error

NO_ACTIVATIONS - entries not found (no active activations)

Request a number
https://sms-activate.org/stubs/handler_api.php?api_key=$api_key&action=getNumber&service=$service&forward=$forward&operator=$operator&ref=$ref&country=$country&phoneException=$phoneException&freePrice=$freePrice&maxPrice=maxPrice&verification=$verification

Parameters:

$api_key - API key

$service - service for ordering see table

$forward * - is it necessary to request a number with forwarding

$freePrice * - buy a number using Free Price.

* optional parameter accepts  true(use Free Price). You also need to pass the parameter $maxPrice

$maxPrice * - indicate the maximum price at which you are ready to buy a number at Free Price.

* optional parameter, specified only if $freePrice = true

$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 (do not execute, set by default), 1 (execute)

$operator * - mobile operator of the number, you can specify several numbers separated by commas (available only for **):

$verification * - If transmitted true, get a number with the ability to receive a call (when passing the parameter $verificationParameters: $multiService and $freePrice don't work)

Russia
megafon, mts, beeline, tele2, rostelecom, any
Ukraine
kyivstar, life, utel, mts, vodafone
Kazakhstan
tele2, beeline, activ, 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 - transfer the referral ID. Read more

$country - country number see table

By getting the number through the API, you agree with the project rules project rules

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

WRONG_EXCEPTION_PHONE - incorrect exclusion prefixes

NO_BALANCE_FORWARD - not enough funds to buy call forwarding

V2 Number Request
https://sms-activate.org/stubs/handler_api.php?api_key=$api_key&action=getNumberV2&service=$service&forward=$forward&operator=$operator&ref=$ref&country=$country&phoneException=$phoneException&freePrice=$freePrice&maxPrice=maxPrice&verification=$verification

action = getNumberV2

the method works similarly to the method getNumbertakes the same parameters but returns additional activation information

ANSWER:

If the request is successful, the response will be in the following format:

{
"activationId": 635468024,
"phoneNumber": "79584******",
"activationCost": "12.50",
"countryCode": "0",
"canGetAnotherSms": "1",
"activationTime": "2022-06-01 17:30:57",
"activationOperator": "mtt"
}
Ordering a virtual number for several services
https://api.sms-activate.org/stubs/handler_api.php?api_key=$api_key&action=getMultiServiceNumber&multiService=$service&multiForward=$forward&operator=$operator&ref=$ref&country=$country

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 **):

Russia
megafon, mts, beeline, tele2, rostelecom, any
Ukraine
kyivstar, life, utel, mts, vodafone
Kazakhstan
tele2, beeline, activ, altel

* optional field. If not specified, then by default the quantity will be displayed in accordance with the setting in the left menu.

$ref - transfer the referral ID. Read more

$country - country number see table

By getting the number through the API, you agree with the project rules 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

Change of activation status
https://api.sms-activate.org/stubs/handler_api.php?api_key=$api_key&action=setStatus&status=$status&id=$id&forward=$forward

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 inform about the readiness of the number (SMS sent to the number)

3 request another code (free)

6 complete activation *

8 inform that the number has been 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

Simple logic of api chronology:

Get number using getNumber method after that the following actions are available:

8 - Cancel the activation (if the number does not match you)

1 - Report 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

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:

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

Get activation status
https://api.sms-activate.org/stubs/handler_api.php?api_key=$api_key&action=getStatus&id=$id

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

Get the status of an incoming call
https://api.sms-activate.org/stubs/handler_api.php?api_key=$api_key&action=getIncomingCallStatus&activationId=$id

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 closed

4 cancelled

5 returned

POSSIBLE MISTAKES:

BAD_KEY - invalid API key

INVALID_ACTIVATION_ID - Invalid activation ID

Get current prices by country
https://api.sms-activate.org/stubs/handler_api.php?api_key=$api_key&action=getPrices&service=$service&country=$country

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":Стоимость,"count":Количество}}, "retry": Repeated SMS reception}

Get up-to-date prices for services for verification
https://api.sms-activate.org/stubs/handler_api.php?api_key=$api_key&action=getPricesVerification&service=$service

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"}}}

Get a list of all countries
https://api.sms-activate.org/stubs/handler_api.php?api_key=$api_key&action=getCountries

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.)

Additional service for redirected numbers

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://api.sms-activate.org/stubs/handler_api.php?api_key=$api_key&action=getAdditionalService&service=$service&id=$id

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 - Successfully created a new activation. Where ID - ID of additional activation, phone - phone number

POSSIBLE MISTAKES:

WRONG_ADDITIONAL_SERVICE - Invalid additional service (only services for forwarding 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 - The error occurs when you try to order the purchased service again NO_BALANCE - Not enough funds

ERROR_SQL - Database error, contact support

Virtual number reactivation

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.

https://api.sms-activate.org/stubs/handler_api.php?api_key=$api_key&action=getExtraActivation&activationId=$activationId

Parameters:

$api_key - API key

$activationId - Parent Activation ID

ANSWER:

ACCESS_NUMBER:$id:$phone - Successfully created a new activation. Where $id - additional activation ID, $phone - phone number

POSSIBLE MISTAKES:

RENEW_ACTIVATION_NOT_AVAILABLE- the number is not available for additional activation

WRONG_ACTIVATION_ID - Invalid Parent Activation ID

ERROR_SQL - Database error, contact support

NEW_ACTIVATION_IMPOSSIBLE- it is impossible to make additional activation

NO_BALANCE - no money in the account

Get a price for additional number activation

You can find out the availability of the number for additional activation and get its cost

The cost of additional activation depends on the time that has passed since the main activation. If the base cost is 50 rubles, then the final cost will be: 50 x *number of months from the date of the main activation*

https://api.sms-activate.org/stubs/handler_api.php?api_key=$api_key&action=checkExtraActivation&activationId=$activationId

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 - Invalid Parent Activation ID

Call the service

You can order an outgoing call from the number you received for activation.

https://api.sms-activate.org/stubs/handler_api.php?api_key=$api_key&action=createTaskForCall&activationId=$activationId&phone=$phone

Parameters:

$api_key - API key

$activationId - Activation ID

$phone - Number to call

ANSWER:

JSON - object in format {'status': 'success', 'msg':'Call request successfully created.'},

POSSIBLE MISTAKES:

CALL_TASK_ALREADY_EXIST - Call request has already been created.

WRONG_ACTIVATION_ID - Invalid activation ID

NUMBER_NOT_EXIST - The number you are trying to call does not exist

Check outgoing call status

After ordering an outgoing call, you can check the status of the application(s). By default, requests for the current day are returned.

https://api.sms-activate.org/stubs/handler_api.php?api_key=$api_key&action=getOutgoingCalls&date=$date&activationId=$activationId

Parameters:

$api_key - API key

$activationId - Activation ID, optional parameter, if not passed, a list of all requests will be returned

$date - Date in the format 'YYYY-MM-DD', optional parameter, if not passed, the list for the current day will be returned

ANSWER:

JSON - object in format {"958874106":{"date":"2022-07-29 16:03:23","phoneFrom":"79912556393","status":"IN_PROCESS"}},

Rent Api

Request available countries and services
https://api.sms-activate.org/stubs/handler_api.php?api_key=$api_key&action=getRentServicesAndCountries&rent_time=$time&operator=$operator&country=$country

Parameters:

$api_key - API key

$time * - rental time

* optional parameter. If not specified, the default will be 4 hours.

$operator * - mobile number operator, you can specify several numbers separated by commas

$country * - country (Default: Russia)

* optional parameter. If not specified, then the default will be any.

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 } } }

POSSIBLE MISTAKES:

BAD_KEY - invalid API key

Order a virtual number rental
https://api.sms-activate.org/stubs/handler_api.php?api_key=$api_key&action=getRentNumber&service=$service&rent_time=$time&operator=$operator&country=$country&url=$url

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 rent for a day or more, you must send: 24, 48, 72, etc.

$operator * - mobile operator of 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 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 - no numbers

SQL_ERROR - sql-server error

get status for rent
https://api.sms-activate.org/stubs/handler_api.php?api_key=$api_key&action=getRentStatus&id=$id

Parameters:

$api_key - API key

$id - rental id received in the response when ordering a phone

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 if there is an SMS (field '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 not specified

INVALID_PHONE - number is not rented by you (wrong rental id)

STATUS_FINISH - rent paid and completed

STATUS_CANCEL - rent canceled with a refund

STATUS_WAIT_CODE - waiting for the first SMS

Rental Status Change
https://api.sms-activate.org/stubs/handler_api.php?api_key=$api_key&action=setRentStatus&id=$id&status=$status

Parameters:

$api_key - API key

$id - rental id received in the response when ordering a phone

$status - code for changing the status (number)

The status can be:

1
Finish
2
Cancel

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 not specified

INCORECT_STATUS - missing or incorrectly specified status

CANT_CANCEL - it is impossible to cancel the lease (more than 20 min.)

INVALID_PHONE - number is not rented by you (wrong rental id)

ALREADY_FINISH - the lease has already been completed

ALREADY_CANCEL - the lease has already been canceled

SQL_ERROR - sql-server error

List current activations
http://api.sms-activate.org/stubs/handler_api.php?api_key=$api_key&action=getRentList

Parameters:

$api_key - API key

ANSWER:

The response of the service will be in json format:

{ "status": "success", "values": { "0": { "id": "123456", "phone": "79181234567" }, "1": { "id": "123457", "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

SQL_ERROR - sql-server error

Renew rent
http://api.sms-activate.org/stubs/handler_api.php?api_key=$api_key&action=continueRentNumber&id=$id&rent_time=$time

Parameters:

$api_key - API key

$id - id rent

$api_key - rental time (by default 4 hours)

* optional parameter. If not specified, the default parameter will be used.

ANSWER:

The response of the service will be in json format:

{ "status": "success", "phone": { "id": 1049, "endDate": "2020-01-31T12:01:52", "number": "79959707564"} }

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_ID_RENT - no rental id

NO_BALANCE - insufficient funds

RENT_DIE - rent cannot be extended because the number has expired

INVALID_PHONE - Invalid rent id

WRONG_OPERATOR - rent transferred operator not MTT

INVALID_TIME - wrong time. Available number of hours from 4 to 1344

SQL_ERROR - sql-server error

Get the cost of rent renewal
http://api.sms-activate.org/stubs/handler_api.php?api_key=$api_key&action=getContinueRentPriceNumber&id=$id

* this method is only available for rental with MTT operator.

Parameters:

$api_key - API key

$id - id rent

ANSWER:

The response of the service will be in json format:

{ "status": "success", "price": 6.33 }

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_ID_RENT - no rental id

RENT_DIE - rent cannot be extended because the number has expired

INVALID_PHONE - Invalid rent id

WRONG_OPERATOR - rent transferred operator not MTT

SQL_ERROR - sql-server error

API JAVA

Beginning of work

Include the library in maven

<dependecy><groupId>ru.sms-activate</groupId>
<artifactId>SMSActivateApi</artifactId>
<version>1.0</version>
</dependecy>

You can see an example of registration by ссылке на MavenRepository

Import the main class to interact with the SMS-Activate API.

import ru.sms_activate.SMSActivateApi

To use the library, you need an API key, you can get it on this page and at the link below.

SMS-Activate API-Key
An example of working with balance

To get the current balance on your account, use the method getBalance... If you are interested in cashback in addition to the balance, then call the method getBalanceAndCashBack.

Method getBalanceAndCashBack returns a class objectSMSActivateGetBalanceAndCashBack.

getBalance: Get the current account balance

Parameters:

NONE

RETURN TYPE:

BigDecimal

getBalanceAndCashBack:Get balance and cashback amount as full balance

Parameters:

NONE

getNumber: get activation

Parameters:

countryId(Integer) - Country identifier.

service(String) - Service short name.

forward*(boolean) -Do I need to request a redirected number.

operatorSet*(Set) - A set of operators.

phoneException*(Set) - Exclusive prefixes for Russia only, a set of numbers from 3 to 6 (7918.7900111).

* optional field. If not specified, then by default the quantity will be displayed in accordance with the setting in the left menu.

RETURN TYPE:

SMSActivateActivation

getNumberStatus: get information about available services

Parameters:

countryId(Integer) - Country identifier.

operatorSet*(Set) - The set of operators available from the service

getAdditionalService:Returns the additional service for the call forwarding number.

Parameters:

countryId(Integer) - Activation ID.

service(String) - Service short name.

Instead of the activation identifier, you can pass the received class object SMSActivateActivation after using the method getNumber or one of the activations after use getMultiServiceNumber.

getMultiServiceNumber: Get activation for multiple services

Parameters:

countryId(Integer) - Country identifier.

serviceMap(Set) - The set of services for which activation is purchased.

multiForwardList(List) - List of services with forwarding

operatorSet(Set) - A set of operators.

getAllPrices: Get a complete list of activation prices

Parameters:

NONE

getPricesByCountryIdAndServiceShortName: get a list of prices for activation by country and service

Parameters:

countryId(Integer) - Country identifier.

service(String) - Service short name.

getPricesAllServicesByCountryId: get a list of activation prices by country

Parameters:

countryId(Integer) - Country identifier.

getStatus: get activation status

Parameters:

countryId(Integer) - Activation ID.

Instead of the activation identifier, you can pass the received class object SMSActivateActivation after using the method getNumber or one of the activations after use getMultiServiceNumber.

setStatus: set activation status

Parameters:

countryId(Integer) - Activation ID.

status(SMSActivateClientStatus) - The status to set the activation

Instead of the activation identifier, you can pass the received class object SMSActivateActivation after using the method getNumber or one of the activations after use getMultiServiceNumber.

getCountries: get information about countries

Parameters:

NONE

getQiwiRequisites: get information about Qiwi-requisites

Parameters:

NONE

getFullSms: get the full text of sms from the number

Parameters:

countryId(Integer) - Activation ID.

Instead of the activation identifier, you can pass the received class object SMSActivateActivation after using the method getNumber or one of the activations after use getMultiServiceNumber.

Algorithm for receiving the full text of SMS with activation

Get number using getNumber method after that the following actions are available:

CANCEL - 8 - Cancel the activation (if the number does not match you)

MESSAGE_WAS_SENT - Inform that SMS has been sent (Mandatory to receive the full text of the sms)

After the mandatory setting of the MESSAGE_WAS_SENT status, set the variable to receive SMS using the waitSMS method with the activation parameters and the time to wait for the SMS.

After receiving the SMS, you can get it using the getFullSMS method and then display the full text using the getText () method getText()

After that, you can set the activations to the following statuses:

To activate with the status MESSAGE_WAS_SENT:

CANCEL - Cancel activation

Immediately after receiving the code:

REQUEST_ONE_MORE_CODE - Request another SMS

FINISH - Confirm SMS code and complete activation

To activate with the status REQUEST_ONE_MORE_CODE:

FINISH - Confirm SMS code and complete activation

getRentNumber: get a numbers with rent

Parameters:

countryId(Integer) - Country identifier.

service(String) - Service short name

hours(Integer)* - Rental time.

operator(String)* - The name of the mobile operator.

urlWebhook(String)* - link for webhook (Not considered by default)

What is webHook?

* optional parameter. If not specified, the default will be

GetRentServicesAndCountriesRun: get services and countries for rent

Parameters:

countryId(Integer) - Country identifier.

operatorSet(Set) - Set of cellular operators

hours(Integer)* - Rental time.

* optional parameter. If not specified, the default will be

GetRentStatusJava: get status for rent

Parameters:

rentId(Integer) - The identifier of the rented number.

Instead of rentId, you can pass the resulting class object SMSActivateRentActivation after using the method getRentNumber

RETURN TYPE:

SMSActivateRentStatus

<?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." 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
$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']." rub. 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 $sms->createTaskForCall(958874106, 78006007664);//Create a request for an outgoing call by activation No. 958874106, call the number 78006007664 $sms->getOutgoingCalls('2022-07-27');//View call requests created on July 27, 2022 $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
                    
                        
                            import ru.sms_activate.SMSActivateApi;//Inclusion of a class in a project
SMSActivateApi smsActivateApi = new SMSActivate("API_KEY");//Create an instance of the SMSActivate class
BigDecimal balance = smsActivateApi.getBalance();//Get the current account balance System.out.println("Balance: "+ balance)//Withdraw the received balance SMSActivateGetBalanceAndCashbackResponse smsActivateGetBalanceAndCashbackResponse = smsActivateApi.getBalanceAndCashback();//Get current balance and cashback System.out.println("Cashback + balance: "+ smsActivateGetBalanceAndCashbackResponse.getBalanceAndCashback());//Withdraw the amount of balance and cashback SMSActivateActivation activation=smsActivateApi.getNumber(0,"vk")//Get activation for the Vkontakte service in Russia System.out.println(activation);//Withdraw the received activation SMSActivateGetNumbersStatusResponse smsActivateGetNumbersStatusResponse= smsActivateApi.getNumberStatus(0,null);//Get information about available services for Russia
SMSActivateServiceInfo go = smsActivateGetNumbersStatusResponse.getSMSActivateServiceInfoByShortName("go");//Getting information about numbers for the Google service
System.out.println("Short name service: " + go.getShortName();//Get the short name of the service System.out.println("count phone numbers: "+ go.getCountPhoneNumber();//Get the number of numbers for the service System.out.println(""Forwarding is available: "+ go.isForward() ? "yes" : "no"//Find out if the service has a redirect
SMSActivateActivation activation=smsActivateApi.getNumbersStatus(0,"ot",true);//Activations
smsActivateApi.setStatus(activation, SMSActivateClientStatus.MESSAGE_WAS_SENT);//Setting the MESSAGE_WAS_SENT status after sending SMS for the number
SMSActivateActivation childActivation =smsActivateApi.getAdditionalService(activation,"av");//Requesting a new activation for an additional service
System.out.println(childActivation);//Displaying information about additional activation
Set<String>operatorSet= new HashSet<>(); operatorSet.add("mts");//Adding an MTS operator to the set of operators Map<String,Boolean>serviceMap= new HashMap<>(); serviceMap.put("av",false);//Adding the Avito service to the list of services (specify true if you need a service with redirection)
SMSActivateGetMultiServiceNumberResponse multiServiceNumberResponse=smsActivateApi.getMultiServiceNumber(0, serviceMap, operatorSet);//Getting activation for multiple services
multiServiceNumberResponse.getSMSActivateActivationList().forEach(activation->{ System.out.println("Id: " + activation.getId()); System.out.println("Number: " + activation.getNumber()); System.out.println("Service name: " + activation.getShortName()); } //Displaying information about received activations
SMSActivateGetPricesResponse smsActivateGetPricesResponse=smsActivateApi.getPricesByCountryIdAndServiceShortName(0, "vk");//Obtaining a list of prices for Russia on the Vkontakte service. For a complete list of prices, use the getAllPrices () method;
SMSActivateGetPriceInfo vk=smsActivateGetPricesResponse.getPriceInfo(0, "vk");//Getting information about the Vkontakte service for Russia
System.out.println(">>> Cost: "+ vk.getCost());//Get a price for the service System.out.println(">>> count phone numbers: " + vk.getCountPhoneNumbers());//Get the number of numbers for the service
SMSActivateActivation activation=smsActivateApi.getNumber(0,"vk")//Get activation for the Vkontakte service in Russia System.out.println(activation);//Withdraw the received activation SMSActivateGetStatusResponse getResponse = smsActivateApi.getStatus(activation);//Getting a status for activation
System.out.println(getResponse.getSMSActivateGetStatus());//Displaying information about the activation status
smsActivateApi.setStatus(activation, SMSActivateClientStatus.MESSAGE_WAS_SENT);//Setting the MESSAGE_WAS_SENT status after receiving SMS for the number
smsActivateApi.setStatus(activation, SMSActivateClientStatus.FINISH);//Setting the FINISH status after receiving SMS for the number
SMSActivateGetCountriesResponse smsActivateGetCountriesResponse =smsActivateApi.getCountries();//Getting a list of countries with information SMSActivateCountryInfo countryInfo = smsActivateGetCountriesResponse.get(0)//Getting information about the first country on the list
System.out.println("Russian name: "+countryInfo.getRussianName();//Display the Russian name of the country System.out.println("English name: "+countryInfo.getEnglishName();//Display the Russian name of the country System.out.println("Support multi-service: "+ countryInfo.isSupportMultiService() ? "yes" : "no"//Show if the country supports multi-services
SMSActivateGetQiwiRequisitesResponse smsActivateGetQiwiRequisitesResponse=smsActivateApi.getQiwiRequisites();//Getting information about Qiwi System.out.println("Comment: "+smsActivateGetQiwiRequisitesResponse.getComment()//Displaying a comment to the details System.out.println("Wallet: "+smsActivateGetQiwiRequisitesResponse.getWallet());//Wallet withdrawal System.out.println("Up to date: "+smsActivateGetQiwiRequisitesResponse.getUpToDate());//Replenishment date display SMSActivateActivation activation=smsActivateApi.getNumber(0,"vk")//Get activation for the Vkontakte service in Russia smsActivateApi.setStatus(activation, SMSActivateClientStatus.MESSAGE_WAS_SENT);//Setting the MESSAGE_WAS_SENT status after sending SMS for the number String code=smsActivateApi.waitSms(activation,2)//Set receiving sms within 2 minutes if(code == null) { smsActivateApi.setStatus(activation, SMSActivateClientStatus.CANCEL);//Setting the CANCEL status if sms has not arrived }
else{
SMSActivateGetFullSmsResponse smsActivateGetFullSmsResponse=smsActivateApi.getFullSms(activation)//Receiving sms text System.out.println("Full SMS: "+smsActivateGetFullSmsResponse.getText());//SMS text output }
SMSActivateRentActivation rentActivation= smsActivateApi.getRentNumber(0, "vk", 6);//Getting a number with rent System.out.println(">> ID: "+rentActivation.getId());//Activation ID withdrawal System.out.println(">> Number: "+rentActivation.getId());//Displaying the activation number System.out.println(">> End date: "+rentActivation.getId());//Displaying the activation expiration date SMSActivateGetRentServicesAndCountriesResponse smsActivateGetRentServicesAndCountriesResponse= smsActivateApi.getRentServicesAndCountries(0, null, 4);//Obtaining information on services and countries that support rental
smsActivateGetRentServicesAndCountriesResponse.getAllRentServices().forEach((serviceShortName, smsActivateRentService)->{ System.out.println("Service shortname: " + serviceShortName);
System.out.println(" count phone numbers: " + smsActivateRentService.getCountPhoneNumbers());
System.out.println(">> Cost: " + smsActivateRentService.getCost()); }
//Displaying information about received services
SMSActivateRentActivation rentActivation= smsActivateApi.getRentNumber(0, "vk");//Getting a number with rent SMSActivateGetRentStatusResponse smsActivateGetRentStatusResponse= smsActivateApi.getRentStatus(rentActivation);//Getting activation status System.out.println(">> Count sms: "+ smsActivateGetRentStatusResponse.getCountSms());//Displaying the number of sms on the rented number