Queries the usage details of savings plans.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes DescribeSavingsPlansUsageDetail

The operation that you want to perform. Set the value to DescribeSavingsPlansUsageDetail.

PeriodType String Yes HOUR

The time granularity at which usage details are queried. Valid values: MONTH, DAY, and HOUR.

StartPeriod String Yes 2021-01-01 00:00:00

The beginning of the time range to query. The beginning is included in the time range. Specify the time in the format of yyyy-MM-dd HH:mm:ss.

EndPeriod String No 2021-01-02 00:00:00

The end of the time range to query. The end is excluded from the time range. If you do not set this parameter, the end time is the current time. Specify the time in the format of yyyy-MM-dd HH:mm:ss.

Token String No eyJwYWdlTnVtIjoyLCJwYWdlU2l6ZSI6MTB9

The token that is used to retrieve the next page of results. You do not need to set this parameter if you query usage details within a specific time range for the first time. The response returns a token that you can use to query usage details that are displayed on the next page. If a null value is returned for the NextToken parameter, no more coverage details can be queried.

MaxResults Integer No 300

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

BillOwnerId Long No 123745698925000

The ID of the account for which you want to query usage details. If you do not set this parameter, the data of the current Alibaba Cloud account and its RAM users is queried. To query the data of a RAM user, specify the ID of the RAM user.

Response parameters

Parameter Type Example Description
Code String Success

The status code.

Data Struct

The return data.

Items Array of Item

The data entries.

Currency String CNY

The currency.

DeductValue Float 3.94

The used amount of the savings plan.

EndPeriod String 2021-08-09 00:00:00

The end time.

InstanceId String spn-a1fhs54c243hP22

The ID of the instance.

PoolValue Float 29.84

The total amount of the savings plan.

PostpaidCost Float 4.2

The pay-as-you-go cost.

SavedCost Float 0.08

The amount that is saved.

StartPeriod String 2021-08-01 00:00:00

The start time.

Status String -1

The status of the instance.

A value of -1 indicates that the payment is overdue. A value of 1 indicates that the instance is active.

Type String universal

The type of the savings plan. Valid values: universal and ECS compute.

UsagePercentage Float 0.9

The usage.

UserId Long 123745698925000

The ID of the account.

UserName String test13@test.aliyun.com

The username of the account.

NextToken String eyJwYWdlTnVtIjoyLCJwYWdlU2ldhsSI6MTB9

The token of the next page.

TotalCount Integer 1000

The total number of entries.

Message String Successful!

The message returned.

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

The ID of the request.

Success Boolean true

Indicates whether the operation was successful.

Examples

Sample requests

http(s)://[Endpoint]/?Action=DescribeSavingsPlansUsageDetail
&PeriodType=HOUR
&StartPeriod=2021-01-01 00:00:00
&<Common request parameters>

Sample success responses

JSON format

{"Message":"Successful!","RequestId":"79EE7556-0CFD-44EB-9CD6-B3B526E3A85F","Data":{"TotalCount":"1000","NextToken":"eyJwYWdlTnVtIjoyLCJwYWdlU2ldhsSI6MTB9","Items":[{"Status":"-1","PostpaidCost":"4.2","Type":"universal","UserName":"test13@test.aliyun.com","InstanceId":"spn-a1fhs54c243hP22","EndPeriod":"2021-08-09 00:00:00","UserId":"123745698925000","Currency":"CNY","SavedCost":"0.08","PoolValue":"29.84","DeductValue":"3.94","UsagePercentage":"0.9","StartPeriod":"2021-08-01 00:00:00"}]},"Code":"Success","Success":"true"}

Error codes

For a list of error codes, visit the API Error Center.