All Products
Search
Document Center

Expenses and Costs:DescribeInstanceBill

Last Updated:Oct 10, 2026

Queries the consumption summary of all product instances or billable items for a user within a specific billing cycle.

Operation description

  • The query results for the current month are for reference only and cannot be used as the basis for reconciliation. The final bill for the current month can be viewed or exported after 12:00 on the 3rd day of the next month. During the month, a few scenarios may occur, including but not limited to delayed billing, refunds, bill adjustments, and overdue payment write-offs.

  • The bill data for the current month does not include unsettled pay-as-you-go data that is unbilled or accumulating.

  • Data for the last 18 months is supported.

  • Bill data is updated with a 24-hour delay compared to actual consumption. Information related to the instance ID, such as instance configuration, instance type, instance alias, 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 split items, such as domain names, buckets, and EIPs, for split-type cloud services, such as CDN, OSS, and Internet Shared Bandwidth. To view data that includes split items, go to the split bill page.

  • For cloud communication products, only detail data from June 2020 onwards is supported. For HiChina products, including domain names and trademarks, only detail data from November 2020 onwards is supported.

  • The rate limit is 10 requests per second per user. If a timeout occurs, retry the request.

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

bssapi:DescribeInstanceBill

get

*All Resource

*

  • bssapi:ProductCode
  • bssapi:ProductCode
  • bssapi:ProductType
  • bssapi:ProductType
None

Request parameters

Parameter

Type

Required

Description

Example

BillingCycle

string

Yes

The billing cycle in the YYYY-MM format. Only the last 18 billing cycles 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:

  • Subscription: subscription.

  • PayAsYouGo: pay-as-you-go.

PayAsYouGo

IsBillingItem

boolean

No

Specifies whether to retrieve data by billable item. Valid values:

  • false (default): The data is consistent with the instance bills in Expenses and Costs > Bills > Bill Details > Instance Bills.

  • true: The data is consistent with the billable item bills in Expenses and Costs > Bills > Bill Details > Billable Item Bills.

false

NextToken

string

No

The position from which the current call starts to read data. The value must be empty or set to the NextToken value returned in the previous response. Otherwise, an error occurs. An empty value indicates that the reading starts from the beginning.

CAESEgoQCg4KCm

MaxResults

integer

No

The maximum number of data records to read in the current call. 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

  • true

false

BillingDate

string

No

The billing date. This parameter is required only when Granularity is set to DAILY. Format: YYYY-MM-DD.

Note

The value of BillingDate must be in the same month as the value of BillingCycle. 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 at which bills are queried. Valid values:

  • MONTHLY: monthly. The data is consistent with the monthly bills in Expenses and Costs > Bills > Bill Details > Monthly Bills.

  • DAILY: daily. The data is consistent with the daily bills in Expenses and Costs > Bills > Bill Details > Daily Bills.

Note

If you select DAILY, you must 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 bills of the User Center.

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 user account.

test@test.aliyunid.com

BillingCycle

string

The billing date. Format: YYYY-MM.

2020-03

Items

array<object>

The bill details.

object

AfterDiscountAmount

number

The amount after discount, including the payable amount after coupon deduction. Calculation rule: Amount after discount = List price - Discount amount.

0

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 billable item code.

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 the User Center.

rds

CostUnit

string

The cost unit.

Unallocated

Currency

string

The currency. Valid values:

  • CNY

  • USD

  • JPY

CNY

DeductedByCoupons

number

The coupon discount amount.

0.1

DeductedByResourcePackage

string

The amount deducted by resource plans. This parameter is valid only when isBillingItem is set to true.

0.1

InstanceConfig

string

The detailed instance configuration.

CPU:12

InstanceID

string

The instance ID.

i-dadada

InstanceSpec

string

The instance specifications.

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:

  • SubscriptionOrder: subscription order

  • PayAsYouGoBill: pay-as-you-go bill

  • Refund: refund

  • Adjustment: adjustment

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 instance nickname.

test

OwnerID

string

The account ID of the resource owner in multi-account payment scenarios.

123

PipCode

string

The product code, which is consistent with the product code in the bills of the 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.

Seconds

SubscriptionType

string

The subscription type. Valid values:

  • Subscription: subscription

  • PayAsYouGo: pay-as-you-go

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 sum of usage across all bills within the cycle, not the actual purchased amount. For example, if 1 GB of storage is used and billed hourly, the hourly usage 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 token that indicates the position from which the current call resumes reading. An empty value indicates that all data has been read. For the next call, set this value to the NextToken request parameter.

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 is 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": "Bandwidth",
        "BillingItemCode": "disk",
        "BillingType": "Other",
        "BizType": "trusteeship",
        "CommodityCode": "rds",
        "CostUnit": "Unallocated",
        "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": "CNY",
        "NickName": "test",
        "OwnerID": "123",
        "PipCode": "rds",
        "PretaxAmount": 0.1,
        "PretaxGrossAmount": 0.1,
        "ProductCode": "rds",
        "ProductDetail": "ApsaraDB RDS",
        "ProductName": "ApsaraDB RDS",
        "ProductType": "rds",
        "Region": "Hangzhou",
        "ResourceGroup": "Default resource group",
        "ServicePeriod": "3600",
        "ServicePeriodUnit": "Second",
        "SubscriptionType": "PayAsYouGo",
        "Tag": "key:testKey value:testValue; key:testKey1 value:testValues1",
        "Usage": "100",
        "UsageUnit": "GB",
        "Zone": "Hangzhou 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.