All Products
Search
Document Center

BSS OpenAPI:QueryAccountBill

Last Updated:Mar 01, 2024

Queries the bills of your Alibaba Cloud account within a billing cycle. You can summarize the bills by resource owner.

Operation description

Before you call this operation, take note of the following items:

  • Account bills are summarized based on instance bills. In most cases, the account bills do not include the data generated on the last day of the specified period.
  • You can query the data generated in June 2020 or later for Cloud Communications services. However, the query results do not include the data of Alibaba Cloud Domains.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
bssapi:QueryAccountBillRead
  • All Resources
    *
  • bssapi:ProductCode
  • bssapi:ProductType
none

Request parameters

ParameterTypeRequiredDescriptionExample
BillingCyclestringYes

The billing cycle. Format: YYYY-MM.

2018-07
PageNumintegerNo

The number of the page to return. Default value: 1.

1
PageSizeintegerNo

The number of entries to return on each page. Default value: 20. Maximum value: 300.

20
IsGroupByProductbooleanNo

Specifies whether to summarize bills based on service codes. Valid values:

  • true: summarizes bills based on service codes.
  • false: does not summarize bills based on service codes.

Default value: false.

false
ProductCodestringNo

The code of the service.

rds
BillOwnerIdlongNo

The ID of the member. If you specify a value for this parameter, you can query the bills of the specified member. If you leave this parameter empty, the bills of the current account are queried by default.

122
GranularitystringNo

The granularity at which bills are queried. Valid values:

  • MONTHLY: queries bills by month. The data queried is consistent with the data that is displayed for the specified billing cycle on the Billing Details tab of the Bill Details page in User Center.
  • DAILY: queries bills by day. The data queried is consistent with the data that is displayed for the specified day on the Billing Details tab of the Bill Details page in User Center.

You must set the BillingDate parameter before you can set the Granularity parameter to DAILY.

Monthly
BillingDatestringNo

The billing date. This parameter is required only if the Granularity parameter is set to DAILY. Format: YYYY-MM-DD.

2021-06-01

Response parameters

ParameterTypeDescriptionExample
object
Codestring

The status code returned.

Success
Messagestring

The message returned.

Successful!
RequestIdstring

The ID of the request.

3BFC23FE-A182-4D96-A1E4-7521B30B8E43
Successboolean

Indicates whether the request is successful.

true
Dataobject

The data returned.

PageNuminteger

The page number of the returned page.

1
BillingCyclestring

The billing cycle. Format: YYYY-MM.

2020-03
AccountIDstring

The ID of your Alibaba Cloud account.

1857xxxxx489
PageSizeinteger

The number of entries returned per page.

20
TotalCountinteger

The total number of returned entries.

1
AccountNamestring

The name of the Alibaba Cloud account.

test@test.aliyunid.com
Itemsobject []

The details of the bills.

PipCodestring

The code of the service. The service code is consistent with that displayed in User Center.

rds
BillingDatestring

The billing date.

2021-03-01
ProductNamestring

The name of the service.

Note A value is returned only if the IsGroupByProduct parameter is set to true.
rds
OwnerNamestring

The name of the member.

aligzncloudtest2
Currencystring

The type of the currency. Valid values:

  • CNY
  • USD
  • JPY
CNY
BillAccountNamestring

The name of the account to which the bill belongs.

test@test.aliyunid.com
SubscriptionTypestring

The billing method. Valid values:

  • Subscription: the subscription billing method
  • PayAsYouGo: the pay-as-you-go billing method
Note A value is returned only if the IsGroupByProduct parameter is set to true.
PayAsYouGo
BizTypestring

The business type.

trusteeship
OwnerIDstring

The ID of the member.

325434254
DeductedByCouponsfloat

The amount deducted by using coupons.

0
BillAccountIDstring

The ID of the account to which the bill belongs.

1857xxxxx489
InvoiceDiscountfloat

The discount amount.

0
CostUnitstring

The cost center.

Not allocated
PretaxGrossAmountfloat

The pretax gross amount.

0
ProductCodestring

The code of the service.

Note A value is returned only if the IsGroupByProduct parameter is set to true.
rds

Examples

Sample success responses

JSONformat

{
  "Code": "Success",
  "Message": "Successful!",
  "RequestId": "3BFC23FE-A182-4D96-A1E4-7521B30B8E43",
  "Success": true,
  "Data": {
    "PageNum": 1,
    "BillingCycle": "2020-03",
    "AccountID": "1857xxxxx489",
    "PageSize": 20,
    "TotalCount": 1,
    "AccountName": "test@test.aliyunid.com",
    "Items": {
      "Item": [
        {
          "PipCode": "rds",
          "PretaxAmount": 0,
          "BillingDate": "2021-03-01",
          "ProductName": "rds",
          "AdjustAmount": 0,
          "OwnerName": "aligzncloudtest2",
          "Currency": "CNY",
          "BillAccountName": "test@test.aliyunid.com",
          "SubscriptionType": "PayAsYouGo",
          "DeductedByCashCoupons": 0,
          "BizType": "trusteeship",
          "OwnerID": "325434254",
          "DeductedByPrepaidCard": 0,
          "DeductedByCoupons": 0,
          "BillAccountID": "1857xxxxx489",
          "PaymentAmount": 0,
          "InvoiceDiscount": 0,
          "OutstandingAmount": 0,
          "CostUnit": "Not allocated\n",
          "PretaxGrossAmount": 0,
          "CashAmount": 0,
          "ProductCode": "rds"
        }
      ]
    }
  }
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-11-21API Description Updatesee changesets
Change itemChange content
API DescriptionAPI Description Update.