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 conditions that must be met for the action to occur.
Action Defines the action to occur when the specified conditions are met.
Delete Action element to delete objects in the bucket.
SetStorageClass Action element to change the storage class of objects in the bucket.
Condition Conditions that must be met for the action to occurs. Every rule contains at least one 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.
CustomTimeBefore Condition element that matches objects whose Custom-Time metadata contains a date that's older than the date set by this condition. CustomTimeBefore is an ISO date string without a time zone, e.g. 2020-02-25.
DaysSinceCustomTime Condition element that matches objects whose Custom-Time metadata is more than DaysSinceCustomTime days old.
DaysSinceNoncurrentTime Condition element relevant only for versioned objects. Matches objects that have been noncurrent for more than the specified number of days.
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.
MatchesStorageClass Condition element that matches objects that have the given storage class.
NoncurrentTimeBefore Condition element relevant only for versioned objects. Matches objects that became noncurrent on a date prior to the date specified in this condition. NoncurrentTimeBefore is an ISO date string without a time zone, e.g. 2020-02-25.
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.