Lifecycle Rules
+Automatically delete expired objects, clean up old versions, and abort incomplete multipart uploads using time-based lifecycle rules.
+ +How It Works
+
+ Lifecycle rules run on a background timer (Python threading.Timer), not a system cronjob. The enforcement cycle triggers every 3600 seconds (1 hour) by default. Each cycle scans all buckets with lifecycle configurations and applies matching rules.
+
Expiration Types
+| Type | +Description | +
|---|---|
| Expiration (Days) | +Delete current objects older than N days from their last modification | +
| Expiration (Date) | +Delete current objects after a specific date (ISO 8601 format) | +
| NoncurrentVersionExpiration | +Delete non-current (archived) versions older than N days from when they became non-current | +
| AbortIncompleteMultipartUpload | +Abort multipart uploads that have been in progress longer than N days | +
API Usage
+# Set lifecycle rule (delete objects older than 30 days)
+curl -X PUT "{{ api_base }}/<bucket>?lifecycle" \
+ -H "Content-Type: application/json" \
+ -H "X-Access-Key: <key>" -H "X-Secret-Key: <secret>" \
+ -d '[{
+ "ID": "expire-old-objects",
+ "Status": "Enabled",
+ "Prefix": "",
+ "Expiration": {"Days": 30}
+ }]'
+
+# Abort incomplete multipart uploads after 7 days
+curl -X PUT "{{ api_base }}/<bucket>?lifecycle" \
+ -H "Content-Type: application/json" \
+ -H "X-Access-Key: <key>" -H "X-Secret-Key: <secret>" \
+ -d '[{
+ "ID": "cleanup-multipart",
+ "Status": "Enabled",
+ "AbortIncompleteMultipartUpload": {"DaysAfterInitiation": 7}
+ }]'
+
+# Get current lifecycle configuration
+curl "{{ api_base }}/<bucket>?lifecycle" \
+ -H "X-Access-Key: <key>" -H "X-Secret-Key: <secret>"
+
+ Prefix field to scope rules to specific paths (e.g., "logs/"). Leave empty to apply to all objects in the bucket.
+ Troubleshooting & tips
API_BASE_URL incorrectX-Forwarded-Host/Proto headers, or explicitly set API_BASE_URL to your public domain.RATE_LIMIT_DEFAULT exceeded (200/min)RATE_LIMIT_STORAGE_URI=redis://host:port) for distributed setups, or upload in smaller batches.