Renewing Your Virtual Number Rental
The continueRentNumber method is used to extend the rental period of a virtual number via the SMS.online API. It automates the renewal process, ensuring uninterrupted access to your rented number for receiving SMS without the risk of losing it.
This method is designed for situations where you need to keep using the same number for an extended time. You can specify the renewal period, after which the system will update the rental duration and provide confirmation of the successful renewal.
A successful request returns an object with information about the updated rental, including the number ID, new rental duration, and the amount charged. This ensures stable SMS reception throughout the extended period.
Example Request:
Input Data
Parameter | Required | Note | Description |
---|---|---|---|
Yes | See in profile settings API Key | API key provides access to paid services | |
Yes | continueRentNumber | Method name | |
Yes | Numeric value | Activation ID obtained when requesting the number | |
Yes | 4, 8, 12, 24, 72, 168, 360, 720, 2160 | Rental time in hours |
Server Response
JSON
{ "status": "success", "phone": { "id": 1049, "endDate": "2020-01-31T12:01:52", "number": "79959707564" } }
Example Code
const api_key = "API_KEY"; # Replace 'API_KEY' with your actual API key.const id = 1; # Insert the activation ID obtained when requesting the numberconst rent_time = 1; # Insert the extension time in hours from the table abovetry {const response = await fetch(`https://api.sms.onlinestubs/handler_api.php?api_key=${api_key}&action=continueRentNumber&id=${id}&rent_time=${rent_time}`);# 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 | |
Rental ID not specified | |
Number rented by someone else (incorrect rental ID) | |
Invalid extension time | |
Balance not found | |
Missing or incorrectly specified status |