S3 · Versioning & retention
PutObjectRetention
/{bucket}/{key}?retentionSets or extends the retention of one object version.
Storage keeps the version until the date that you send. You can add retention or move the date later. You cannot shorten it.
- Role
- Editor or higher
- Support
- Partial
- Needs versionId. COMPLIANCE only. Retention can be added or extended, never shortened.
Path parameters
Query parameters
Headers
The workspace ID that must own the bucket. Another owner returns 403 AccessDenied.
Request body
The root element.
Send COMPLIANCE.
An ISO 8601 date in the future.
Responses
200OK
Storage saved the retention.
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.
- 400InvalidRequest
The request has no versionId, the mode is not COMPLIANCE, or the date is not in the future.
What to do: Send a versionId, COMPLIANCE mode, and a future RetainUntilDate.
- 403AccessDenied
The new date is earlier than the current one, or the key does not have the Editor role.
What to do: Send a date on or after the current RetainUntilDate.
- 404NoSuchKey
The bucket has no object at this key, or no version with this versionId.
What to do: Check the key and the versionId.
- 405MethodNotAllowed
The versionId names a delete marker, which has no bytes.
What to do: Use the versionId of a version that holds data. ListObjectVersions shows each one.
- 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.