DELETE Bucket

Deletes an empty bucket. The request fails if there are any objects in thebucket, but the request succeeds if the bucket only contains soft-deletedobjects or incomplete uploads, such as ongoingXML API multipart uploads.Does not deletesoft-deleted objects.

The DELETE Bucket method is a simple DELETE request with bucket scope. You musthave the project owners role to delete buckets. Also, all DELETE Bucket requestsmust be authenticated.

As a best practice, after you delete all of the objects from a bucket youshould set the bucket ACLs so that no users can create objects in thebucket.

If there are objects in the bucket when you attempt to delete it you will get a409 Conflict status code and thebody of the error response will containBucketNotEmpty in theCode element.

If the bucket does not exist you will get a404 Not Found status code and thebody of the error response will containNoSuchBucket in theCode element.

Query string parameters

This request does not typically include query string parameters.

Seesigned URL query string parameters for information on the parametersyou include when creating and usingsigned URLs.

Request headers

HeaderDescriptionRequired
AuthorizationThe authentication string for the request.Yes
Content-Length

The length of the request body without headers (in bytes).

* Not required for requests that use chunked transfer encoding.

Yes*
DateThe date and time of the request.Yes
HostThe URI for Cloud Storage. For more information, seeRequest Endpoints.Yes
x-goog-user-projectThe project to be billed for charges associated with the request.No

Request body elements

This request does not include an XML document in the request body.

Request syntax

DELETE / HTTP/1.1Host:BUCKET_NAME.storage.googleapis.comDate:DATEContent-Length: 0Authorization:AUTHENTICATION_STRING

Response headers

The request can return a variety of response headers depending on the request headers you use.

Response body elements

The response does not include an XML document in the response body.

Example

The following example deletes a bucket named travel-maps.

Request

DELETE / HTTP/1.1Host: travel-maps.storage.googleapis.comDate: Mon, 15 Feb  2010 11:00:00 GMTContent-Length: 0Authorization: Bearer ya29.AHES6ZRVmB7fkLtd1XTmq6mo0S1wqZZi3-Lh_s-6Uw7p8vtgSwg

Response

HTTP/1.1 204 No ContentDate: Mon, 15 Feb  2010 11:00:01 GMTExpires: Mon, 15 Feb  2010 11:00:01 GMT

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-17 UTC.