Queries the bills of instances or billable items in a billing cycle.
Operation description
- This API operation has been upgraded to DescribeInstanceBill. We recommend that you call the DescribeInstanceBill operation to query the bills of instances or billable items in a billing cycle. You can call the QueryInstanceBill operation to query a maximum of 50,000 data rows in a bill.
- Instance bills are generated after bills are split. In most cases, the instance bills do not include data generated on the last day of the specified period.
- The instance information changes within a billing cycle. The instance configurations and specifications and the time when the instance was used in the billing cycle are all recorded. For more information, see the corresponding bill details.
- You can query the data generated in June 2020 or later for Cloud Communications services, and the data generated in November 2020 or later for Alibaba Cloud Domains.
Debugging
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.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
bssapi:QueryInstanceBill | READ |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
BillingCycle | string | Yes | The billing cycle. Format: YYYY-MM. | 2020-03 |
ProductCode | string | No | The code of the service. | rds |
ProductType | string | No | The type of the service. This parameter is required if the ProductCode parameter is set to the service code of Alibaba Cloud Marketplace. | rds |
SubscriptionType | string | No | The billing method. Valid values:
** ****This parameter must be used together with the ProductCode parameter. | PayAsYouGo |
IsBillingItem | boolean | No | Specifies whether to query data by billable item. Valid values:
Default value: false. | false |
PageNum | integer | No | The number of the page to return. Default value: 1. | 1 |
PageSize | integer | No | The number of entries to return on each page. Default value: 20. Maximum value: 300. | 20 |
IsHideZeroCharge | boolean | No | Specifies whether to filter out a bill whose pretax gross amount and pretax amount are 0. Default value: false.******** Valid values:
| false |
BillingDate | string | No | The billing date. This parameter is required only if the Granularity parameter is set to DAILY. Format: YYYY-MM-DD. | 2020-03-03 |
Granularity | string | No | The granularity at which bills are queried. Valid values:
You must set the BillingDate parameter before you can set the Granularity parameter to DAILY. | MONTHLY |
BillOwnerId | long | No | 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 |
Response parameters
Examples
Sample success responses
JSON
format
{
"Code": "Success",
"Message": "Successful!",
"RequestId": "79EE7556-0CFD-44EB-9CD6-B3B526E3A85F",
"Success": true,
"Data": {
"PageNum": 1,
"BillingCycle": "2020-03",
"AccountID": "185xxxx3489",
"PageSize": 20,
"TotalCount": 2,
"AccountName": "test@test.aliyunid.com",
"Items": {
"Item": [
{
"BillingDate": "2020-03",
"InstanceConfig": "CPU:12",
"InternetIP": "34.xx.x.x",
"Item": "PayAsYouGoBill",
"Tag": "tag",
"InstanceID": "i-kjhdskjgshfdlkjfdh",
"Currency": "CNY",
"DeductedByCashCoupons": 0,
"SubscriptionType": "PayAsYouGo",
"InstanceSpec": "ecs.sn1ne.3xlarge",
"DeductedByCoupons": 0,
"BillingItem": "Other\n",
"Region": "China (Hangzhou)\n",
"OutstandingAmount": 0,
"CostUnit": "Not allocated\n",
"ListPriceUnit": "CNY\n",
"ResourceGroup": "Default resource group\n",
"PipCode": "rds",
"ServicePeriodUnit": "Seconds\n",
"PretaxAmount": 0,
"CommodityCode": "rds",
"ProductName": "ApsaraDB RDS\n",
"AdjustAmount": 0,
"NickName": "test",
"ProductDetail": "ApsaraDB RDS\n",
"Usage": "100",
"IntranetIP": "192.xx.xx.xx",
"OwnerID": "169***013",
"DeductedByPrepaidCard": 0,
"UsageUnit": "GB",
"PaymentAmount": 0,
"InvoiceDiscount": 0,
"DeductedByResourcePackage": "NULL",
"ProductType": "rds",
"ServicePeriod": "10",
"Zone": "cn-hangzhou-h",
"ListPrice": "100",
"PretaxGrossAmount": 0,
"CashAmount": 0,
"ProductCode": "rds",
"BillingType": "Other\n"
}
]
}
}
}
Error codes
For a list of error codes, visit the Service error codes.