All Products
Search
Document Center

Expenses and Costs:QueryInstanceBill

更新时间:Oct 28, 2025

Queries the usage summary of all product instances or billable items for an account in a billing cycle. This operation has been upgraded to DescribeInstanceBill. This operation no longer queries data beyond the 50,000th row.

Operation description

API description

Note the following when you call this operation:

  • The API for instance bills has been upgraded. We recommend that you use the new operation DescribeInstanceBill. This operation no longer supports querying data beyond the 50,000th row.

  • Instance bills are generated based on split billing data. A delay of about one day may occur.

  • Instance information may change within a billing cycle. The instance Config and Spec in the monthly summary reflect the information at the time the record was generated. For more information, see the corresponding detailed bill.

  • Data for Alibaba Cloud Communications products is available from June 2020. Data for HiChina products is available from November 2020.

  • For the international site (alibabacloud.com), select Singapore as the endpoint.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

bss:DescribeBillList

get

*All Resource

*

  • bssapi:ProductCode

  • bssapi:ProductType

None

Request parameters

Parameter

Type

Required

Description

Example

BillingCycle

string

Yes

The billing cycle in YYYY-MM format. Data from the last 18 months is supported.

2020-03

ProductCode

string

No

The code of the product.

rds

ProductType

string

No

The type of the product. Required when the ProductCode parameter is set to the code of an Alibaba Cloud Marketplace product.

rds

SubscriptionType

string

No

The subscription type. Valid values:

  • Subscription: subscription.

  • PayAsYouGo: pay-as-you-go.

Note

This parameter must be used with the ProductCode parameter.

PayAsYouGo

IsBillingItem

boolean

No

Specifies whether to query data by billable item.

  • false: The data is consistent with the bill details on the Instance tab of the Bills page in the User Center.

  • true: The data is consistent with the bill details on the Billable Item tab of the Bills page in the User Center.

Default value: false.

false

PageNum

integer

No

The page number. Default value: 1.

1

PageSize

integer

No

The number of entries per page. Default value: 20. Maximum value: 300.

20

IsHideZeroCharge

boolean

No

Specifies whether to filter out bills for which the pretax gross amount (PretaxGrossAmount) and pretax amount (PretaxAmount) are both 0. Valid values:

  • false.

  • true.

false

BillingDate

string

No

The billing date. This parameter is required only when the Granularity parameter is set to DAILY. The value must be in the YYYY-MM-DD format.

2020-03-03

Granularity

string

No

The granularity at which to query bills. Valid values:

  • MONTHLY: queries bills by month. The data is consistent with the bill details on the Billing Cycle tab of the Bills page in the User Center.

  • DAILY: queries bills by day. The data is consistent with the bill details on the By Day tab of the Bills page in the User Center.

If you set this parameter to DAILY, you must also specify the BillingDate parameter.

MONTHLY

BillOwnerId

integer

No

The ID of the account that owns the resources. This account is the actual user of the resources.

122

Response elements

Element

Type

Description

Example

object

Code

string

The status code.

Success

Message

string

The error message.

Successful!

RequestId

string

The request ID.

79EE7556-0CFD-44EB-9CD6-B3B526E3A85F

Success

boolean

Indicates whether the call was successful.

true

Data

object

The returned data.

PageNum

integer

The page number.

1

BillingCycle

string

The billing cycle in YYYY-MM format.

2020-03

AccountID

string

The account ID.

185xxxx3489

PageSize

integer

The number of entries per page.

20

TotalCount

integer

The total number of records.

2

AccountName

string

The user account.

test@test.aliyunid.com

Items

object

Item

array<object>

The bill details.

object

BillingDate

string

The billing date. This parameter is returned only when the Granularity parameter is set to DAILY. The value is in the YYYY-MM-DD format.

2020-03

InstanceConfig

string

The detailed configuration of the instance.

CPU:12

InternetIP

string

The public IP address.

34.xx.x.x

Item

string

The type of the bill. Valid values:

  • SubscriptionOrder

  • PayAsYouGoBill

  • Refund

  • Adjustment

PayAsYouGoBill

Tag

string

The tag.

tag

InstanceID

string

The instance ID.

i-kjhdskjgshfdlkjfdh

Currency

string

The currency. Valid values:

  • CNY.

  • USD.

  • JPY.

CNY

DeductedByCashCoupons

number

0

SubscriptionType

string

The subscription type. Valid values:

  • Subscription: subscription.

  • PayAsYouGo: pay-as-you-go.

Note

This parameter must be used with the ProductCode parameter.

PayAsYouGo

InstanceSpec

string

The instance type.

ecs.sn1ne.3xlarge

DeductedByCoupons

number

The amount deducted using coupons.

0

BillingItem

string

The billable item. This parameter is returned only when IsBillingItem is set to true.

其他

Region

string

The region.

杭州

OutstandingAmount

number

0

CostUnit

string

The cost center.

未分配

ListPriceUnit

string

The unit of the list price. This parameter is valid only when isBillingItem is set to true.

ResourceGroup

string

The resource group.

默认资源组

PipCode

string

The product code. This is the same as the product code in the bills in the User Center.

rds

ServicePeriodUnit

string

The unit of the service duration.

PretaxAmount

number

The pretax amount.

0

CommodityCode

string

The commodity code. This is the same as the product detail code in the User Center.

rds

ProductName

string

The product name.

云数据库RDS

AdjustAmount

number

The amount deducted using credit refunds.

0

NickName

string

The instance nickname.

test

ProductDetail

string

The product details.

云数据库RDS

Usage

string

The usage. This parameter is valid only when isBillingItem is set to true.

100

IntranetIP

string

The internal IP address.

192.xx.xx.xx

OwnerID

string

The account ID of the RAM user. This parameter is returned in a multi-account payment scenario.

169***013

DeductedByPrepaidCard

number

0

UsageUnit

string

The unit of the usage. This parameter is valid only when isBillingItem is set to true.

GB

PaymentAmount

number

0

InvoiceDiscount

number

The discount amount.

0

DeductedByResourcePackage

string

The amount deducted using resource packages.

NULL

ProductType

string

The product type.

rds

ServicePeriod

string

The service duration.

10

Zone

string

The zone.

cn-hangzhou-h

ListPrice

string

The list price. This parameter is valid only when isBillingItem is set to true.

100

PretaxGrossAmount

number

The pretax gross amount.

0

CashAmount

number

The amount paid in cash. This amount does not include the amount deducted using credit refunds.

0

ProductCode

string

The product code.

rds

BillingType

string

The billing method.

其它

Examples

Success response

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": "其他",
          "Region": "杭州",
          "OutstandingAmount": 0,
          "CostUnit": "未分配",
          "ListPriceUnit": "元",
          "ResourceGroup": "默认资源组",
          "PipCode": "rds",
          "ServicePeriodUnit": "秒",
          "PretaxAmount": 0,
          "CommodityCode": "rds",
          "ProductName": "云数据库RDS",
          "AdjustAmount": 0,
          "NickName": "test",
          "ProductDetail": "云数据库RDS",
          "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": "其它"
        }
      ]
    }
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.