Get bucket lifecycle

To list a bucket's lifecycle configuration you make a GET request that is scoped to a bucket and you use the lifecycle query string parameter. The lifecycle configuration is returned in an XML document in the response body.

Query string parameters

Parameter Description Required
lifecycle You can use this to display the lifecycle configuration of an existing bucket. No

Request headers

See common request headers.

Request body elements

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

Request syntax

The following syntax applies to GET Bucket requests that use the lifecycle query string parameter.

GET /?lifecycle HTTP/1.1
Host: <bucket>.storage.googleapis.com
Date: <date>
Content-Length: <request body length>
Authorization: <authentication string>

Response headers

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

Response body elements

The following response body elements are applicable only if you use the lifecycle query string parameter to display the bucket's lifecycle configuration.

Element Description
LifecycleConfiguration Defines the lifecycle management policies for the bucket, which contains 0 or more (up to 100) rules. An empty element (for example <LifecycleConfiguration/>) means lifecycle management is not enabled for the bucket.
Rule Defines a lifecycle management rule, which is made of an action and the condition under which the action will be taken.
Action Defines the action to be taken, which must contain one and only one specific action element.
Delete Action element to delete objects in the bucket.
Condition Defines the condition under which the action will be taken, which must contain at least one specific condition element.
Age Condition element that matches objects over the specified age (in days).
CreatedBefore Condition element that matches objects created before midnight of the specified date in UTC. The value is an ISO date string without a time zone, e.g. "2019-01-15".
NumberOfNewerVersions Condition element relevant only for versioned objects. If the value is N, the condition is satisfied when there are at least N versions (including the live version) newer than this version of the object.
IsLive Condition element typically only used in conjunction with object versioning. When set to false, this condition is satisfied for any noncurrent version of an object. When set to true, this condition is satisfied for the live version of an object. If you don't use object versioning, all your objects are considered live and match when IsLive is true.
Was this page helpful? Let us know how we did:

Send feedback about...

Cloud Storage
Need help? Visit our support page.