Logo Site EngageLab Mark Colored TransparentDocument
Search

Query Balance

If you need to get the available balance of your EngageLab SMS account in real-time, you can call this API. It will return the general balance, gift balance, and total balance of your account.

Request URL

GET https://smsapi.engagelab.com/v1/balance

Call Authentication

Please refer to Call Authentication to learn how to authenticate API requests.

Request Example

Request Header

GET /v1/balance HTTP/1.1 Authorization: Basic amlndWFuZ2RldjpkZXZfc2VjcmV0
              
              GET /v1/balance  HTTP/1.1
Authorization: Basic amlndWFuZ2RldjpkZXZfc2VjcmV0

            
This code block in the floating window

Request Body

None

Request Parameters

None

Response Parameters

Success Response

The HTTP status code is 200, and the response body contains the following fields:

Field Type Option Description
balance10000 Integer Required General balance, an integer value multiplied by 10000
gift_balance10000 Integer Required Gift balance, an integer value multiplied by 10000
balance Number Required General balance, floating point
gift_balance Number Required Gift balance, floating point
total_balance10000 Integer Required Total balance, equal to the sum of general and gift balances, an integer value multiplied by 10000
total_balance Number Required Total balance, equal to the sum of general and gift balances, floating point
{ "balance10000": 123456, "gift_balance10000": 20000, "balance": 12.3456, "gift_balance": 2, "total_balance10000": 143456, "total_balance": 14.3456 }
              
              {
    "balance10000": 123456,
    "gift_balance10000": 20000,
    "balance": 12.3456,
    "gift_balance": 2,
    "total_balance10000": 143456,
    "total_balance": 14.3456
}

            
This code block in the floating window

Development Suggestion It is recommended that callers prioritize using the balance10000, gift_balance10000, and total_balance10000 fields to format the balance themselves to avoid floating-point precision issues.

Error Response

The HTTP status code is 4xx or 5xx, and the response body contains the following fields:

Field Type Option Description
code Integer Required Error code, see error code descriptions
message String Required Error details
{ "code": 2001, "message": "invalid token" }
              
              {
    "code": 2001,
    "message": "invalid token"
}

            
This code block in the floating window

Error Codes

Error Code HTTP Code Description
1000 500 Internal error, please try again later
2001 401 Authentication failed, incorrect token provided, or the merchant corresponding to the token does not exist
2002 401 Authentication failed, token expired or disabled
2002 403 Merchant has been deleted
Icon Solid Transparent White Qiyu
Contact Sales