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

ParameterRequiredNoteDescription
YesSee in profile settings API KeyAPI key provides access to paid services
YesgetRentPricesMethod name
YesSee the list of countries in the left menuCountry 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 URL
const data = await response.json();
# Output the content of the server response
console.log(data);
} catch (err) {
# If an error occurred, output the error message
console.error(err);
}

Possible Errors

ParameterDescription
Invalid action
Invalid API key
Error in query
Time until account is unbanned
Account is inactive
No numbers left for this country