Query Spot Price
Updated at:2025-10-20
This API retrieves spot price information.
Request structure
Plain Text
1POST /v{version}/instance/bidPrice HTTP/1.1
2Host: bcc.bj.baidubce.com
3Authorization: authorization string
4
5{
6 "instanceType": instanceType,
7 "cpuCount": cpuCoreCount,
8 "memoryCapacityInGB": memoryCapacityInGB,
9 "rootDiskSizeInGb":rootDiskSizeInGb,
10 "rootDiskStorageType":rootDiskStorageType,
11 "createCdsList": [
12 {
13 "storageType": storageType,
14 "cdsSizeInGB": cdsSizeInGB
15 }
16 ],
17 "purchaseCount":purchaseCount
18}
Request headers
There are no special headers required beyond the common headers.
Request parameters
| Parameter name | Types | Whether required | Parameter location | Description |
|---|---|---|---|---|
| version | String | Yes | URL parameter | API version number |
| instanceType | String | Yes | RequestBody | For type of virtual machine instance to be created, refer to [InstanceType](BCC/API Reference/Appendix.md#InstanceType). |
| cpuCount | int | Yes | RequestBody | Count of CPU cores for virtual machine instance to be created. Refer to [Regional Machine Types and Optional Configurations ](BCC/API Reference/Appendix.md#Regional models and optional configurations) for optional configurations. |
| memoryCapacityInGB | int | Yes | RequestBody | Memory capacity for virtual machine instance to be created, in GB. Refer to [Regional Machine Types and Optional Configurations ](BCC/API Reference/Appendix.md#Regional models and optional configurations) for optional configurations. |
| rootDiskSizeInGb | int | No | RequestBody | Size of system disk for virtual machine instance to be created, in GB. The default is 40 GB, with a range of [40 to 2,048]GB. Sizes exceeding 40 GB are charged according to cloud disk server prices. Note that the specified system disk size must meet the minimum disk space requirements of the image being used. |
| rootDiskStorageType | String | No | RequestBody | Medium of system disk for virtual machine instance to be created. By default, an SSD cloud disk server is used. The disk type for the system disk can be specified; refer to [StorageType](BCC/API Reference/Appendix.md#StorageType). |
| createCdsList | List<[CreateCdsModel](BCC/API Reference/Appendix.md#CreateCdsModel)> | No | RequestBody | List of CDS disks to be created. For specific data formats, refer to [CreateCdsModel](BCC/API Reference/Appendix.md#CreateCdsModel) below |
| purchaseCount | int | No | RequestBody | Count of virtual machine instances to be created (purchased) in batch, which must be an integer greater than 0 (optional). The default is 1 |
| networkCapacityInMbps | int | No | RequestBody | Public network bandwidth in Mbps, an integer from 0 to 200. Setting it to 0 means no public IP will be assigned, with a default of 0 Mbps. |
| zoneName | String | No | RequestBody | Specify zone information. By default, it is empty and automatically selected by the system. The list of availability zones can be queried by calling the [ Query Availability Zone List ](BCC/API Reference/Other APIs/Query list of availability zones.md#Query list of availability zones)API. The naming convention for zoneName is lowercase "country-region-availability zone sequence", such as "cn-bj-a" for Beijing availability zone A. Dedicated instances use the zone where the dedicated server is located, so this field does not need to be specified. |
| internetChargeType | String | No | RequestBody | Charge type for public network bandwidth. Optional parameters are detailed in [internetChargeType](BCC/API Reference/Appendix.md#InternetChargeType). If internetChargeType is not specified, the default bill type is the same as that for BCC instances: prepaid instances default to subscription bandwidth billing, while postpaid instances default to billing based on actual bandwidth use. |
Response headers
No special headers are required beyond the standard ones.
Response parameters
| Parameter name | Types | Description |
|---|---|---|
| money | String | Total cost |
| count | String | Number of purchases |
| perMoney | String | Price per unit |
Error codes
| Error code | Error description | HTTP status code | Chinese explanation |
|---|---|---|---|
| BadRequest | invalid purchaseNum. | 400 | The purchase count must be greater than 0. |
| BadRequest | missing bcc config. | 400 | Missing BCC configuration |
| BadRequest | invalid instanceType. | 400 | Invalid instance type |
| Instance.InvalidateZoneException | Invalidate zone name. | 400 | Invalid availability zone |
Request example
Plain Text
1POST /v2/instance/bidPrice HTTP/1.1
2Host: bcc.bj.baidubce.com
3ContentType: application/json
4Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
5
6{
7 "instanceType": "N1",
8 "cpuCount": 2,
9 "memoryCapacityInGB": 2,
10 "rootDiskSizeInGb":45,
11 "rootDiskStorageType":"cloud_hp1",
12 "createCdsList": [
13 {
14 "storageType": "std1",
15 "cdsSizeInGB": 5
16 }
17 ],
18 "purchaseCount": 1
19}
Response example
Plain Text
1HTTP/1.1 200 OK
2x-bce-request-id: 1214cca7-4ad5-451d-9215-71cb844c0a50
3Date: Wed, 03 Dec 2014 06:42:19 GMT
4Content-Type: application/json;charset=UTF-8
5Server: BWS
6
7{
8 "money": "0.0011367",
9 "count": "1",
10 "perMoney": "0.0011367"
11}
