Protect Bucket
POST
oss/v2/buckets/{bucketKey}/protect
Modifies the protection status of the specified bucket. When you protect a bucket, it cannot be deleted until you explicitly unprotect it. When you unprotect a bucket, it becomes eligible for deletion again.
You must be the owner of the bucket or have appropriate permissions to modify bucket protection settings.
This operation is idempotent. Protecting an already protected bucket or unprotecting an already unprotected bucket will not result in an error.
The protection status change takes effect immediately upon successful completion of the operation.
Resource Information
| Method and URI | POST https://developer.api.autodesk.com/oss/v2/buckets/{bucketKey}/protect |
| Authentication Context | App only |
| Required OAuth Scopes | bucket:update |
| Data Format | JSON |
Request
Headers
| Authorization* string | Must be Bearer <token>, where <token> is a two-legged access token obtained via a Client Credentials Grant flow. |
| Content-Type* string | Must be application/json |
* Required
Request
URI Parameters
| bucketKey string | The unique identifier of the bucket whose protection status is being modified. The bucket key must be URL-encoded. |
Request
Body Structure
| protection boolean | Sets the protection status of the bucket. Possible values:
|
Response
HTTP Status Code Summary
| 200 OK | The bucket protection status was successfully updated. If protection was set to true, bucket protection is now enabled; if set to false, it is now disabled. |
| 400 Bad Request | OSS was unable to process the request. The syntax of the request is malformed or the request is missing a required header. Do not repeat the request without fixing the issue. The response body may indicate what is wrong with the request |
| 401 Unauthorized | The supplied authorization header was not valid or the supplied token scope was not acceptable. Verify authentication and try again. |
| 403 Forbidden | The request was successfully validated but lacking the required permissions. Verify your credentials and permissions before you send this request again. |
| 404 Not Found | The requested resource could not be found. Verify the IDs of the resources you requested before you send this request again. |
| 500 Internal Server Error | An unexpected error occurred on the server, preventing it from completing your request. Please try again later. If the issue persists, contact the support team for assistance. |
Returns a string indicating protection status.
Example 1
Basic Successful Protect Bucket (200)
Request
curl --location 'https://developer.api.autodesk.com/oss/v2/buckets/prodbucket_03/protect' \
--header 'Authorization: Bearer eyJh...' \
--header 'Content-Type: application/json' \
--header 'x-ads-region: US' \
--data '{
"protection": true
}'
Response
HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: Authorization, Accept-Encoding, Range, Content-Type
Access-Control-Allow-Methods: GET, POST, PUT, DELETE
Access-Control-Allow-Origin: *
Content-Type: text/plain; charset=utf-8
Date: Tue, 26 Aug 2025 10:30:15 GMT
Server: Apigee Router
Content-Length: 43
Connection: keep-alive
Bucket prodbucket_03 protection set to true
Show More
Example 2
Basic Successful Unprotect Bucket (200)
Request
curl --location 'https://developer.api.autodesk.com/oss/v2/buckets/prodbucket_03/protect' \
--header 'Authorization: Bearer eyJhb...' \
--header 'Content-Type: application/json' \
--header 'x-ads-region: US' \
--data '{
"protection": false
}'
Response
HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: Authorization, Accept-Encoding, Range, Content-Type
Access-Control-Allow-Methods: GET, POST, PUT, DELETE
Access-Control-Allow-Origin: *
Content-Type: text/plain; charset=utf-8
Date: Tue, 26 Aug 2025 10:35:20 GMT
Server: Apigee Router
Content-Length: 44
Connection: keep-alive
Bucket prodbucket_03 protection set to false
Show More