All Products
Search
Document Center

BSS OpenAPI:DescribeInstanceBill

Last Updated:Oct 18, 2024

Queries the billing information about instances or billable items in a billing cycle.

Operation description

  • Instance bills are generated after the total bill is split. In most cases, the instance bills do not include data generated on the last day of the specified billing cycle.
  • The instance information may change during the billing cycle. The instance configurations and types in monthly bills are subject to the point in time when you query bills. For more information, see the corresponding bill details.
  • You can query data generated after June 2020 for Cloud Communications services. You can query data generated after November 2020 for Alibaba Cloud Domains.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
BillingCyclestringYes

The billing cycle. Specify the parameter in the YYYY-MM format. Only the latest 18 month billing cycle is supported.

2020-03
ProductCodestringNo

The code of the service.

rds
ProductTypestringNo

The type of the service.

rds
SubscriptionTypestringNo

The billing method. Valid values:

  • Subscription: the subscription billing method.
  • PayAsYouGo: the pay-as-you-go billing method.
PayAsYouGo
IsBillingItembooleanNo

Specifies whether to query data by billable items. Valid values:

  • false: The data that you query is the same as the data searched by instances on the Billing Details tab of the Bill Details page in the User Center console.
  • true: The data that you query is the same as the data searched by billable items on the Billing Details tab of the Bill Details page in the User Center console.

Default value: false.

false
NextTokenstringNo

The token that is used to indicate the position where the results for the current call start. The parameter must be left empty or set to the value of the NextToken parameter that is returned from the last call. Otherwise, an error is returned. If the parameter is left empty, data is queried from the first item.

CAESEgoQCg4KCm
MaxResultsintegerNo

The maximum number of entries to return. Default value: 20. Maximum value: 300.

20
IsHideZeroChargebooleanNo

Specifies whether to filter bills if both the pretax gross amount and pretax amount are 0. Valid values:

  • false: does not filter bills.
  • true: filters bills.
false
BillingDatestringNo

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

2020-03-02
GranularitystringNo

The granularity at which bills are queried. Valid values:

  • MONTHLY: queries bills on a monthly basis. The data that you query is the same as the data searched by instances on the Billing Details tab of the Bill Details page in the User Center console.
  • DAILY: queries bills on a daily basis. The data that you query is the same as the data searched by days on the Billing Details tab of the Bill Details page in the User Center console.

The BillingDate parameter is required if you set the Granularity parameter to DAILY.

MONTHLY
BillOwnerIdlongNo

The ID of the member. If you specify this parameter, the bills of the member are queried. If you do not specify this parameter, the bills of the current account are queried by default.

122
InstanceIDstringNo

The ID of the instance.

abc
PipCodestringNo

The code of the service. The code is the same as that in Cost Center.

rds

Response parameters

ParameterTypeDescriptionExample
object
Codestring

The status code.

Success
Messagestring

The error message returned.

Successful!
RequestIdstring

The ID of the request.

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

Indicates whether the request was successful.

true
Dataobject

The data returned.

NextTokenstring

The position where the query stopped. If this parameter is left empty, all the results are returned. If you perform another call, you must set the NextToken parameter to the value of this parameter.

CAESEgoQCg4KCm
BillingCyclestring

The billing cycle in the YYYY-MM format.

2020-03
MaxResultsinteger

The maximum number of entries returned.

20
AccountIDstring

The ID of the account.

122
TotalCountinteger

The total number of returned entries.

20
AccountNamestring

The name of the account.

test@test.aliyunid.com
Itemsarray<object>

The details of the bill.

Itemobject
BillingDatestring

The billing date. This parameter is returned only if the Granularity parameter is set to DAILY. Format: YYYY-MM-DD.

2020-03-20
InstanceConfigstring

The configurations of the instance.

CPU:12
InternetIPstring

The public IP address.

34.xx.x.x
Itemstring

The type of the bill.

  • SubscriptionOrder: the subscription bill.
  • PayAsYouGoBill: the pay-as-you-go bill,
  • Refund: the refund.
  • Adjustment: the adjustment bill.
PayAsYouGoBill
Tagstring

The tag of the resource.

key:testKey value:testValue; key:testKey1 value:testValues1
InstanceIDstring

The ID of the instance.

i-dadada
Currencystring

The type of currency. Valid values:

  • CNY
  • USD
  • JPY
CNY
BillAccountNamestring

The name of the account to which the bill belongs.

test@test.aliyunid.com
SubscriptionTypestring

The billing method. Valid values:

  • Subscription: the subscription billing method.
  • PayAsYouGo: the pay-as-you-go billing method.
PayAsYouGo
BizTypestring

The type of business.

trusteeship
InstanceSpecstring

The type of the instance.

