S3 · Versioning & retention
PutObjectLockConfiguration
/{bucket}?object-lockTurns on object lock, and sets the default retention for new versions.
Object lock keeps each retained version until its retain-until date. Nobody can delete the version or shorten the date before then. This call also turns on versioning.
- Role
- Editor or higher
- Support
- Partial
- COMPLIANCE mode with a default in days. Years, GOVERNANCE, and legal hold return 501.
- Without Rule, object lock is on and new versions get no default retention.
Path parameters
The bucket name.
Query parameters
Selects this operation. Send it with no value.
Headers
The workspace ID that must own the bucket. Another owner returns 403 AccessDenied.
Request body
The root element.
Send Enabled.
The default retention for new versions.
Responses
200OK
Storage saved the settings.
This response has no body.
Errors
Select an error in the response example to see its XML body. Any request can also get the common errors, such as SignatureDoesNotMatch.
- 501NotImplemented
The body uses Years, GOVERNANCE mode, or legal hold.
What to do: Send COMPLIANCE mode with Days.
- 404NoSuchBucket
No bucket has this name, or the bucket was deleted.
What to do: Check the bucket name. ListBuckets shows the buckets of the workspace.
- 403AccessDenied
The key does not have the role for this operation, or the bucket is in another workspace.
What to do: Use a key of the workspace that owns the bucket, with the role above.