S3 · Objects
DeleteObject
/{bucket}/{key}Deletes an object, or one version of an object.
Without versionId, storage removes the object. In a bucket with versioning on, it adds a delete marker and keeps the versions. With versionId, storage removes that version for good.
- Role
- Editor or higher
- Support
- Supported
- With versionId, removes that version. In a versioned bucket, adds a delete marker.
- A key with no object returns
404 NoSuchKey. Amazon S3 returns204for a missing key. - A version under object lock retention cannot be deleted before its retain-until date.
Path parameters
Query parameters
Remove this version for good.
Headers
The workspace ID that must own the bucket. Another owner returns 403 AccessDenied.
Responses
204No Content
Storage deleted the object, or added a delete marker.
Response headers
x-amz-version-idstringThe version that the delete removed or created.
x-amz-delete-markerbooleantrue when the delete added a delete marker.
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.
- 404NoSuchKey
The bucket has no object at this key, or no version with this versionId.
What to do: Check the key and the versionId.
- 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 Editor role, or the version is under object lock retention.
What to do: Use an Editor key. A retained version stays until its retain-until date.