delete method
Written by
Updated at March 19, 2025
Deletes an object.
For more information on getting started with the API and the general request format, see How to use the S3 API.
Request
DELETE /{bucket}/{key} HTTP/2
Path parameters
Parameter | Description |
---|---|
bucket |
Bucket name. |
key |
Object key. |
Request parameters
Parameter | Description |
---|---|
versionId |
Link to a specific version of the object. |
Headers
Use the appropriate common headers in your request.
Moreover, if governance-mode retention is set for an object version in a versioned bucket, make sure to use the below-specified header to bypass retention and confirm deletion. Only users with the storage.admin
role can delete a retained object version. To check the retention status, use the getObjectRetention method.
Header | Description |
---|---|
X-Amz-Bypass-Governance-Retention |
Header that confirms bypassing of the governance-mode retention. Set it to true . |
Response
Headers
Responses can only contain common headers.
Response codes
For a list of possible responses, see Responses.