All Products
Search
Document Center

Expenses and Costs:QuerySettleBill

Last Updated:Jul 30, 2026

Queries the settlement bills of a user for a specific billing cycle. Supports domestic accounts with more than 50,000 bill entries.

Operation description

  • The query results for the current month are for reference only and cannot be used for reconciliation. The final bill for the current month is available for viewing or export after 12:00 on the 2nd of the following month. During the month, a few scenarios may occur, including but not limited to delayed billing, refunds, adjustments, and overdue payment write-offs.

  • Bill data is updated with a 5-hour delay relative to actual cost consumption.

  • For bills in the "Unsettled" state in historical billing cycles, the status is updated to settled 5 hours after payment. For bills in the "Unsettled" state in the current month, the status is updated to settled when the bill is generated at 12:00 on the 2nd of the following month.

  • This API supports graceful backoff with a request rate of 600/60(s).

  • The rate limit per user is 10 requests per second. 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

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request parameters

Parameter

Type

Required

Description

Example

BillingCycle

string

Yes

The billing cycle, in the format of YYYY-MM.

2018-07

Type

string

No

The type. Valid values:

  • SubscriptionOrder: prepaid order

  • PayAsYouGoBill: pay-as-you-go bill

  • Refund: refund bill

  • Adjustment: adjustment bill

SubscriptionOrder

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

Note

This parameter must be used together with the ProductCode parameter.

Subscription

IsHideZeroCharge

boolean

No

Specifies whether to filter based on whether the original price (PretaxGrossAmount) is 0. Default value: false (compatible with existing logic). Valid values:

  • true: Yes.

  • false: No.

true

NextToken

string

No

The token that marks the position from which the next query starts. Leave this parameter empty to start from the beginning.

CAESEgoQCg4KCmdtdF9jcmVhdGUEARgBIkgKCQBwhGmPcAEAAAo7AzYAAAAxTDgwMDcxMjg3ZDJhNmM3ZDguTDgwMDAwMDAwMDAwMzE1MTIuTDgwMDcyZDMyZTJkYzg3N2U

MaxResults

integer

No

The maximum number of data records to read in this request. Default value: 20. Maximum value: 300.

20

BillOwnerId

integer

No

The ID of the resource ownership account. The resource ownership account is the account that actually uses the resource.

123

RecordID

string

No

The order ID or bill ID.

12233

Response elements

Element

Type

Description

Example

object

Code

string

The status code.

Success

Message

string

The error message.

Successful!

RequestId

string

The request ID.

AE3F4057-DFC9-4B81-8858-F620651010C9

Success

boolean

Indicates whether the request was successful.

true

Data

object

The returned data.

NextToken

string

The token that indicates the position where the current call reads to. An empty value indicates that all data has been read.

CAESEgoQCg4KCmdtdF9jcmVhdGUQARgBIkgKCQBwhGmPcAEAAAo7AzYAAAAxTDgwMDcxMjg3ZDJhNmM3ZDguTDgwMDAwMDAwMDAwMzE1MTIuTDgwMDcyZDMyZTJkYzg3N2U

BillingCycle

string

The billing cycle, in the format of YYYY-MM.

2020-02

MaxResults

integer

The maximum number of records returned in this request.

20

AccountID

string

The account ID.

185xxxxx489

TotalCount

integer

The total number of records.

200

AccountName

string

The account name.

test@test.aliyunid.com

Items

object

Item

array<object>

The bill details.

object

Status

string

The payment status. Valid values:

  • PayFinish: Paid

  • PayUnclear: Unpaid

  • PayUnsettle: Unsettled

  • NoSettle: Not Settled

PayFinish

RoundDownDiscount

string

The discount from rounding down.

0

Item

string

The bill type:

  • Subscription

  • OrderPayAsYouGoBill

  • Refund

  • Adjustment

Subscription

Currency

string

The currency.

  • CNY

  • USD

  • JPY

CNY

BillAccountName

string

The name of the account to which the bill belongs.

