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

ParameterRequiredNoteDescription
YesSee in profile settings API KeyAPI key provides access to paid services
YesgetRentHistoryMethod name
NoTimestamp in Unix Timestamp formatFrom which date to take activations (limited to 30 days)
NoTimestamp in Unix Timestamp formatUntil which date to take activations (limited to 30 days)
NoNumeric valueOffset of the first element returned in the response (default is 0)
NoNumeric valueNumber of elements returned in the response (default is 50, maximum 100)

Server Response

JSON
[
  {
    "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 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 date