Request Current Pricing for Services
The getPrices method is designed to retrieve up-to-date information on the costs of renting and activating virtual numbers via the SMS.online API. This method enables automated access to pricing information for a specified country and service, allowing for accurate expense tracking in accounting systems.
Upon successful execution of the request, an object is returned with detailed information, including the service name, country, number of available numbers, and activation cost. This method is recommended for use in expense monitoring systems and calculating the cost of automated processes.
Example Request:
Input Data
Parameter | Required | Note | Description |
---|---|---|---|
Yes | See in profile settings API Key | API key provides access to paid services | |
Yes | getPrices | Method name | |
Yes | See the list of services in the left menu | Service for which the number needs to be obtained | |
Yes | See the list of countries in the left menu | Country whose number needs to be obtained |
Server Response
JSON
{ "Страна": { "Сервис": { "cost": Стоимость, "count": Количество } } }
Example Code
const api_key = "API_KEY"; # Replace 'API_KEY' with your actual API key.const service = "SERVICE"; # Replace 'SERVICE' with the service identifier. All identifiers can be found in the documentation in the list on the left menu.const country = 1; # Insert the number of the desired country. Numbers for all countries can be found in the documentation in the list on the left menu.try {const response = await fetch(`https://api.sms.onlinestubs/handler_api.php?api_key=${api_key}&action=getPrices&service=${service}&country=${country}`);# Make a GET request to the specified URLconst data = await response.json();# Output the content of the server responseconsole.log(data);} catch (err) {# If an error occurred, output the error messageconsole.error(err);}
Possible Errors
Parameter | Description |
---|---|
Invalid action | |
Invalid API key | |
Error in query | |
Time until account is unbanned | |
Account is inactive | |
Invalid service name | |
Invalid country name |