All Products
Search
Document Center

Expenses and Costs:QuerySavingsPlansInstance

Last Updated:Mar 04, 2025

Queries the information about the savings plans of the current user.

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

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • For mandatory resource types, indicate with a prefix of * .
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
bssapi:QuerySavingsPlansInstanceget
*All Resources
*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
PageSizeintegerNo

The number of entries to return on each page.

20
LocalestringNo

The language of the return data. Valid values:

  • ZH: Chinese
  • EN: English
ZH
PageNumintegerNo

The number of the page to return.

1
InstanceIdstringNo

The ID of the savings plan instance.

spn-xxxxxxx
StartTimestringNo

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

2020-01-01 00:00:00
EndTimestringNo

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

2021-01-01 00:00:00
Tagarray<object>No

The tags.

objectNo
KeystringNo

The key of the tag to query.

ecs
ValuestringNo

The value of the tag to query.

001
StatusstringNo

The status of the Instance.

  • NORMAL
  • RELEASE
NORMAL

Response parameters

ParameterTypeDescriptionExample
object
Codestring

The error code.

Success
Messagestring

The message returned.

Successful
RequestIdstring

The ID of the request.

61293E7A-3406-4447-8620-EC88B0AA66AD
Successboolean

Indicates whether the operation was successful.

true
Dataobject

The return data.

PageNuminteger

The page number of the returned page.

1
PageSizeinteger

The number of entries returned per page.

20
TotalCountinteger

The total number of entries.

100
Itemsarray<object>

The details about the instances.

SavingsPlansDetailResponseobject
Statusstring

The status of the instance. Valid values:

  • NORMAL: normal
  • LIMIT: stopped due to overdue payment
  • RELEASE: released
NORMAL
SavingsTypestring

The type of the savings plan. Valid values:

  • universal: general-purpose
  • ecs: ECS compute
ECS
Utilizationstring

The total usage.

1.0
PrepayFeestring

The prepaid amount.

8760.00
InstanceIdstring

The ID of the savings plan instance.

spn-xxxxxxxx
Currencystring

The currency. Valid values: CNY and USD.

CNY
EndTimestring

The time when the instance expires. The time is in the format of yyyy-MM-dd HH:mm:ss.

2021-01-01 00:00:00
StartTimestring

The time when the instance takes effect. The time is in the format of yyyy-MM-dd HH:mm:ss.

2020-01-01 00:00:00
AllocationStatusstring

The allocation status. Valid values:

  • unallocated
  • allocated
  • beAllocated
unallocated
InstanceFamilystring

The instance family information. For an instance of the Elastic Compute Service (ECS) compute type, the value indicates the ECS instance family or the ECS instance family package.

ecs.g6
Regionstring

The region.

cn-zhangjiakou-na62-a01
TotalSavestring

The total amount that is saved.

20.00
PoolValuestring

The commitment.

1.00
PayModestring

The payment type. Valid values:

  • total: All Upfront
  • half: Partial Upfront
  • zero: No Upfront
total
Tagsarray<object>

The details about the tags.

Tagobject
Keystring

The key of the tag.

Valuestring

The value of the tag.

Examples

Sample success responses

JSONformat

{
  "Code": "Success",
  "Message": "Successful",
  "RequestId": "61293E7A-3406-4447-8620-EC88B0AA66AD",
  "Success": true,
  "Data": {
    "PageNum": 1,
    "PageSize": 20,
    "TotalCount": 100,
    "Items": [
      {
        "Status": "NORMAL",
        "Cycle": "1:Year",
        "StartTimestamp": 1663135741039,
        "SavingsType": "ECS",
        "Utilization": "1.0",
        "PrepayFee": "8760.00",
        "InstanceId": "spn-xxxxxxxx",
        "Currency": "CNY",
        "EndTimestamp": 1663135741039,
        "EndTime": "2021-01-01 00:00:00",
        "StartTime": "2020-01-01 00:00:00",
        "AllocationStatus": "unallocated",
        "InstanceFamily": "ecs.g6",
        "Region": "cn-zhangjiakou-na62-a01",
        "LastBillTotalUsage": "100.0",
        "LastBillUtilization": "0.8",
        "TotalSave": "20.00",
        "PoolValue": "1.00",
        "PayMode": "total",
        "Tags": [
          {
            "Key": "",
            "Value": ""
          }
        ],
        "DeductCycleType": "HOUR",
        "RestPoolValue": "100.0",
        "CommodityCode": "savingplan_common_public_cn",
        "CurrentPoolValue": "100.0"
      }
    ]
  }
}

Error codes

HTTP status codeError codeError messageDescription
400InvalidOwnerThe specified owner does not belong to caller.-
400InvalidParameterThe specified request contains invalid parameters.-
400MissingParameterThe specified request lacks essential parameters.-
400NotApplicableThe specified API is not applicable for the user.-
400NotApplicableYou are not authorized to call the API operation. Please check whether the caller site matches the API domain regionId.-
400NotAuthorizedThe user is not authorized for the specified API.-
400NotAuthorizedYou are not authorized to call the API operation. Please check whether RAM user has the permission or check whether ownerId and callerId have been given the appropriate permission.-
500InternalErrorAn error occurred in the internal server.System exception, please try again

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

Change history

Change timeSummary of changesOperation
2024-08-20The Error code has changed. The request parameters of the API has changedView Change Details
2023-07-24The Error code has changed. The response structure of the API has changedView Change Details
2023-05-25The Error code has changed. The response structure of the API has changedView Change Details
2023-03-27The Error code has changed. The response structure of the API has changedView Change Details
2022-12-09The Error code has changed. The response structure of the API has changedView Change Details