# SetLifecycleRulesRequest

**rules** object[] required

List of lifecycle rules to apply to the bucket.

Array [

**id** string required
  
  Unique identifier for the rule (max 255 chars). Use a descriptive name like `archive-old-logs` or `expire-temp-uploads`.
  
  **Possible values:** `<= 255 characters`
  
  **enabled** boolean required
  
  Whether the rule is currently active. Set to `false` to temporarily disable a rule without deleting it.
  When disabled, objects will not be transitioned or expired by this rule.
  
  **expiration** object
  
  Configuration for automatic object deletion (expiration).
  
  When the expiration condition is met, objects matching this rule are **permanently deleted**.
  
  ## Specify ONE Condition (Not Both)
  
  - `days`: Delete objects N days after their creation date
  - `date`: Delete all matching objects on a specific date
  
  **days** integer
  
  Number of days after object creation when the object will be deleted.
  The deletion happens at midnight UTC on the calculated expiration date.
  
  Example: If `days: 30` and an object was created on Dec 1, it expires on Dec 31.
  
  **date** date-time
  
  Specific date (at midnight UTC) when all matching objects will be deleted, regardless of when they were created.
  Use this for one-time cleanup operations or compliance deadlines.
  
  Must be a future date in RFC3339 format with midnight UTC time.
  
  **Example:** `2025-01-01T00:00:00Z`
  
  **transitions** object[]
  
  List of storage class transitions. Objects will transition through each defined step.
  Transitions must be in chronological order (earlier days/dates first).
  
  Array [
  
    **days** integer
  
    Number of days after object creation when the transition occurs.
    The transition happens at midnight UTC on the calculated date.
    
    Example: If `days: 60` and an object was created on Jan 1, it transitions on Mar 2.
    
    **date** date-time
    
    Specific date (at midnight UTC) when all matching objects will be transitioned, regardless of when they were created.
    Use this for planned migrations or cost optimization deadlines.
    
    Must be a future date in RFC3339 format with midnight UTC time.
    
    **Example:** `2025-06-01T00:00:00Z`
    
    **storage_class** StorageClass required
    
    Storage class for the bucket. Default is `STANDARD`.
    
    **Possible values:** [`STANDARD`, `STANDARD_IA`, `GLACIER`, `GLACIER_IR`]  
  
  ]
  
  **filter** object
  
  Optional scope for a lifecycle rule. When unset, the rule applies to every object in the bucket.
  
  **prefix** string
  
  Only apply this rule to objects whose keys start with the given prefix.
  For example, `logs/` scopes the rule to objects under that prefix.
  
]

SetLifecycleRulesRequest

```json
{

"rules": [

{

"id": "string",

"enabled": true,

"expiration": {

"days": 0,

"date": "2025-01-01T00:00:00Z"

},

"transitions": [

{

"days": 0,

"date": "2025-06-01T00:00:00Z",

"storage_class": "STANDARD"

}

],

"filter": {

"prefix": "string"

}

}

]

}
```
