调用DescribeInstanceBill查询用户某个账期内所有商品实例或计费项的消费汇总。

  • 实例账单是根据账单数据拆分生成,一般会有一天延迟。
  • 实例信息在账期内会变化,月汇总的实例Config和Spec等对应查询时刻信息,如需详情可参考对应明细账单。
  • 云通信产品可查询从2020年6月以后的数据; 万网产品可查询从2020年11月以后的数据。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

请求参数

名称 类型 是否必选 示例值 描述
Action String DescribeInstanceBill

系统规定参数。取值:DescribeInstanceBill

BillingCycle String 2020-03

账期YYYY-MM。

ProductCode String rds

产品代码。

ProductType String rds

产品类型。

SubscriptionType String PayAsYouGo

订阅类型。取值:

  • Subscription:预付费。
  • PayAsYouGo:后付费。
IsBillingItem Boolean false

是否按照计费项维度拉取数据。

  • false。与费用中心-费用账单-账单明细-实例 账单一致。
  • true。与费用中心-费用账单-账单明细-计费项 账单一致。

    默认 false。

NextToken String CAESEgoQCg4KCmdtdF9jcmVhdGUEARgBIkgKCQBwhGmPcAEAAAo7AzYAAAAxTDgwMDcxMjg3ZDJhNmM3ZDguTDgwMDAwMDAwMDAwMzE1MTIuTDgwMDcyZDMyZTJkYzg3N2U

用来表示当前调用开始读取的位置,参数值必须为空或者使用返回结果中的NextToken设值,否则会报错。空代表从头开始读取。

MaxResults Integer 20

本次读取的最大数据记录数量。默认值:20,最大值:300。

IsHideZeroCharge Boolean false

根据原价(PretaxGrossAmount)和应付(PretaxAmount)是否都为0做过滤。取值:

  • false。
  • true。
BillingDate String 2020-03-02

账单日期,仅当Granularity为DAILY时必填,格式为YYYY-MM-DD。

Granularity String MONTHLY

查询账单的颗粒度。取值:

  • MONTHLY:月。与费用中心-费用账单-账单明细-账期 账单一致。
  • DAILY:日。与费用中心-费用账单-账单明细-按天 账单一致。

    选择DAILY需指定BillingDate。

BillOwnerId Long 122

子账号ID。设置可查看财务云子账号账单,不填默认查看当前调用账号。

InstanceID String abc

实例ID。

返回数据

名称 类型 示例值 描述
Code String Success

状态码。

Message String Successful!

错误信息。

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

请求ID。

Success Boolean true

是否成功。

Data Object

返回数据。

NextToken String CAESEgoQCg4KCmdtdF9jcmVhdGUQARgBIkgKCQBwhGmPcAEAAAo7AzYAAAAxTDgwMDcxMjg3ZDJhNmM3ZDguTDgwMDAwMDAwMDAwMzE1MTIuTDgwMDcyZDMyZTJkYzg3N2U

用来表示当前调用返回读取到的位置,空代表数据已经读取完毕。下次调用时,需要将此设置到入参NextToken中。

BillingCycle String 2020-03

账单日期,格式:YYYY-MM。

MaxResults Integer 20

本次请求所返回的最大记录条数。

AccountID String 122

账号ID。

TotalCount Integer 20

总记录数。

AccountName String test@test.aliyunid.com

用户账号。

Items Array of Item

账单详情。

BillingDate String 2020-03-20

账单日期,仅当Granularity为DAILY时有值,格式为YYYY-MM-DD。

InstanceConfig String CPU:12

实例详细配置。

InternetIP String 34.xx.x.x

公网IP。

Item String PayAsYouGoBill

账单类型:

  • SubscriptionOrder (预付订单)。
  • PayAsYouGoBill (后付账单)。
  • Refund (退款)。
  • Adjustment (调账)。
Tag String key:testKey value:testValue; key:testKey1 value:testValues1

资源标签。

InstanceID String i-dadada

实例ID。

Currency String CNY

币种,取值:

  • CNY。
  • USD。
  • JPY。
BillAccountName String test@test.aliyunid.com

账单所属账号名称。

DeductedByCashCoupons Float 0.1

代金券抵扣。

SubscriptionType String PayAsYouGo

订阅类型,取值:

  • Subscription:预付费。
  • PayAsYouGo:后付费。
