Convert to prepay in batch
Updated at:2025-10-20
This API is used to batch convert a BCC instance's charge type from pay-as-you-go (postpay) to subscription (prepay).
Request structure
Plain Text
1 POST /v{version}/instance/batch/charging?{action} HTTP/1.1
2 Host: bcc.bj.baidubce.com
3 Authorization: authorization string
4
5 {
6 "config": [
7 {
8 "instanceId": instanceId1,
9 "duration": duration,
10 "autoPay": autoPay,
11 "cdsList": [volumeId1, volumeId2]
12 },
13 {
14 "instanceId": instanceId2,
15 "duration": duration,
16 "autoPay": autoPay,
17 "cdsList": [volumeId3, volumeId4]
18 }
19 ]
20 }
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 |
| action | String | Yes | Query | Operation performed on the instance, current value: toPrepay |
| config | List<[PrepayConfig](BCC/API Reference/Appendix.md#PrepayConfig)> | Yes | RequestBody | Instances for batch convert to prepay, maximum 20 instances |
Response headers
No special headers are required beyond the standard ones.
Response parameters
| Parameter name | Types | Description |
|---|---|---|
| orderId | String | Order Identifier. |
Request example
Plain Text
1POST /v2/instance/batch/charging?toPrepay HTTP/1.1
2Host: bcc.bj.baidubce.com
3ContentType: application/json
4Authorization: bce-auth-v1/f81d3b34e48048f***
5{
6 "config": [
7 {
8 "instanceId": "i-43TqYnng",
9 "duration": 1,
10 "autoPay": true,
11 ""cdsList": ["v-tP2MJ3YI","v-9eLRwv8n"]
12 },
13 {
14 "instanceId": "i-4D3Jinng",
15 "duration": 1,
16 "autoPay": true,
17 ""cdsList": ["all"]
18 }
19 ]
20}
21
Response example
Plain Text
1HTTP/1.1 200 OK
2x-bce-request-id: a41fdefe-28a6-4cb5-87b5-c88caf412a1c
3Date: Thu, 23 Mar 2023 06:30:58 GMT
4Content-Type: application/json;charset=UTF-8
5Server: BWS
6{
7 "orderId": "5c001b75e24d***"
8}