ecs.sn1ne.3xlarge
DeductedByCouponsfloat

The amount deducted with coupons.

0.1
BillingItemstring

The billable item. A value is returned only if the IsBillingItem parameter is set to true.

Bandwidth
BillingItemCodestring

The code of the billable item.

disk
Regionstring

The ID of the region.

China (Hangzhou)
CostUnitstring

The cost center.

Not allocated
ListPriceUnitstring

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

CNY
ResourceGroupstring

The ID of the resource group.

Default resource group
PipCodestring

The code of the service. The code is the same as that in Cost Center.

rds
ServicePeriodUnitstring

The unit of the service duration.

Second
PretaxAmountfloat

The pretax amount.

0.1
CommodityCodestring

The code of the commodity. The code is the same as that in Cost Center.

rds
ProductNamestring

The name of the service.

ApsaraDB RDS
NickNamestring

The name of the instance.

test
ProductDetailstring

The details of the service.

ApsaraDB RDS
Usagestring

The usage of the service. This parameter is valid only when the isBillingItem parameter is set to true. The usage is the total usage in all bills in the billing cycle, not the amount that you purchase. For example, if 1 GB of storage is used and bills are generated every hour, the usage is 1 GB per hour. In this case, the usage is 24 GB per day.

100
IntranetIPstring

The private IP address.

192.xx.xx.xx
OwnerIDstring

The ID of the account that owns the resource. This parameter is returned in multi-account payment scenario.

123
UsageUnitstring

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

GB
BillAccountIDstring

The ID of the account to which the bill belongs.

122
InvoiceDiscountfloat

The discount amount.

0.1
DeductedByResourcePackagestring

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

0.1
ProductTypestring

The type of the service.

rds
ServicePeriodstring

The service duration.

3600
Zonestring

The ID of the zone.

Hangzhou Zone B
ListPricestring

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

100
PretaxGrossAmountfloat

The pretax gross amount.

0.1
ProductCodestring

The code of the service.

rds
BillingTypestring

The billing method.

Other
ItemNamestring

The name of the project.

iZ28bycvyb4Z

Examples

Sample success responses

JSONformat

{
  "Code": "Success",
  "Message": "Successful!",
  "RequestId": "79EE7556-0CFD-44EB-9CD6-B3B526E3A85F",
  "Success": true,
  "Data": {
    "NextToken": "CAESEgoQCg4KCm",
    "BillingCycle": "2020-03",
    "MaxResults": 20,
    "AccountID": "122",
    "TotalCount": 20,
    "AccountName": "test@test.aliyunid.com",
    "Items": [
      {
        "BillingDate": "2020-03-20",
        "InstanceConfig": "CPU:12",
        "InternetIP": "34.xx.x.x\t",
        "Item": "PayAsYouGoBill",
        "Tag": "key:testKey value:testValue; key:testKey1 value:testValues1",
        "InstanceID": "i-dadada",
        "Currency": "CNY",
        "BillAccountName": "test@test.aliyunid.com",
        "DeductedByCashCoupons": 0.1,
        "SubscriptionType": "PayAsYouGo",
        "BizType": "trusteeship",
        "InstanceSpec": "ecs.sn1ne.3xlarge\t",
        "DeductedByCoupons": 0.1,
        "BillingItem": "Bandwidth\n",
        "BillingItemCode": "disk",
        "Region": "China (Hangzhou)\n",
        "OutstandingAmount": 0.1,
        "CostUnit": "Not allocated\n",
        "ListPriceUnit": "CNY\n",
        "ResourceGroup": "Default resource group\n",
        "PipCode": "rds",
        "ServicePeriodUnit": "Second\n",
        "PretaxAmount": 0.1,
        "CommodityCode": "rds",
        "ProductName": "ApsaraDB RDS\n",
        "AdjustAmount": 0,
        "NickName": "test",
        "ProductDetail": "ApsaraDB RDS\n",
        "Usage": "100",
        "IntranetIP": "192.xx.xx.xx",
        "OwnerID": "123",
        "DeductedByPrepaidCard": 0.1,
        "UsageUnit": "GB",
        "BillAccountID": "122",
        "PaymentAmount": 0.1,
        "InvoiceDiscount": 0.1,
        "DeductedByResourcePackage": "0.1",
        "ProductType": "rds",
        "ServicePeriod": "3600",
        "Zone": "Hangzhou Zone B\n",
        "ListPrice": "100",
        "PretaxGrossAmount": 0.1,
        "CashAmount": 0,
        "ProductCode": "rds",
        "BillingType": "Other\n",
        "ItemName": "iZ28bycvyb4Z"
      }
    ]
  }
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-12-13The request parameters of the API has changedView Change Details
2021-09-23The response structure of the API has changedView Change Details