BizType String trusteeship

业务类型。

InstanceSpec String ecs.sn1ne.3xlarge

实例规格。

DeductedByCoupons Float 0.1

优惠券优惠金额。

BillingItem String 带宽

计费项。仅当IsBillingItem=true有值。

BillingItemCode String disk

计费项代码。

Region String 杭州

地域。

OutstandingAmount Float 0.1

未结清金额。

CostUnit String 未分配

财务单元。

ListPriceUnit String

单价单位, 仅当isBillingItem为true时有效。

ResourceGroup String 默认资源组

资源组。

PipCode String rds

产品Code,与费用中心账单产品Code一致。

ServicePeriodUnit String

服务时长单位。

PretaxAmount Float 0.1

应付金额。

CommodityCode String rds

商品Code,与费用中心产品明细Code一致。

ProductName String 云数据库RDS

产品名称。

AdjustAmount Float 0

信用额度退款抵扣。

NickName String test

实例昵称。

ProductDetail String 云数据库RDS

产品明细。

Usage String 100

用量, 仅当isBillingItem为true时有效。用量数据为该周期内所有账单的用量和,而非客户的实际购买量。如使用了1G的存储,每小时出账,则每小时用量为1G,按账期天的账单中用量为1G*24=24G。

IntranetIP String 192.xx.xx.xx

内网IP。

OwnerID String 123

资源Owner账号AccountID(多账号代付场景)。

DeductedByPrepaidCard Float 0.1

储值卡抵扣。

UsageUnit String GB

用量单位, 仅当isBillingItem为true时有效。

BillAccountID String 122

账单所属账号ID。

PaymentAmount Float 0.1

现金支付(含信用额度退款抵扣)。

InvoiceDiscount Float 0.1

优惠金额。

DeductedByResourcePackage String 0.1

资源包抵扣, 仅当isBillingItem为true时有效。

ProductType String rds

产品类型。

ServicePeriod String 3600

服务时长。

Zone String 杭州1

可用区。

ListPrice String 100

单价, 仅当isBillingItem为true时有效。

PretaxGrossAmount Float 0.1

原始金额。

CashAmount Float 0

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

ProductCode String rds

产品代码。

BillingType String 其它

计费方式。

ItemName String iZ28bycvyb4Z

项目名称。

示例

请求示例

http(s)://[Endpoint]/?Action=DescribeInstanceBill
&<公共请求参数>

正常返回示例

XML格式

HTTP/1.1 200 OK
Content-Type:application/xml

<RequestId>79EE7556-0CFD-44EB-9CD6-B3B526E3A85F</RequestId>
<Message>Successful!</Message>
<Data>
    <TotalCount>20</TotalCount>
    <BillingCycle>2020-03</BillingCycle>
    <AccountID>122</AccountID>
    <NextToken>CAESEgoQCg4KCmdtdF9jcmVhdGUQARgBIkgKCQBwhGmPcAEAAAo7AzYAAAAxTDgwMDcxMjg3ZDJhNmM3ZDguTDgwMDAwMDAwMDAwMzE1MTIuTDgwMDcyZDMyZTJkYzg3N2U</NextToken>
    <MaxResults>20</MaxResults>
    <AccountName>test@test.aliyunid.com</AccountName>
    <Items>
        <InstanceSpec>ecs.sn1ne.3xlarge	</InstanceSpec>
        <ProductName>云数据库RDS	</ProductName>
        <InstanceID>i-dadada</InstanceID>
        <BillAccountID>122</BillAccountID>
        <DeductedByCashCoupons>0.1</DeductedByCashCoupons>
        <ListPriceUnit>元</ListPriceUnit>
        <BillingDate>2020-03-20</BillingDate>
        <ListPrice>100</ListPrice>
        <PaymentAmount>0.1</PaymentAmount>
        <DeductedByPrepaidCard>0.1</DeductedByPrepaidCard>
        <InvoiceDiscount>0.1</InvoiceDiscount>
        <SubscriptionType>PayAsYouGo</SubscriptionType>
        <Item>PayAsYouGoBill</Item>
        <PretaxGrossAmount>0.1</PretaxGrossAmount>
        <InstanceConfig>CPU:12</InstanceConfig>
        <Currency>CNY</Currency>
        <CommodityCode>rds</CommodityCode>
        <CostUnit>未分配	</CostUnit>
        <AdjustAmount>0</AdjustAmount>
        <ResourceGroup>默认资源组	</ResourceGroup>
        <BillingType>其它</BillingType>
        <Usage>100</Usage>
        <DeductedByCoupons>0.1</DeductedByCoupons>
        <ProductDetail>云数据库RDS	</ProductDetail>
        <ProductCode>rds</ProductCode>
        <Zone>杭州1</Zone>
        <ProductType>rds</ProductType>
        <OutstandingAmount>0.1</OutstandingAmount>
        <BizType>trusteeship</BizType>
        <BillingItem>带宽</BillingItem>
        <NickName>test</NickName>
        <IntranetIP>192.xx.xx.xx</IntranetIP>
        <PipCode>rds</PipCode>
        <ServicePeriodUnit>秒</ServicePeriodUnit>
        <ServicePeriod>3600</ServicePeriod>
        <DeductedByResourcePackage>0.1</DeductedByResourcePackage>
        <UsageUnit>GB</UsageUnit>
        <OwnerID>123</OwnerID>
        <PretaxAmount>0.1</PretaxAmount>
        <InternetIP>34.xx.x.x	</InternetIP>
        <Region>杭州</Region>
        <BillAccountName>test@test.aliyunid.com</BillAccountName>
        <Tag>key:testKey value:testValue; key:testKey1 value:testValues1</Tag>
        <CashAmount>0</CashAmount>
    </Items>
