Queries account spending within a billing cycle and aggregates the data by resource owner.
Operation description
Data for the current month is for reference only. Do not use it for reconciliation. The final bill for the current month is available to view or export after 12:00 on the third day of the next month. This delay accounts for mid-month events such as delayed billing, refunds, bill adjustments, and overdue payment write-offs.
Data from the last 18 months is available.
Billing data is updated 24 hours after actual resource consumption. Information related to instance IDs, such as instance configurations, instance types, instance nicknames, resource groups, public IP addresses, private IP addresses, and zones, is updated with a 48-hour delay.
Billing data does not include the costs of attached resources, such as domain names, buckets, and elastic IP addresses (EIPs), for products such as CDN, OSS, and Internet Shared Bandwidth. To view statistics that include data for attached resources, go to Split Bill.
For Alibaba Cloud Communications products, detailed data is available only from June 2020 onwards. For HiChina products, such as Domain Names and trademarks, detailed data is available only from November 2020 onwards.
Each account is limited to 10 queries per second. If a timeout occurs, retry the request.
Try it now
Test
RAM authorization
Action | Access level | Resource type | Condition key | Dependent action |
bss:QueryAccountBill | get | *All Resource
|
| None |
Request parameters
Parameter | Type | Required | Description | Example |
BillingCycle | string | Yes | The billing date. Format: YYYY-MM. | 2018-07 |
PageNum | integer | No | The page number. The default value is 1. | 1 |
PageSize | integer | No | The number of entries per page. The default value is 20. The maximum value is 300. | 20 |
IsGroupByProduct | boolean | No | Specifies whether to aggregate the results by product code.
Default value: false. | false |
ProductCode | string | No | The product code. | rds |
BillOwnerId | integer | No | The ID of the account that owns and actually uses the resource. | 122 |
Granularity | string | No | The granularity for querying the bill. Valid values:
Note If you set | MONTHLY |
BillingDate | string | No | The billing date. This parameter is required only when you set Granularity to DAILY. Format: YYYY-MM-DD. | 2021-06-01 |
Response elements
Element | Type | Description | Example |
object | |||
Code | string | The status code. | Success |
Message | string | The error message. | Successful! |
RequestId | string | The request ID. | 3BFC23FE-A182-4D96-A1E4-7521B30B8E43 |
Success | boolean | Indicates whether the request was successful. | true |
| Data | object | The returned data. | |
PageNum | integer | The page number. | 1 |
BillingCycle | string | The billing cycle. Format: YYYY-MM. | 2020-03 |
AccountID | string | The account ID. | 1857xxxxx489 |
PageSize | integer | The number of entries displayed per page. | 20 |
TotalCount | integer | The total number of records. | 1 |
AccountName | string | The account name. | test@test.aliyunid.com |
| Items | object | ||
| Item | array<object> | The bill details. | |
object | |||
PipCode | string | The product code. This is the same as the product code in the User Center. | rds |
BillingDate | string | The billing date. | 2021-03-01 |
ProductName | string | The product name. Note This parameter is returned only when IsGroupByProduct is set to true. | rds |
OwnerName | string | The AccountName of the resource owner. This is used in multi-account payment scenarios. | aligzncloudtest2 |
Currency | string | The currency. Valid values:
| CNY |
BillAccountName | string | The name of the account to which the bill belongs. | test@test.aliyunid.com |
SubscriptionType | string | The subscription type of the product.
Note This parameter is returned only when IsGroupByProduct is set to true. | PayAsYouGo |
BizType | string | The business type. | trusteeship |
OwnerID | string | The AccountID of the resource owner. This is used in multi-account payment scenarios. | 325434254 |
DeductedByCoupons | number | The amount deducted by coupons. | 0 |
BillAccountID | string | The ID of the account to which the bill belongs. | 1857xxxxx489 |
InvoiceDiscount | number | The discount amount. | 0 |
CostUnit | string | The cost center. | 未分配 |
PretaxGrossAmount | number | The pretax gross amount. | 0 |
ProductCode | string | The product code. Note This parameter is returned only when IsGroupByProduct is set to true. | rds |
Examples
Success response
JSON format
{
"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",
"BillingDate": "2021-03-01",
"ProductName": "rds",
"OwnerName": "aligzncloudtest2",
"Currency": "CNY",
"BillAccountName": "test@test.aliyunid.com",
"SubscriptionType": "PayAsYouGo",
"BizType": "trusteeship",
"OwnerID": "325434254",
"DeductedByCoupons": 0,
"BillAccountID": "1857xxxxx489",
"InvoiceDiscount": 0,
"CostUnit": "未分配",
"PretaxGrossAmount": 0,
"ProductCode": "rds"
}
]
}
}
}Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.