Enabling Bucket Recycle Bin Functionality
Updated at:2025-11-03
API description
This API activates the Bucket Trash feature. The user must own the source bucket with FULL_CONTROL permission and also be the owner of the target bucket.
Request URI
PUT /v1/{bucketName}/?trash
| Parameter name | Parameter type | Required or not | Description | Example value | Parameter location |
|---|---|---|---|---|---|
| bucketName | String | Yes | Bucket name | "bucketName_example" | Path |
Parameters of request body
Description of the data structure of request body fields
| Parameter name | Parameter type | Required or not | Description | Example value |
|---|---|---|---|---|
| trashDir | String | No | The name of the trash directory has a length limit and is optional. If left empty, it defaults to ".trash.\ | trashDirName |
Response body parameters
None
Request example
JSON
1PUT /v1/bucketName_example/?trash
2 <Common request headers>
3{
4 "trashDir" : "trashDirName"
5}
Response example
None
Error code
| Error code | Error description | HTTP status code | Chinese explanation |
|---|---|---|---|
| MalformedJSON | Json format error | 400 | Json format error |
| EntityTooLarge | The trash directory name is too long | 400 | Not exceeding 1024 bytes |
| InvalidTrashDirectoryName | The trash directory contains invalid characters | 400 | It can only contain letters, numbers, Chinese characters, underscores (_), hyphens (-), and decimal points (.). |
| NoSuchBucket | The bucket does not exist | 404 | The bucket does not exist |
| AccessDenied | No permission | 403 | Only the bucket owner with FULL_CONTROL permission can perform this operation. |
