DELETE Object

Deletes an object.

If you make a DELETE request for an object that doesn't exist, youwill get a404 Not Found statuscode and the body of the error response will containNoSuchKeyin theCode element.

Query string parameters

ParameterDescriptionRequired
generationYou can use this if you want to delete a specific object generation. If this query parameter is used on a versioned bucket and the generation specified is the live version of the object, the version does not become a noncurrent version of the object, but instead is deleted completely.No

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-if-generation-matchIn order for the request to succeed, the value you specify for this header must match thegeneration of the object you're requesting. If it does not, the request fails with a412 Precondition Failed status code.No
x-goog-if-metageneration-matchIn order for the request to succeed, the value you specify for this header must match themetageneration of the object you're requesting. If it does not, the request fails with a412 Precondition Failed status code.No
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 /OBJECT_NAME 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 sample deletes an object named paris.jpg.

Request

DELETE /paris.jpg 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 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 2026-02-19 UTC.