Updated on 2024-01-18 GMT+08:00

Querying the Account Balance

Function

This API can be used to query the account balance for a customer.

Customers log in to the Billing Center, switch to the Overview page, and query the account balance on the page.

Constraints

  • When a customer queries its account balance, only the AK/SK or token of the customer can be used.
  • This API is not applicable to reseller customers.

Debugging

You can debug the API in API Explorer which supports automatic authentication. API Explorer can automatically generate and debug example SDK code.

URI

GET /v2/accounts/customer-accounts/balances

Request Message

Request parameters

None

Example Request

GET https://bss-intl.myhuaweicloud.com/v2/accounts/customer-accounts/balances HTTP/1.1
Content-Type: application/json
X-Auth-Token: MIIPAgYJKoZIhvcNAQcCo...ggg1BBIINPXsidG9rZ

Response Message

Response Parameters

Parameter

Type

Value Range

Description

error_code

String

A maximum of 20 characters

Error code. For details, see Returned Values.

This parameter is returned only when a failure occurs.

error_msg

String

A maximum of 2,000 characters

Error description.

This parameter is returned only when a failure occurs.

account_balances

List<AccountBalanceV2>

-

Account balances.

For details, see Table 1.

debt_amount

BigDecimal

-

Total amount due.

measure_id

Integer

-

Fee unit.

  • 1: Dollar

currency

String

A maximum of 4 characters

Currency.

USD: US dollar

Table 1 AccountBalanceV2

Parameter

Type

Value Range

Description

account_id

String

A maximum of 64 characters

Account ID.

account_type

Integer

-

Account type.

  • 1. Balance
  • 2: Credit
  • 5: Bonus
  • 7: Deposit

amount

Bigdecimal

-

Account balance.

When account_type is set to 2, the total credit limit is returned instead of the remaining credit.

currency

String

-

Currency. The options are as follows:

USD: US dollar

designated_amount

Bigdecimal

-

Balance of earmarked funds.

credit_amount

Bigdecimal

-

Total credit limit. This field is available only for credit accounts.

measure_id

Integer

-

Measurement unit.

  • 1: Dollar

Example Response

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: length
Date: response time  
{
    "account_balances": [
        {
            "account_id": "AT001017264D6E9FF7",
            "account_type": 1,
            "amount": 0,
            "currency": "USD",
            "designated_amount": 0,
            "credit_amount": 0,
            "measure_id": 1
        },
        {
            "account_id": "AT001017264D6EA084",
            "account_type": 5,
            "amount": 0,
            "currency": "USD",
            "designated_amount": 0,
            "credit_amount": 0,
            "measure_id": 1
        }
    ],
    "debt_amount": 120.0,
    "measure_id": 1,
    "currency": "USD"
}

Returned Values

  • 4xx: This class of HTTP status code is intended for situations in which the error seems to have been caused by the client, for example, the request contains bad syntax or incorrect parameters. You must ensure the request is correct.
  • 5xx: This class of HTTP status code is intended for cases in which the Huawei Cloud server is aware that it has encountered an error or is otherwise incapable of performing the request. In this case, contact Huawei Cloud customer service.

HTTP Value

Error Code

Description

400

CBC.0100

Parameter error.

400

CBC.99000049

BindType cannot be resale.

403

CBC.0151

Access denied.

500

CBC.0999

Other errors.