Deleting a Bucket

Last Updated At: 2025-10-21 09:10:00

Description

Before deleting a bucket, make sure that all the data and incomplete multipart uploads in the bucket have been deleted; otherwise, the bucket cannot be deleted.

Request

Syntax example:

DELETE / HTTP/1.1
Host: <BucketName-APPID>.<Endpoint>
Date: GMT Date
Authorization: Auth String

Note:

Authorization: Auth String (See Request Signature for details.)

Request Line

DELETE / HTTP/1.1

This API accepts DELETE requests.

Request Header

Common Headers

This request uses common request headers. For details, see Common Request Headers.

Non-common Headers

This request has no special request header information.

Request Body

The request body of this request is empty.

Response

Response Headers

Common Response Headers

This response uses common response headers. For details, see Public Response Header.

Special Response Headers

There are no special response headers for this response operation.

Response Body

The response body is empty.

Error Analysis

The following describes some special but common errors that may occur with this request:

Error Code Description HTTP Status Code
BucketNotEmpty 409 Conflict The bucket is not empty and cannot be deleted.
AccessDenied 403 Forbidden Deleting a bucket also requires a signature. If this error code is returned, it means that you do not have permission to access the bucket you want to delete.
NoSuchBucket 404 Not Found If this error code is returned, it means the bucket you want to delete is not found.

For more information on COS error codes or the complete list of product errors, please refer to the Error Codes document.

Practical Case

Request

DELETE / HTTP/1.1
Host: <BucketName-APPID>.<Endpoint>
Date: Wed, 23 Oct 2016 21:32:00 GMT
Authorization: q-sign-algorithm=sha1&q-ak=AKIDxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&q-sign-time=1484708950;32557604950&q-key-time=1484708950;32557604950&q-header-list=host&q-url-param-list=&q-signature=2b27b72ad2540ff2dde341dc7579a66ee8cb2afc

Response

HTTP/1.1 204 OK
Content-Type: application/xml
Content-Length: 0
Connection: keep-alive
Date: Wed, 23 Oct 2016 21:32:00 GMT
x-cos-request-id: NTg3ZWRjNjBfOTgxZjRlXzZhYjlfMTg0