You need to enable JavaScript to run this app.
Elastic Compute Service

Elastic Compute Service

Copy page
Download PDF
Volumes
CalculatePriceV2 - Pricing API V2
Copy page
Download PDF
CalculatePriceV2 - Pricing API V2
Call the CalculatePriceV2 API to query the volume price.​
Instructions​
When a sub-account uses the CalculatePriceV2 API to query the volume price, the query result includes the original price, payable price, and discount price by default. You can configure a permission policy to hide the discount price and grant it to the sub-account, so that the sub-account can only view the original price and payable price, but not the discount price. The permission policy to hide the discount price is as follows:​
​
{​
"Statement": [​
{​
"Effect": "Deny",​
"Action": [​
"billing:QueryDiscountPrice"​
],​
"Resource": [​
"*"​
]​
}​
]​
}​
​
Debugging​
API Explorer
You can initiate calls online through API Explorer without paying attention to the signature generation process and quickly obtain the call results.
​
request parameters​
Below are the unique request parameters for this API and some common parameters. For more information, see Common Parameters.​
Action string required Example: CalculatePriceV2​
Action to be performed: CalculatePriceV2.​
​
Version string required Example: 2020-04-01​
​
AccountId long Optional Example value: 210000****​
Account ID.​
​
CalculatePriceInfos object[] Optional Example: -​
Inquiry information.​
Count long Optional Example: 1​
The number of volumes, default is 1.​
​
PurchaseTime long Optional Example value: 2023-11-06T06:38:51+08:00​
Purchase time.​
​
Size float Optional Example: 40​
Volume capacity, unit GiB.​
warning​
Before performing actions such as creating a volume, expanding a volume, changing the volume billing mode, or changing the volume specifications, the Size parameter is required when inquiring about the price.​
​
VolumeType string Optional Example: ESSD_FlexPL​
Volume specifications, values are as follows:​
  • PTSSD: Performance SSD.​
  • ESSD_PL0: High-speed SSD volume of PL0 specification.​
  • Extreme Speed SSD Cloud volume, FlexPL specification.​
  • TSSD_TL0: Throughput SSD volume.​
​
Action string Optional Example: extend​
The operations for pricing conversion are insensitive to case, and the value description is as follows:​
  • create: Inquire about pricing before creating a volume.​
  • Extend: Inquire before expanding the volume.​
  • ModifyChargeType: Change the billing model, such as changing from a yearly or monthly billed volume to a pay-as-you-go volume.​
  • ModifyType: Inquire before changing the volume specifications, for example, changing from ESSD PL0 to ESSD FlexPL.​
  • Renew: Inquire before renewal.​
  • Terminate: Inquire before unsubscribing.​
warning​
Pay-as-you-go volumes do not support Renew (inquiry for renewal) and Terminate (inquiry to unsubscribe).​
​
Period string Optional Example: hourly​
Description of volume purchase cycle types:​
  • monthly: Purchase by the month. Annual and monthly packages only support monthly.​
  • hourly: Purchase by the hour. Pay-as-you-go only supports hourly.​
tip​
Period and Times parameters must be provided together.​
​
Times integer Optional Example value: 2​
Duration of volume purchase. For example, if Period is set to monthly and Time is set to 2, it indicates the purchase of the volume for 2 months.​
tip​
Times and Period parameters must be entered together.​
​
EndTime integer Optional Example: 1748361599​
The expiration deadline of the volume is converted based on the timestamp.​
warning​
  • Only annual or monthly volumes support setting the EndTime parameter.​
  • The unsubscription scenario does not support the EndTime parameter.​
  • If both EndTime and Times are set, EndTime is given priority.​
​
VolumeKind string Optional Example value: system​
Volume type. Value descriptions are as follows:​
  • data: Data disk​
  • system: System disk​
