Updated on 2024-05-17 GMT+08:00

Querying Summary Bills

You can query data from the past three years.

Function

This API can be used to query the expenditure summary bills of a customer on the self-built platform. The bills summarize the summary data by month.

Postpaid customers who have enabled the monthly settlement can log in to Billing Center to query their expenditure summary bills by referring to here.

Constraints

  • This API can be invoked using the customer AK/SK or token only.
  • If cloud_service_type_code is not specified in the request, the obtained bill is the monthly expenditure bill generated by cloud service type. That is, the total number of records (total_count) is calculated by cloud service type. Each record contains the expenditure summary of a cloud service type. In this case, resource_type_code in the response is null.
  • If cloud_service_type_code is specified in the request, the obtained bill is the monthly expenditure bill generated by resource type for a cloud service. That is, the total number of records (total_count) is calculated by resource type. Each record contains the expenditure summary of a resource type for the cloud service. In this case, resource_type_code in the response is the resource type.

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

URI

GET /v1.0/{domain_id}/customer/account-mgr/bill/monthly-sum

The following table describes the parameters.

Table 1 Path parameters

Parameter

Mandatory

Maximum Length

Description

domain_id

Yes

64

Customer account ID.

Table 2 Query parameters

Parameter

Mandatory

Type

Maximum Length

Description

cycle

Yes

String

10

Billing cycle of the expenditure summary bill, which is in YYYY-MM format (GMT+08:00 ).

cloud_service_type_code

No

String

256

Cloud service type code. For example, the cloud service type code of OBS is hws.service.type.obs. To obtain a specific service type, call the API in Querying Cloud Service Types.

  • If this parameter is not specified, the obtained bill is a monthly expenditure bill generated by cloud service.
  • If this parameter is not specified, the obtained bill is a monthly expenditure bill generated by resource type of a cloud service.

type

No

String

[0|1]

  • 0: HUAWEI CLOUD account
  • 1: Account for which the partner set a budget. This type of account is available only when a customer is associated with a partner in the reseller model.

If this parameter is not specified, the expenditure summary of the HUAWEI CLOUD account is queried by default.

This parameter cannot be left empty or set to "" or null.

enterpriseProjectId

No

String

-

Enterprise project ID.

  • 0: ID of a default project
  • – 1: The service does not support enterprise project management.

If this parameter is not included in the request or is left empty, it cannot be used as a filter criterion. If this parameter is set to null, it cannot be used as a filter criterion. This parameter cannot be set to "".

Request Message

Request Parameters

None

Example Request

GET https://bss-intl.myhuaweicloud.com/v1.0/{domain_id}/customer/account-mgr/bill/monthly-sum?cycle=2018-05&type=0 HTTP/1.1
Content-Type: application/json
X-Auth-Token: MIIPAgYJKoZIhvcNAQcCo...ggg1BBIINPXsidG9rZ

Response Message

Response Parameters

Parameter

Type

Description

error_code

String

Status code. For details, see Status Code.

This parameter is returned only when a failure occurs.

error_msg

String

Error description.

This parameter is returned only when a failure occurs.

currency

String

Currency.

USD

If the parameter is left blank, USD is used.

total_count

Integer

Number of the total records. The value must be greater than or equal to 0.

bill_sums

List<BillSumRecordInfo>

Record information. For details, see Table 3.

total_amount

Bigdecimal

Total amount (tax included).

debt_amount

Bigdecimal

Total debt.

coupon_amount

Bigdecimal

Cash coupon amount.

cashcoupon_amount

Bigdecimal

Flexi-purchase coupon amount (reserved).

storedcard_amount

Bigdecimal

Stored-value card amount (reserved).

debit_amount

Bigdecimal

Balance in the cash account.

credit_amount

Bigdecimal

Balance in the credit account.

measure_id

Integer

Unit.

  • 1: Yuan/Dollar
  • 3: Fen/Cent
Table 3 BillSumRecordInfo

Parameter

Type

Description

customer_id

String

Customer account ID.

resource_type_code

String

Resource type code. For example, the resource type code of ECS is hws.resource.type.vm.

NOTE:

If the request does not contain the cloud_service_type_code parameter, the value null is returned.

region_code

String

Cloud service region. This parameter is reserved.

cloud_service_type_code

String

Cloud service type code. For example, the cloud service type code of OBS is hws.service.type.obs.

resource_type_name

String

Resource type. For example, the resource type of ECS is Cloud Host.

cloud_service_type_name

String

Cloud service type. For example, the cloud service type of ECS is Elastic Cloud Server.

consume_time

String

Expenditure data collection period.

GMT+08:00 and format: YYYY-MM

Example: 2018-05

pay_method

String

Expenditure type.

  • If the request does not contain the parameter, cloud_service_type_code, and value 0 is returned, all resources of the service are billed in yearly/monthly mode. If value 1 is returned, all resources are billed in pay-per-use mode. If value 4 is returned, all resources are billed in savings plan-subscription mode. If the value 5 is returned, all resources are billed in savings plan-hourly billing mode. If value 6 is returned, all resources are billed in savings plan-discount mode. If an empty string is returned, all resources are billed in other-expenses mode.
  • If the request contains the parameter, cloud_service_type_code, and value 0 is returned, all resources of the service are billed in yearly/monthly mode. If value 1 is returned, all resources are billed in pay-per-use mode. If value 4 is returned, all resources are billed in savings plan-subscription mode. If the value 5 is returned, all resources are billed in savings plan-hourly billing mode. If value 6 is returned, all resources are billed in savings plan-discount mode.

