Request available countries and services
The getRentPrices method is used to obtain the current list of countries and services available for renting virtual numbers through the SMS.online API. It automates the selection of country and service when renting a number.
This method is recommended for systems that require dynamic generation of destination lists before creating a rental request. By using this method, you can get an up-to-date list of countries and their associated services for integration into automated processes.
A successful request returns structured data, including a list of countries, supported services, and operators. This enables flexible rental selection in automated systems.
Example Request:
Input Data
Parameter | Required | Note | Description |
---|---|---|---|
Yes | See in profile settings API Key | API key provides access to paid services | |
Yes | getRentPrices | Method name | |
Yes | See the list of countries in the left menu | Country whose number needs to be obtained |
Server Response
JSON
{ "status": "success", "values": { "Страна": { "Сервис": { "cost": Стоимость, "count": Количество } } } }
Example Code
const api_key = "API_KEY"; # Replace 'API_KEY' with your actual API key.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=getRentPrices&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 | |
No numbers left for this country |