Order Number

The getNumber method is used to obtain a disposable virtual number via the SMS.online API. It allows you to automatically request a number for verification on third-party platforms that require SMS confirmation. The method accepts parameters for the country, service, and (optionally) the operator for precise number selection.

Upon successful execution of the request, a string with a unique activation ID and the number itself is returned. This method is designed for integration into systems for automatic registration and account verification via SMS.

Example Request:

Input Data

ParameterRequiredNoteDescription
YesSee in profile settings API KeyAPI key provides access to paid services
YesgetNumberMethod 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
NoSee the list of operators in the left menuMobile operator whose number needs to be obtained
NoSee in Referral ProgramReferral ID
NoNumeric valueActivation type: 0 - SMS (default), 1 - by number, 2 - by voice

Server Response

ACCESS_NUMBER:ID:NUMBER
Number obtained, activation ID - ID, number with country code - NUMBER

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=getNumber&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
Account is blocked
No available numbers
Balance not found