All Products
Search
Document Center

ENS:PutBucketLifecycle

Last Updated:Jan 15, 2026

Configures lifecycle rules for objects.

Operation description

  • You can configure up to 1,000 rules.
  • If an object meets multiple rules, the rule that has the earliest expiration time prevails.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
BucketNamestringYes

The name of the bucket.

test
RuleIdstringNo

The unique ID of the rule. The ID of a lifecycle rule can be up to 255 bytes in length.

  • You do not need to configure this parameter when you create a rule. The system automatically generates a unique ID.
  • When you update a rule, you need to specify this parameter. Make sure that the rule specified by RuleId exists. Otherwise, an error occurs.
1
StatusstringYes

The status of the rule. Valid values:

  • Enabled
  • Disabled
Enabled
PrefixstringNo

The prefix of a object name. The prefix must be unique.

  • If you specify a prefix, the rule applies only to objects in the bucket that match the prefix.
  • If you do not specify a prefix, the rule applies to all objects in the bucket.
image
CreatedBeforeDatestringNo

The expiration time. EOS executes a lifecycle rule for objects that were last updated before the expiration time.

Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.

Note ExpirationDays and CreateBeforeDate are mutually exclusive.
2023-10-12T05:45:00Z
ExpirationDayslongNo

The number of days from when the objects were last modified to when the lifecycle rule takes effect. The value must be a positive integer that is greater than 0.

Note ExpirationDays and CreateBeforeDate are mutually exclusive.
5
AllowSameActionOverlapstringNo

Specifies whether to allow overlapped prefixes. Valid values:

  • true
  • false (default)
false

Response parameters

ParameterTypeDescriptionExample
object

Schema of Response

RequestIdstring

The ID of the request.

62373E71-5521-4620-8AAB-133CCE49357A
RuleIdstring

The ID of the rule.

b8f93xxxxx4881xxxxxc71d991

Examples

Sample success responses

JSONformat

{
  "RequestId": "62373E71-5521-4620-8AAB-133CCE49357A",
  "RuleId": "b8f93xxxxx4881xxxxxc71d991"
}

Error codes

HTTP status codeError codeError messageDescription
400Invalid%sThe specified parameter %s is invalid.-
400InvalidArgumentDays and createBeforeDate can only choose one-
400InvalidArgumentOne bucket not allow exceed one thousand items of LifecycleRules.-
400InvalidArgumentOverlap for same action type.-
400InvalidBucketNameSpecified parameter BucketName is not valid.The specified BucketName parameter is invalid.
400InvalidLifecycleSchemeSpecified parameter LifecycleScheme is not valid.-
400InvalidTypeSpecified parameter Type is not valid.-
400OperationDeniedEngine lifecycle scheme does't support replication lifecycle rule configuration.-
400NoPermissionPermission denied.-
400InvalidParameter.%sThe specified field %s invalid. Please check it again.-
403AccessDeniedauth is not valid-
403UserDisableThe user has been disabled due to arrears.The user has been disabled due to arrears.
404NoSuchBucketThe specified bucket does not exist.The requested bucket does not exist.
404NoSuchLifecycleThe bucket lifecycle does not exist.-

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-12-26The Error code has changedView Change Details
2024-08-12The Error code has changed. The response structure of the API has changedView Change Details
2024-04-17The Error code has changedView Change Details