Queries the consumption summary of all product instances or billable items for a user within a specific billing cycle.
Operation description
Query results for the current month are for reference only and cannot be used for reconciliation. The finalized bill for the current month is available for viewing or export after 12:00 on the 3rd of the following month. During the month, certain scenarios may occur, including but not limited to delayed billing, refunds, bill adjustments, and overdue payment write-offs.
Bill data for the current month does not include unsettled (unbilled or accumulating) pay-as-you-go data.
Data of the recent 18 months is supported.
Bill data is updated with a 24-hour delay relative to actual cost consumption. Instance ID-related information (instance configuration, instance type, instance nickname, resource group, public IP address, private IP address, and zone) is updated with a 48-hour delay.
Bill data does not provide the specific costs of individual attached resources (such as domain names, buckets, and EIPs) for attached resource-type cloud services (such as CDN, OSS, and Internet Shared Bandwidth). To obtain data that includes attached resources, use the split bill.
For Cloud Communications products, only detailed data from June 2020 and later can be queried. For Wanwang products (including domain names and trademarks), only detailed data from November 2020 and later can be queried.
The rate limit for a single user is 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 |
|
bssapi:DescribeInstanceBill |
get |
*All Resource
|
|
None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| BillingCycle |
string |
Yes |
The billing cycle in the YYYY-MM format. Only billing cycles within the recent 18 months are supported. |
2020-03 |
| ProductCode |
string |
No |
The product code. |
rds |
| ProductType |
string |
No |
The product type. |
rds |
| SubscriptionType |
string |
No |
The subscription type. Valid values:
|
PayAsYouGo |
| IsBillingItem |
boolean |
No |
Specifies whether to query data by billable item.
|
false |
| NextToken |
string |
No |
The token that indicates the position from which the current call starts to read data. The value of this parameter must be empty or the NextToken value returned in the previous call. Otherwise, an error is returned. An empty value indicates reading from the beginning. |
CAESEgoQCg4KCm |
| MaxResults |
integer |
No |
The maximum number of data records to read in the current request. Default value: 20. Maximum value: 300. |
20 |
| IsHideZeroCharge |
boolean |
No |
Specifies whether to filter out records where both the original price (PretaxGrossAmount) and the payable amount (PretaxAmount) are 0. Valid values:
|
false |
| BillingDate |
string |
No |
The billing date. This parameter is required only when Granularity is set to DAILY. Format: YYYY-MM-DD. Note
The month in the BillingDate parameter value must be consistent with the BillingCycle parameter value. For example, if BillingCycle is set to 2020-03, BillingDate must be set to 2020-03-DD. If the months are inconsistent, the query results are returned based on the time specified by BillingCycle. |
2020-03-02 |
| Granularity |
string |
No |
The granularity of the bill query. Valid values:
Note
If you set this parameter to DAILY, you must also specify BillingDate. |
MONTHLY |
| BillOwnerId |
integer |
No |
The ID of the resource ownership account. The resource ownership account is the account that actually uses the resource. |
122 |
| InstanceID |
string |
No |
The instance ID. |
abc |
| PipCode |
string |
No |
The product code, which is consistent with the product code in the User Center bills. |
rds |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| Code |
string |
The status code. |
Success |
| Data |
object |
The returned data. |
|
| AccountID |
string |
The account ID. |
122 |
| AccountName |
string |
The username. |
test@test.aliyunid.com |
| BillingCycle |
string |
The billing date in the format of YYYY-MM. |
2020-03 |
| Items |
array<object> |
The bill details. |
|
|
object |
|||
| AfterDiscountAmount |
number |
The amount after discount. This amount includes the payable amount after coupon deductions. Calculation rule: After-discount amount = List price - Discount amount. |
|
| BillAccountID |
string |
The ID of the account to which the bill belongs. |
122 |
| BillAccountName |
string |
The name of the account to which the bill belongs. |
test@test.aliyunid.com |
| BillingDate |
string |
The billing date. This parameter has a value only when Granularity is set to DAILY. Format: YYYY-MM-DD. |
2020-03-20 |
| BillingItem |
string |
The billable item. This parameter has a value only when IsBillingItem is set to true. |
Bandwidth |
| BillingItemCode |
string |
The code of the billable item. |
disk |
| BillingType |
string |
The billing method. |
Other |
| BizType |
string |
The business type. |
trusteeship |
| CommodityCode |
string |
The commodity code, which is the same as the product detail code in User Center. |
rds |
| CostUnit |
string |
The cost center. |
Unallocated |
| Currency |
string |
The currency. Valid values:
|
CNY |
| DeductedByCoupons |
number |
The amount deducted by using coupons. |
0.1 |
| DeductedByResourcePackage |
string |
The amount deducted by using resource plans. This parameter is valid only when isBillingItem is set to true. |
0.1 |
| InstanceConfig |
string |
The detailed configuration of the instance. |
CPU:12 |
| InstanceID |
string |
The instance ID. |
i-dadada |
| InstanceSpec |
string |
The instance type. |
ecs.sn1ne.3xlarge |
| InternetIP |
string |
The public IP address. |
34.xx.x.x |
| IntranetIP |
string |
The internal IP address. |
192.xx.xx.xx |
| InvoiceDiscount |
number |
The discount amount. |
0.1 |
| Item |
string |
The bill type. Valid values:
|
PayAsYouGoBill |
| ItemName |
string |
The item name. |
iZ28bycvyb4Z |
| ListPrice |
string |
The unit price. This parameter is valid only when isBillingItem is set to true. |
100 |
| ListPriceUnit |
string |
The unit of the unit price. This parameter is valid only when isBillingItem is set to true. |
CNY |
| NickName |
string |
The nickname of the instance. |
test |
| OwnerID |
string |
The account ID of the resource owner. This parameter is used in multi-account payment scenarios. |
123 |
| PipCode |
string |
The product code, which is the same as the product code on bills in User Center. |
rds |
| PretaxAmount |
number |
The payable amount. |
0.1 |
| PretaxGrossAmount |
number |
The original amount. |
0.1 |
| ProductCode |
string |
The product code. |
rds |
| ProductDetail |
string |
The product detail. |
ApsaraDB RDS |
| ProductName |
string |
The product name. |
ApsaraDB RDS |
| ProductType |
string |
The product type. |
rds |
| Region |
string |
The region. |
Hangzhou |
| ResourceGroup |
string |
The resource group. |
Default resource group |
| ServicePeriod |
string |
The service duration. |
3600 |
| ServicePeriodUnit |
string |
The unit of the service duration. |
Second |
| SubscriptionType |
string |
The subscription type. Valid values:
|
PayAsYouGo |
| Tag |
string |
The resource tag. |
key:testKey value:testValue; key:testKey1 value:testValues1 |
| Usage |
string |
The usage. Note
This parameter is valid only when isBillingItem is set to true. The usage data is the total usage across all bills within the period, not the actual purchase amount. For example, if 1 GB of storage is used and billed hourly, the usage per hour is 1 GB, and the daily aggregated bill usage is 1 GB × 24 = 24 GB. |
100 |
| UsageUnit |
string |
The usage unit. This parameter is valid only when isBillingItem is set to true. |
GB |
| Zone |
string |
The zone. |
Hangzhou Zone 1 |
| MaxResults |
integer |
The maximum number of records returned for the current request. |
20 |
| NextToken |
string |
The position from which the current call starts to read data. An empty value indicates that all data has been read. For the next call, set the NextToken request parameter to this value. |
CAESEgoQCg4KCm |
| TotalCount |
integer |
The total number of records. |
20 |
| Message |
string |
The error message. |
Successful! |
| RequestId |
string |
The request ID. |
79EE7556-0CFD-44EB-9CD6-B3B526E3A85F |
| Success |
boolean |
Indicates whether the request was successful. |
true |
Examples
Success response
JSON format
{
"Code": "Success",
"Data": {
"AccountID": "122",
"AccountName": "test@test.aliyunid.com",
"BillingCycle": "2020-03",
"Items": [
{
"AfterDiscountAmount": 0,
"BillAccountID": "122",
"BillAccountName": "test@test.aliyunid.com",
"BillingDate": "2020-03-20",
"BillingItem": "带宽",
"BillingItemCode": "disk",
"BillingType": "其它",
"BizType": "trusteeship",
"CommodityCode": "rds",
"CostUnit": "未分配\t",
"Currency": "CNY",
"DeductedByCoupons": 0.1,
"DeductedByResourcePackage": "0.1",
"InstanceConfig": "CPU:12",
"InstanceID": "i-dadada",
"InstanceSpec": "ecs.sn1ne.3xlarge\t",
"InternetIP": "34.xx.x.x\t",
"IntranetIP": "192.xx.xx.xx",
"InvoiceDiscount": 0.1,
"Item": "PayAsYouGoBill",
"ItemName": "iZ28bycvyb4Z",
"ListPrice": "100",
"ListPriceUnit": "元",
"NickName": "test",
"OwnerID": "123",
"PipCode": "rds",
"PretaxAmount": 0.1,
"PretaxGrossAmount": 0.1,
"ProductCode": "rds",
"ProductDetail": "云数据库RDS\t",
"ProductName": "云数据库RDS\t",
"ProductType": "rds",
"Region": "杭州",
"ResourceGroup": "默认资源组\t",
"ServicePeriod": "3600",
"ServicePeriodUnit": "秒",
"SubscriptionType": "PayAsYouGo",
"Tag": "key:testKey value:testValue; key:testKey1 value:testValues1",
"Usage": "100",
"UsageUnit": "GB",
"Zone": "杭州1"
}
],
"MaxResults": 20,
"NextToken": "CAESEgoQCg4KCm",
"TotalCount": 20
},
"Message": "Successful!",
"RequestId": "79EE7556-0CFD-44EB-9CD6-B3B526E3A85F",
"Success": true
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.