Batch Unsubscribe Prepaid Instances
Updated at:2025-10-20
This API is used for batch unsubscription of subscribed (prepaid) instances.
- Supports the release of prepaid cloud server instances. Once released, the physical resources are reclaimed, and all associated data is permanently lost without recovery options.
- A single operation can handle up to 20 instances at most.
- The release of expired prepaid resources, such as instances and their associated CDS, EIP, etc., is not supported.
- For details on prepaid resource release refund rules, please see Refund Instructions.
Request structure
Plain Text
1 POST /v{version}/instance/batchRefundResource HTTP/1.1
2 Host: bcc.bj.baidubce.com
3 Authorization: authorization string
4 {
5 "instanceIds": ["instanceId"],
6 "relatedReleaseFlag": relatedReleaseFlag,
7 "deleteCdsSnapshotFlag":deleteCdsSnapshotFlag,
8 "deleteRelatedEnisFlag" : deleteRelatedEnisFlag
9 }
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 |
| instanceIds | Yes | RequestBody | List of instance IDs, with a single operation supporting up to 20 instances | |
| relatedReleaseFlag | boolean | No | RequestBody | Whether to release the EIPs and data disks currently attached on the instance at the same time Default: false, not releasing associated resources.Note: The prepaid CDS disks associated with the instance will be forcibly released along with the instance. |
| deleteCdsSnapshotFlag | boolean | No | RequestBody | Determine whether to release cloud disk server snapshots. Default: false, meaning associated resources will not be released. |
| deleteRelatedEnisFlag | boolean | No | RequestBody | Determine whether to delete the associated ENI when an instance is released. Default: false, meaning associated resources will not be deleted. |
Response headers
There are no special headers required beyond the common headers.
Response parameters
| Parameter name | Types | Description |
|---|---|---|
| failedInstanceIds | List of instances that failed to be deleted |
Error codes
| Error code | Error description | HTTP status code | Chinese explanation |
|---|---|---|---|
| Instance.DeletionProtection | Instance can not release with DeletionProtection. | 403 | Releasing virtual machines under deletion protection is not allowed |
| InsufficientCreditException | Insufficient user refund quota | 400 | Insufficient quota for user refunds |
| BadRequest | The size of the prepay instances is limited to 20. | 400 | A single operation supports up to 20 instances |
| BadRequest | Instanceid status not support delete | 400 | Incorrect instance status |
| Instance.ReleaseNotPrepay | This interface not support delete postpay instance | 403 | Postpaid virtual machines cannot be released |
Request example
Plain Text
1POST /v2/instance/batchRefundResource HTTP/1.1
2Host: bcc.bj.baidubce.com
3ContentType: application/json
4Authorization: bce-auth-v1/f81d3b***
5{
6 "instanceIds": ["instanceId"],
7 "relatedReleaseFlag": true,
8 "deleteCdsSnapshotFlag":true,
9 "deleteRelatedEnisFlag" : true
10}
Response example
Plain Text
1 HTTP/1.1 200 OK
2 x-bce-request-id: 1214cca7-4ad5-451d-9215-71cb844c0a50
3 Date: Wed, 03 Dec 2024 06:42:19 GMT
4 Content-Type: application/json;charset=UTF-8
5 Server: BWS
6 {
7 "failedInstanceIds": []
8 }
