Accessing Activation History
The getHistory method is used to retrieve the history of all activations of virtual numbers associated with your account through the SMS.online API. It automates the process of analyzing completed activations and monitoring service expenses.
This method provides detailed information for each activation, including the date, phone number, received SMS codes, cost, and current status. It simplifies tracking number usage and controlling costs.
A successful request returns a structured list of activations with detailed data: unique activation ID, creation date, phone number, list of received SMS messages, cost (0 for active ones), and activation status. This method is suitable for analytics and expense management systems.
Example Request:
Input Data
Parameter | Required | Note | Description |
---|---|---|---|
Yes | See in profile settings API Key | API key provides access to paid services | |
Yes | getHistory | 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
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=getHistory`);# 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 |