Account Balance Retrieval
The getBalance method is used to retrieve the current account balance through the SMS.online API. It automates the process of checking available funds, ensuring expense management and service reliability.
This method is recommended for systems that require regular account status checks and timely top-ups. It helps prevent service disruptions due to insufficient funds.
A successful request returns an object containing information about the current balance, including available funds at the time of the request. This method is particularly useful in automated systems that need real-time balance monitoring.
Example Request:
Input Data
Parameter | Required | Note | Description |
---|---|---|---|
Yes | See in profile settings API Key | API key provides access to paid services | |
Yes | getBalance | Method name |
Server Response
ACCESS_BALANCE:BALANCEBALANCE - Account balance in dollars
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=getBalance`);# 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 |