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

ParameterRequiredNoteDescription
YesSee in profile settings API KeyAPI key provides access to paid services
YesgetBalanceMethod name

Server Response

ACCESS_BALANCE:BALANCE
BALANCE - 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 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