Rental History Retrieval
The getRentHistory method is used to retrieve a complete list of all rented virtual numbers associated with the account through the SMS.online API. It enables automation of usage analysis for long-term rentals and tracking renewal costs.
This method provides detailed rental information, including start date, duration, phone number, rental status, and renewal cost. It allows you to monitor current and completed rentals, as well as assess expenses for prolonged use of numbers.
A successful request returns a structured object with a list of all rented numbers, including a unique rental ID, start date, duration, phone number, current status, and rental amount. This method is ideal for analytics systems and monitoring rental expenses.
Example Request:
Input Data
Parameter | Required | Note | Description |
---|---|---|---|
Yes | See in profile settings API Key | API key provides access to paid services | |
Yes | getRentHistory | Method name | |
No | Timestamp in Unix Timestamp format | From which date to take activations (limited to 30 days) | |
No | Timestamp in Unix Timestamp format | Until which date to take activations (limited to 30 days) | |
No | Numeric value | Offset of the first element returned in the response (default is 0) | |
No | Numeric value | Number of elements returned in the response (default is 50, maximum 100) |
Server Response
[ { "id": 635468024, "date": "2022-11-12 15:58:39", "phone": "79918529716", "sms": "["Your sms code"]", "cost": 100 "status": "4" } ]
Example Code
const api_key = "API_KEY"; # Replace 'API_KEY' with your actual API key.try {const response = await fetch(`https://api.sms.onlinestubs/handler_api.php?api_key=${api_key}&action=getRentHistory`);# 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 date |