test@test.aliyunid.com

SubscriptionType

string

The subscription type. Valid values:

  • Subscription

  • PayAsYouGo

PayAsYouGo

UsageStartTime

string

The start time of the billing.

2020-03-11 07:00:00

BizType

string

The business type.

trusteeship

UsageEndTime

string

The end time of the billing.

2020-03-11 08:00:00

DeductedByCoupons

number

The amount deducted using coupons.

0

SubOrderId

string

The ID of the order item that corresponds to the bill.

325345254353

AfterTaxAmount

number

OutstandingAmount

number

The outstanding amount.

0

PaymentTime

string

The time when the order was paid.

2020-03-11 08:00:00

Tax

number

PretaxAmountLocal

number

PipCode

string

The product code. This code is the same as the product code on the Bills page in the User Center.

rds

PaymentTransactionID

string

PretaxAmount

number

The amount payable.

100

CommodityCode

string

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

rds

ProductName

string

The product name.

云数据库RDS

RecordID

string

The order number or bill number.

2020xxxx5912

AdjustAmount

number

The amount deducted from a credit refund.

0

ProductDetail

string

The product details.

关系型数据库RDS(包月)

PaymentCurrency

string

OwnerID

string

The ID of the RAM user. This parameter is used in multi-account payment scenarios.

3532535235

BillAccountID

string

The ID of the account to which the bill belongs.

185xxxxx489

PaymentAmount

number

The amount paid in cash. This includes deductions from credit refunds.

0

InvoiceDiscount

number

The discount amount.

0

ProductType

string

The product type.

rds

PretaxGrossAmount

number

The original amount.

0

CashAmount

number

The amount paid in cash. This does not include deductions from credit refunds.

0

ProductCode

string

The product code.

rds

Examples

Success response

JSON format

{
  "Code": "Success",
  "Message": "Successful!",
  "RequestId": "AE3F4057-DFC9-4B81-8858-F620651010C9",
  "Success": true,
  "Data": {
    "NextToken": "CAESEgoQCg4KCmdtdF9jcmVhdGUQARgBIkgKCQBwhGmPcAEAAAo7AzYAAAAxTDgwMDcxMjg3ZDJhNmM3ZDguTDgwMDAwMDAwMDAwMzE1MTIuTDgwMDcyZDMyZTJkYzg3N2U",
    "BillingCycle": "2020-02",
    "MaxResults": 20,
    "AccountID": "185xxxxx489",
    "TotalCount": 200,
    "AccountName": "test@test.aliyunid.com",
    "Items": {
      "Item": [
        {
          "Status": "PayFinish",
          "RoundDownDiscount": "0",
          "Item": "Subscription",
          "Currency": "CNY",
          "BillAccountName": "test@test.aliyunid.com",
          "SubscriptionType": "PayAsYouGo",
          "UsageStartTime": "2020-03-11 07:00:00",
          "BizType": "trusteeship",
          "UsageEndTime": "2020-03-11 08:00:00",
          "DeductedByCoupons": 0,
          "SubOrderId": "325345254353",
          "AfterTaxAmount": 0,
          "OutstandingAmount": 0,
          "PaymentTime": "2020-03-11 08:00:00",
          "Tax": 0,
          "PretaxAmountLocal": 0,
          "PipCode": "rds",
          "PaymentTransactionID": "",
          "PretaxAmount": 100,
          "CommodityCode": "rds",
          "ProductName": "云数据库RDS",
          "RecordID": "2020xxxx5912",
          "AdjustAmount": 0,
          "ProductDetail": "关系型数据库RDS(包月)",
          "PaymentCurrency": "",
          "OwnerID": "3532535235",
          "BillAccountID": "185xxxxx489",
          "PaymentAmount": 0,
          "InvoiceDiscount": 0,
          "ProductType": "rds",
          "PretaxGrossAmount": 0,
          "CashAmount": 0,
          "ProductCode": "rds"
        }
      ]
    }
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.