Queries the billing information about instances or billable items in a billing cycle.
Operation description
- Instance bills are generated after the total bill is split. In most cases, the instance bills do not include data generated on the last day of the specified billing cycle.
- The instance information may change during the billing cycle. The instance configurations and types in monthly bills are subject to the point in time when you query bills. For more information, see the corresponding bill details.
- You can query data generated after June 2020 for Cloud Communications services. You can query data generated after November 2020 for Alibaba Cloud Domains.
Debugging
Authorization information
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
BillingCycle | string | Yes | The billing cycle. Specify the parameter in the YYYY-MM format. Only the latest 18 month billing cycle is supported. | 2020-03 |
ProductCode | string | No | The code of the service. | rds |
ProductType | string | No | The type of the service. | rds |
SubscriptionType | string | No | The billing method. Valid values:
| PayAsYouGo |
IsBillingItem | boolean | No | Specifies whether to query data by billable items. Valid values:
Default value: false. | false |
NextToken | string | No | The token that is used to indicate the position where the results for the current call start. The parameter must be left empty or set to the value of the NextToken parameter that is returned from the last call. Otherwise, an error is returned. If the parameter is left empty, data is queried from the first item. | CAESEgoQCg4KCm |
MaxResults | integer | No | The maximum number of entries to return. Default value: 20. Maximum value: 300. | 20 |
IsHideZeroCharge | boolean | No | Specifies whether to filter bills if both the pretax gross amount and pretax amount are 0. Valid values:
| false |
BillingDate | string | No | The billing date. This parameter is required only when the Granularity parameter is set to DAILY. Format: YYYY-MM-DD. | 2020-03-02 |
Granularity | string | No | The granularity at which bills are queried. Valid values:
The BillingDate parameter is required if you set the Granularity parameter to DAILY. | MONTHLY |
BillOwnerId | long | No | The ID of the member. If you specify this parameter, the bills of the member are queried. If you do not specify this parameter, the bills of the current account are queried by default. | 122 |
InstanceID | string | No | The ID of the instance. | abc |
PipCode | string | No | The code of the service. The code is the same as that in Cost Center. | rds |
Response parameters
Examples
Sample success responses
JSON
format
{
"Code": "Success",
"Message": "Successful!",
"RequestId": "79EE7556-0CFD-44EB-9CD6-B3B526E3A85F",
"Success": true,
"Data": {
"NextToken": "CAESEgoQCg4KCm",
"BillingCycle": "2020-03",
"MaxResults": 20,
"AccountID": "122",
"TotalCount": 20,
"AccountName": "test@test.aliyunid.com",
"Items": [
{
"BillingDate": "2020-03-20",
"InstanceConfig": "CPU:12",
"InternetIP": "34.xx.x.x\t",
"Item": "PayAsYouGoBill",
"Tag": "key:testKey value:testValue; key:testKey1 value:testValues1",
"InstanceID": "i-dadada",
"Currency": "CNY",
"BillAccountName": "test@test.aliyunid.com",
"DeductedByCashCoupons": 0.1,
"SubscriptionType": "PayAsYouGo",
"BizType": "trusteeship",
"InstanceSpec": "ecs.sn1ne.3xlarge\t",
"DeductedByCoupons": 0.1,
"BillingItem": "Bandwidth\n",
"BillingItemCode": "disk",
"Region": "China (Hangzhou)\n",
"OutstandingAmount": 0.1,
"CostUnit": "Not allocated\n",
"ListPriceUnit": "CNY\n",
"ResourceGroup": "Default resource group\n",
"PipCode": "rds",
"ServicePeriodUnit": "Second\n",
"PretaxAmount": 0.1,
"CommodityCode": "rds",
"ProductName": "ApsaraDB RDS\n",
"AdjustAmount": 0,
"NickName": "test",
"ProductDetail": "ApsaraDB RDS\n",
"Usage": "100",
"IntranetIP": "192.xx.xx.xx",
"OwnerID": "123",
"DeductedByPrepaidCard": 0.1,
"UsageUnit": "GB",
"BillAccountID": "122",
"PaymentAmount": 0.1,
"InvoiceDiscount": 0.1,
"DeductedByResourcePackage": "0.1",
"ProductType": "rds",
"ServicePeriod": "3600",
"Zone": "Hangzhou Zone B\n",
"ListPrice": "100",
"PretaxGrossAmount": 0.1,
"CashAmount": 0,
"ProductCode": "rds",
"BillingType": "Other\n",
"ItemName": "iZ28bycvyb4Z"
}
]
}
}
Error codes
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2023-12-13 | The request parameters of the API has changed | View Change Details |
2021-09-23 | The response structure of the API has changed | View Change Details |