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

ParameterRequiredNoteDescription
YesSee in profile settings API KeyAPI key provides access to paid services
YesgetPricesMethod name
YesSee the list of services in the left menuService for which the number needs to be obtained
YesSee the list of countries in the left menuCountry 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 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
Invalid service name
Invalid country name