This page provides a comprehensive reference for all features available via the HTTP interface for querying your balance.
The HTTP API allows you to integrate your system (client) with EasySendSMS using HTTP or HTTPS protocols to request and check your account balance securely using SSL encryption.
The client issues either a GET or POST request to the EasySendSMS HTTP API, supplying the required parameters. Our system responds with a text-format HTTP response that indicates the account balance.
This API call retrieves the current credit balance in your account.
https://api.easysendsms.app/balanceMethod: GET, POST
The following parameters must be included in your API request:
| Parameter | Description | Required |
|---|---|---|
| Username | Your EasySendSMS username. | Yes |
| Password | Your EasySendSMS account password or your API password (if set in your account settings). | Yes |
The HTTP response from our system will contain the following information:
If the balance request is successful, the response will contain your account balance.
Example:
1000 (Balance)If the balance query fails, the response will return ERROR: {Error code}.
Example:
1002Below is an example of a GET request using the HTTP interface:
(Ensure all parameter values are URL-encoded)
Request URL:
https://api.easysendsms.app/balance?username=testuser&password=secretOutput:
1000 (Balance)To maintain a high quality of service, EasySendSMS API enforces rate limits for its balance query API.
The default request rate limit is 2 requests per minute per account per IP address. The API will reject requests exceeding this limit with a 429 Too Many Requests HTTP status.
You can retry the request after 60 seconds.
The following table outlines possible error codes you may encounter:
| Code | Description |
|---|---|
| 1001 | Invalid username or password. This indicates the parameter was not provided or was left blank. |
| 1002 | Authentication failed. |
| 1007 | Inactive or expired demo account. |
Use the following examples to call the API from different programming languages:
var options = new RestClientOptions("")
{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("https://api.easysendsms.app/balance", Method.Post);
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
request.AddParameter("username", "username");
request.AddParameter("password", "password");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content); $curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.easysendsms.app/balance',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => 'username=username&password=password',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/x-www-form-urlencoded',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://api.easysendsms.app/balance")
.header("Content-Type", "application/x-www-form-urlencoded")
.field("username", "username")
.field("password", "password")
.asString();import http.client
conn = http.client.HTTPSConnection("api.easysendsms.app")
payload = 'username=username&password=password'
headers = {
'Content-Type': 'application/x-www-form-urlencoded'
}
conn.request("POST", "/balance", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))