</Data>
<Code>Success</Code>
<Success>true</Success>

JSON格式

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "79EE7556-0CFD-44EB-9CD6-B3B526E3A85F",
  "Message" : "Successful!",
  "Data" : {
    "TotalCount" : 20,
    "BillingCycle" : "2020-03",
    "AccountID" : 122,
    "NextToken" : "CAESEgoQCg4KCmdtdF9jcmVhdGUQARgBIkgKCQBwhGmPcAEAAAo7AzYAAAAxTDgwMDcxMjg3ZDJhNmM3ZDguTDgwMDAwMDAwMDAwMzE1MTIuTDgwMDcyZDMyZTJkYzg3N2U",
    "MaxResults" : 20,
    "AccountName" : "test@test.aliyunid.com",
    "Items" : {
      "InstanceSpec" : "ecs.sn1ne.3xlarge",
      "ProductName" : "云数据库RDS",
      "InstanceID" : "i-dadada",
      "BillAccountID" : 122,
      "DeductedByCashCoupons" : 0.1,
      "ListPriceUnit" : "元",
      "BillingDate" : "2020-03-20",
      "ListPrice" : 100,
      "PaymentAmount" : 0.1,
      "DeductedByPrepaidCard" : 0.1,
      "InvoiceDiscount" : 0.1,
      "SubscriptionType" : "PayAsYouGo",
      "Item" : "PayAsYouGoBill",
      "PretaxGrossAmount" : 0.1,
      "InstanceConfig" : "CPU:12",
      "Currency" : "CNY",
      "CommodityCode" : "rds",
      "CostUnit" : "未分配",
      "AdjustAmount" : 0,
      "ResourceGroup" : "默认资源组",
      "BillingType" : "其它",
      "Usage" : 100,
      "DeductedByCoupons" : 0.1,
      "ProductDetail" : "云数据库RDS",
      "ProductCode" : "rds",
      "Zone" : "杭州1",
      "ProductType" : "rds",
      "OutstandingAmount" : 0.1,
      "BizType" : "trusteeship",
      "BillingItem" : "带宽",
      "NickName" : "test",
      "IntranetIP" : "192.xx.xx.xx",
      "PipCode" : "rds",
      "ServicePeriodUnit" : "秒",
      "ServicePeriod" : 3600,
      "DeductedByResourcePackage" : 0.1,
      "UsageUnit" : "GB",
      "OwnerID" : 123,
      "PretaxAmount" : 0.1,
      "InternetIP" : "34.xx.x.x",
      "Region" : "杭州",
      "BillAccountName" : "test@test.aliyunid.com",
      "Tag" : "key:testKey value:testValue; key:testKey1 value:testValues1",
      "CashAmount" : 0
    }
  },
  "Code" : "Success",
  "Success" : true
}

错误码

访问错误中心查看更多错误码。