Shift charge for disks
Updated at:2025-10-20
Description
- This API is used to change the charge type of a disk, supporting only two methods: switching from postpay to prepay or prepay to postpay.
- Switching from prepay to postpay offers two options: either take effect immediately or take effect after expiration.
- When a postpaid CDS is not mounted, or when the mounted BCC is not prepaid, converting from postpay to prepay is not allowed.
Request structure
Plain Text
1PUT /v{version}/volume/{volumeId}?{action} HTTP/1.1
2Host: bcc.bj.baidubce.com
3Authorization: authorization string
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 |
| volumeId | String | Yes | URL parameter | ID of the disk whose billing method is to be changed |
| action | String | Yes | Query | Action performed on the disk, current value: modifyChargeType |
| billing | [Billing](BCC/API Reference/Appendix.md#Billing) | No | RequestBody | Order details: This parameter is deprecated. When a postpaid CDS is not mounted or the mounted BCC is not prepaid, converting from postpay to prepay is disabled. The expiration time of the CDS after conversion aligns with the expiration time of the mounted prepaid BCC instance. |
| effectiveType | String | No | RequestBody | Conversion methods to postpay include: AtOnce (immediate conversion to postpay) and AfterExpiration (conversion to postpay after expiration). If not specified, it defaults to conversion after expiration. |
Response headers
No special headers are required beyond the standard ones.
Response parameters
There are no special response parameters
Error codes
| Error code | Error description | HTTP status code | Chinese explanation |
|---|---|---|---|
| Volume.VolumeTypeNotSupport | Volume type not support to_postpay. | 403 | Disk type does not support "conversion to postpay" |
| Volume.PaymentTypeNotSupportToPostpay | Payment type not support to_postpay | 403 | "Conversion to postpay" is not accepted |
| Volume.AutoRenewNotSupportToPostpay | Auto renew instance not support to_postpay operation. | 403 | Instances with auto-renewal enabled do not support "conversion to postpay" |
| Volume.ExpiredResourceNotSupportToPostpay | Expired resource not support to_postpay operation. | 403 | Expired resources do not support "conversion to postpay" |
| Volume.VolumeTypeNotSupportToPrepay | Volume type not support to_prepay. | 403 | Disk type does not support "conversion to prepay" |
| Volume.PrepaidInstanceOperationForbidden | Postpaid instances are not supported for this operation. | 409 | "Conversion to prepay" is not accepted |
| Volume.DiskStatusNotSupportBillingChange | The volume status not support billing change. | 409 | The disk status does not allow shifting charge |
Request example
Plain Text
1PUT /v2/volume/v-**********?modifyChargeType HTTP/1.1
2Host: bcc.bj.baidubce.com
3ContentType: application/json
4Authorization: authorization-string
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
