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
Parameter | Required | Note | Description |
---|---|---|---|
Yes | See in profile settings API Key | API key provides access to paid services | |
Yes | getNumber | 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 | |
No | See the list of operators in the left menu | Mobile operator whose number needs to be obtained | |
No | See in Referral Program | Referral ID | |
No | Numeric value | Activation type: 0 - SMS (default), 1 - by number, 2 - by voice |
Server Response
ACCESS_NUMBER:ID:NUMBERNumber 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 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 | |
Account is blocked | |
No available numbers | |
Balance not found |