全部產品
Search
文件中心

Expenses and Costs:QueryInstanceBill - 執行個體賬單查詢服務

更新時間:Oct 14, 2025

查詢使用者某個賬期內所有商品執行個體或計費項目的消費匯總。API 已升級為 DescribeInstanceBill,此API不再提供50000行以後資料的查詢。

介面說明

API 描述

在調用本介面時,請注意:

  • 執行個體賬單 API 已升級,請使用新版 API: DescribeInstanceBill 。此 API 不再提供 50000 行以後資料的查詢。

  • 執行個體賬單是根據賬單資料拆分產生,一般會有一天延遲。

  • 執行個體資訊在賬期內會變化,月匯總的執行個體 Config 和 Spec 對應記錄產生時間資訊,如需詳情可參考對應明細賬單。

  • 雲通訊產品可查詢從 2020 年 6 月以後的資料; 萬網產品可查詢從 2020 年 11 月以後的資料。

  • 國際站服務地址請選擇新加坡。

調試

您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。

調試

授權資訊

下表是API對應的授權資訊,可以在RAM權限原則語句的Action元素中使用,用來給RAM使用者或RAM角色授予調用此API的許可權。具體說明如下:

  • 操作:是指具體的許可權點。

  • 存取層級:是指每個操作的存取層級,取值為寫入(Write)、讀取(Read)或列出(List)。

  • 資源類型:是指操作中支援授權的資源類型。具體說明如下:

    • 對於必選的資源類型,用前面加 * 表示。

    • 對於不支援資源級授權的操作,用全部資源表示。

  • 條件關鍵字:是指雲產品自身定義的條件關鍵字。

  • 關聯操作:是指成功執行操作所需要的其他許可權。操作者必須同時具備關聯操作的許可權,操作才能成功。

操作

存取層級

資源類型

條件關鍵字

關聯操作

bss:DescribeBillList

get

*全部資源

*

  • bssapi:ProductCode
  • bssapi:ProductType

請求參數

名稱

類型

必填

描述

樣本值

BillingCycle

string

賬期 YYYY-MM。僅支援最近 18 個月賬期。

2020-03

ProductCode

string

產品代碼。

rds

ProductType

string

產品類型。當 ProductCode 為雲市場產品 code 時,此參數必填。

rds

SubscriptionType

string

訂閱類型。取值:

  • Subscription:預付費。

  • PayAsYouGo:後付費。

說明

必須和 ProductCode 參數一起使用。

PayAsYouGo

IsBillingItem

boolean

是否按照計費項目維度拉取資料。

  • false。與“費用中心-費用賬單-賬單明細-執行個體”賬單一致。

  • true。與“費用中心-費用賬單-賬單明細-計費項目”賬單一致。

預設 false。

false

PageNum

integer

頁碼,預設值為 1。

1

PageSize

integer

每頁數量,預設值:20,最大值:300。

20

IsHideZeroCharge

boolean

根據原價(PretaxGrossAmount)和應付(PretaxAmount)是否都為 0 做過濾。取值:

  • false。

  • true。

false

BillingDate

string

賬單日期,僅當 Granularity 為 DAILY 時必填,格式為 YYYY-MM-DD。

2020-03-03

Granularity

string

查詢賬單的顆粒度。取值:

  • MONTHLY:月。與“費用中心-費用賬單-賬單明細-賬期”賬單一致。

  • DAILY:日。與“費用中心-費用賬單-賬單明細-按天”賬單一致。

選擇 DAILY 需指定 BillingDate

MONTHLY

BillOwnerId

integer

資源歸屬帳號 ID,資源歸屬帳號是實際使用資源的帳號。

122

返回參數

名稱

類型

描述

樣本值

object

Code

string

狀態代碼。

Success

Message

string

錯誤資訊。

Successful!

RequestId

string

請求 ID。

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

Success

boolean

是否成功。

true

Data

object

返回資料。

PageNum

integer

頁碼。

1

BillingCycle

string

賬單日期,格式:YYYY-MM。

2020-03

AccountID

string

帳號 ID。

185xxxx3489

PageSize

integer

每頁數量。

20

TotalCount

integer

總記錄數。

2

AccountName

string

使用者帳號。

test@test.aliyunid.com

Items

object

Item

array<object>

賬單詳情。

object

BillingDate

string

賬單日期,僅當 Granularity 為 DAILY 時有值,格式為 YYYY-MM-DD。

2020-03

InstanceConfig

string

執行個體詳細配置。

CPU:12

InternetIP

string

公網 IP。

34.xx.x.x

Item

string

賬單類型:

  • SubscriptionOrder (預付訂單)。

  • PayAsYouGoBill (後付賬單)。

  • Refund (退款)。

  • Adjustment (調賬)。

PayAsYouGoBill

Tag

string

標籤。

tag

InstanceID

string

執行個體 ID。

i-kjhdskjgshfdlkjfdh

Currency

string

幣種,取值:

  • CNY。

  • USD。

  • JPY。

CNY

DeductedByCashCoupons

number

0

SubscriptionType

string

訂閱類型,取值:

  • Subscription:預付費。

  • PayAsYouGo:後付費。

說明

必須和 ProductCode 參數一起使用。

PayAsYouGo

InstanceSpec

string

執行個體規格。

ecs.sn1ne.3xlarge

DeductedByCoupons

number

優惠券優惠金額。

0

BillingItem

string

計費項目。僅當 IsBillingItem=true 有值。

其他

Region

string

地區。

杭州

OutstandingAmount

number

0

CostUnit

string

財務單元。

未分配

ListPriceUnit

string

單價單位, 僅當 isBillingItem 為 true 時有效。

ResourceGroup

string

資源群組。

預設資源群組

PipCode

string

產品 Code,與費用中心賬單產品 Code 一致

rds

ServicePeriodUnit

string

服務周期單位

PretaxAmount

number

應付金額。

0

CommodityCode

string

商品 Code,與費用中心產品明細 Code 一致

rds

ProductName

string

產品名稱。

雲資料庫RDS

AdjustAmount

number

信用額度退款抵扣。

0

NickName

string

執行個體暱稱。

test

ProductDetail

string

產品明細。

雲資料庫RDS

Usage

string

用量, 僅當 isBillingItem 為 true 時有效。

100

IntranetIP

string

內網 IP。

192.xx.xx.xx

OwnerID

string

子帳號 AccountID(多帳號代付情境)。

169***013

DeductedByPrepaidCard

number

0

UsageUnit

string

用量單位, 僅當 isBillingItem 為 true 時有效。

GB

PaymentAmount

number

0

InvoiceDiscount

number

優惠金額。

0

DeductedByResourcePackage

string

資源套件抵扣。

NULL

ProductType

string

產品類型。

rds

ServicePeriod

string

服務周期。

10

Zone

string

可用性區域。

cn-hangzhou-h

ListPrice

string

單價, 僅當 isBillingItem 為 true 時有效。

100

PretaxGrossAmount

number

原始金額。

0

CashAmount

number

現金支付(不包含信用額度退款抵扣)。

0

ProductCode

string

產品代碼。

rds

BillingType

string

計費方式。

其它

樣本

正常返回樣本

JSON格式

{
  "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": "其它"
        }
      ]
    }
  }
}

錯誤碼

訪問錯誤中心查看更多錯誤碼。

變更歷史

更多資訊,參考變更詳情