consume_amount

Bigdecimal

Consumption amount, that is, the amount deducted from the customer's account. It includes the amount paid using cash coupons.

debt

Bigdecimal

Outstanding amount, that is, the amount due generated when fees are deducted from the customer account and the account balance is insufficient.

discount

Bigdecimal

Discounted amount.

measure_id

Integer

Unit.

  • 1: Yuan/Dollar
  • 3: Fen/Cent

bill_type

Integer

Bill type.

  • 0: Expenditure
  • 1: Unsubscription

account_details

List<BalanceTypePay>

Total payment amount distinguished by expenditure type and payment method of an account.

For details, see Table 4.

discount_detail_infos

List<DiscountDetailInfo>

Discounted amount details.

For details, see Table 5.

This parameter is not returned when bill_type is 1.

enterpriseProjectId

String

Enterprise project ID.

  • 0: ID of a default project
  • null: The service does not support enterprise project management.

If enterpriseProjectId is specified in the request, the bill_sums value in the response is the records by enterprise project ID.

Table 4 BalanceTypePay

Parameter

Type

Description

balance_type_id

String

Account type.

  • BALANCE_TYPE_DEBIT: Cash account
  • BALANCE_TYPE_CREDIT: Credit account
  • BALANCE_TYPE_BONUS: Bonus account (already offline)
  • BALANCE_TYPE_COUPON: Cash coupon account
  • BALANCE_TYPE_DEBIT_RATE: Discount account

deduct_amount

Bigdecimal

Deducted amount.

Unit.

Table 5 DiscountDetailInfo

Parameter

Type

Description

promotion_type

String

Discount type.

500: Specified discount for agent subscription

501: Specified exemption for agent subscription

502: Specified buy-it-now price for agent subscription

600: Contract discount rebate (commercial discount)

601: Discount specified in the channel frame contract

602: Discount specified in the designated-purpose fund contract (special commercial contract discount)

603: Discount specified in the directly signed offline contract

604: Discount specified in the authorized telemarketing contract

605: Discount specified in the commercial contract

606: Discount specified in the channel commercial contract

607: Partner authorized discount

608: Featured product discount

610: Discount amount

611: savings plan

700: Promotion discount (for promotion, available only in yearly/monthly billing scenarios)

800: Bonus

discount_amount

BigDecimal

Discounted amount.

promotion_id

String

Discount type ID. It can be a contract ID or a commerce ID.

measure_id

Integer

Unit.

  • 1: Yuan/Dollar
  • 3: Fen/Cent

The default value is 3.

Example Response

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: length
Date: response time  
{
    "error_code": "CBC.0000",
    "error_msg": "success",
    "currency": "USD",
    "total_count": 1,
    "total_amount": 10212,
    "debt_amount": 56,
    "coupon_amount": 0,
    "cashcoupon_amount": 0,
    "storedcard_amount": 0,
    "debit_amount": 10156,
    "credit_amount": 0,
    "measure_id": 3,
    "bill_sums": [
        {
            "customer_id": "7b47a4c7ec764e1a94c5c2eb1a578e77",
            "resource_type_code": "",
            "region_code": null,
            "cloud_service_type_code": "hws.service.type.ebs",
            "consume_time": "2019-12",
            "pay_method": "",
            "consume_amount": 10212,
            "debt": 56,
            "discount": 0,
            "measure_id": 3,
            "bill_type": 0,
            "account_details": [
                {
                    "balance_type_id": "BALANCE_TYPE_DEBIT",
                    "deduct_amount": 10156
                },
                {
                    "balance_type_id": "BALANCE_TYPE_CREDIT",
                    "deduct_amount": 0
                },
                {
                    "balance_type_id": "BALANCE_TYPE_BONUS",
                    "deduct_amount": 0
                },
                {
                    "balance_type_id": "BALANCE_TYPE_COUPON",
                    "deduct_amount": 0
                },
                {
                    "balance_type_id": "BALANCE_TYPE_DEBIT_RATE",
                    "deduct_amount": 0
                },
                {
                    "balance_type_id": "BALANCE_TYPE_FOREGIFT",
                    "deduct_amount": 0
                },
                {
                    "balance_type_id": "BALANCE_TYPE_BE_AVAILABLE",
                    "deduct_amount": 0
                },
                {
                    "balance_type_id": "BALANCE_TYPE_OTHER",
                    "deduct_amount": 0
                },
                {
                    "balance_type_id": "BALANCE_TYPE_RCASH_COUPON",
                    "deduct_amount": 0
                },
                {
                    "balance_type_id": "WRITEOFFDEBT",
                    "deduct_amount": 0
                },
                {
                    "balance_type_id": "BALANCE_TYPE_STORED_VALUE_CARD",
                    "deduct_amount": 0
                }
            ],
            "discount_detail_infos": [],
            "enterpriseProjectId": "0"
        }
    ]
}

Status Code

  • 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.

Status Code

Description

CBC.0000

Success.

CBC.0999

Other errors.

CBC.0151

Access denied.

CBC.0100

Parameter error.

CBC.0154

Token authentication failed.