Introduction
The Balance Inquiry API allow to check your account balance in real time. Whether you are an individual user or an enterprise, keeping track of your available SMS credits is essential for managing your messaging campaigns effectively. This guide provides an overview of the Balance Inquiry API, including its key features, how to use it, and examples for integration.
Balance Inquiry Request
To check account balance, all POST / GET request shall be submitted to following URL:Actual working example with optional parameters:
Below table explanation for all Parameters:
# | Parameter | Description | Mandatory | Example |
---|---|---|---|---|
1 | user | APP_KEY capture from Configurations > APIs > Create Connection | Yes | 7LrdwRb1Ya |
2 | pass | APP_SECRET capture from Configurations > APIs > Create Connection | Yes | aAjc9I7mW5eGzxwYs |
3 | country | Optional parameter The value shows with the current balance, the remaining total SMS can be sent in particular country. The provided value must be alpha-3 country code eg. 'MYS' or 'CHN' |
No | MYS |
* All parameters must be encoded in URL format if API triggered via GET Request |
If parameter country='MYS' is provided, the API will return 4 values as specified in HTTP Response
If country='MYS' is not provided, the API will only return 2 values without Currency and Account Balance
HTTP Response
Upon the Balance Inquiry API is called, the API will return 4 values:- status - The real-time request status, refer to following table Response Code
- description - Result of the request
- currency - Currency of your account
- balance - Balance amount in above currency
- optional - [with parameter 'country=MYS']
- country - Country provided
- credits - Available sms credits to send in particular country
Note that due to SMS are queued for process later, the return Balance is not included the charges that's going to incur later.
Response Code | Description |
---|---|
success | OK |
400 | Missing parameters or invalid field type |
401 | Invalid Username or password |
403 | Message API not enabled, requested IP not whitelisted or not enabled |
{
"status" : 401,
"description" : "Invalid Username or password"
}
Example of a successful response for balance inquiry request:{
"status" : success,
"description" : {
"currency" : "MYR",
"balance" : "935.0378",
}
}
Example of a successful response for balance inquiry request (with country='MYS'):{
"status" : success,
"description" : {
"currency" : "MYR",
"balance" : "935.0378",
"country" : "MYS"
"credits" : 11402,
}
}
Example of a missing any mandatory field(s):{
"status": 400,
"description": "Missing parameters or invalid field type"
}