delete method
Written by
Updated at September 30, 2024
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. |
Query parameters
Parameter | Description |
---|---|
versionId |
Link to a specific version of the object. |
Headers
Use the appropriate common headers in your request.
Moreover, if a lock with 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 retention status, use the getObjectRetention method.
Header | Description |
---|---|
X-Amz-Bypass-Governance-Retention |
Header that confirms bypassing of the governance retention. Set it to true . |
Response
Headers
Responses can only contain common response headers.
Response codes
For a list of possible responses, see Responses.