Default is data disk.​
​
VolumeID string Optional Example value: vol-ikbsisshogcrntuo****​
Volume ID.​
warning​
Before creating a volume, there is no need to enter this parameter; in other scenarios, it must be entered.​
​
Region string Optional Example value: cn-beijing​
Region. Defaults to the requested region.​
​
ExtraPerformances object[] Optional Example value: -​
Additional performance package.​
ExtraPerformanceType string Optional Example value: IOPS​
Type of additional performance. The available values are as follows:​
  • Balance: Balanced type.​
  • IOPS: IOPS type.​
  • Throughput: Throughput type.​
​
ExtraPerformanceValue integer Optional Example value: 20​
The performance size of the additional performance package.​
​
​
InstanceID string Optional Example value: i-yci7p7t660awmay7****​
ECS instance ID. After setting InstanceID, the expiration time of the ECS instance will be used as the deadline for the volume, eliminating the need to set EndTime.​
warning​
  • Only subscription volumes support setting InstanceID parameter.​
  • InstanceID and EndTime parameters are mutually exclusive. Inputting both InstanceID and EndTime parameters will result in an error.​
  • If InstanceID and Times are both provided, the expiration time of the instance corresponding to InstanceID will be prioritized.​
​
ChargeType string Optional Example value: PostPaid​
The payment models for cloud volume, explained as follows:​
  • PostPaid: Pay-as-you-go​
  • PrePaid: Subscription based​
​
​
​
​
Return parameters​
The table below lists the return parameters specific to this API. For more details, see Return structure.​
OriginalAmount string Example value: 40​
​
DiscountAmount string Example value: 40​
​
PayableAmount string Example value: 40​
​
ConfigItemsobject[]Example value: -​
​
​
​
Request example​
​
POST /?Action=CalculatePriceV2&Version=2020-04-01 HTTP/1.1​
Host: open.volcengineapi.com​
Content-Type: application/json; charset=UTF-8​
X-Date: 20240903T084538Z​
X-Content-Sha256: 287e874e******d653b44d21e​
Authorization: HMAC-SHA256 Credential=Adfks******wekfwe/20240903/cn-beijing/storage_ebs/request, SignedHeaders=host;x-content-sha256;x-date, Signature=47a7d934ff7b37c03938******cd7b8278a40a1057690c401e92246a0e41085f​
{​
"CalculatePriceInfos": [​
{​
"VolumeType": "ESSD_PL0",​
"Size": 40,​
"Action": "create",​
"ChargeType": "PrePaid",​
"VolumeKind": "data",​
"Period": "monthly",​
"Times": 2​
}​
]​
}​
​
Back to example​
​
{​
"ResponseMetadata": {​
"RequestId": "20240903164751104004150048BA****",​
"Action": "CalculatePrice",​
"Version": "2020-04-01",​
"Service": "storage_ebs",​
"Region": "cn-beijing"​
},​
"Result": {​
"ConfigItems": [​
{​
"ChargeItems": [​
{​
"ChargeItemCode": "data-EBS_ESSD_PL0_cn-beijing",​
"DiscountAmount": "40",​
"OriginalAmount": "40",​
"PayableAmount": "40"​
}​
],​
"ConfigurationCode": "data-EBS_ESSD_PL0.month",​
"DiscountAmount": "40",​
"OriginalAmount": "40",​
"PayableAmount": "40",​
"Product": "volume",​
"Quantity": 1​
}​
],​
"DiscountAmount": "40",​
"OriginalAmount": "40",​
"PayableAmount": "40",​
"Quantity": 1,​
"Visible": true​
}​
}​
​
error code​
The following table lists error codes related to API and business logic. For common error codes, see the Common error codes documentation.​
​
Status code​
error code​
error message​
Create Volume​
400​
InvalidVolumeSize​
Invalid volume size.​
The volume size is invalid.​
412​
InvalidInstanceExpireTime​
Failed to retrieve the expiration time of the instance or the instance has already expired.​
Either the instance expiration time was not found, or the instance has expired.​
​
​
Last updated: 2026.10.20 11:34:09