You need to enable JavaScript to run this app.
Torch Object Storage

Torch Object Storage

Copy page
Download PDF
Managing lifecycle
Expiring objects via APIs
Copy page
Download PDF
Expiring objects via APIs
You can use APIs to instruct TOS to delete objects when they reach the end of their lifecycle. This topic explains how to set, modify, and view the expiration times for objects.​
Notes​
​
Category​
Considerations​
Start time​
The expiration time of an object is calculated by counting the number of days since the last modified time.​
Execution time​
TOS begins the deletion process at midnight after the expiration time is reached. For instance, if an object's last modified time is 2024-09-26 12:00 and its expiration time is set to three days, the object will expire at 2024-09-30 00:00.​
Priority​
Expiring objects via APIs takes precedence over lifecycle deletion rules. For instance, if an object's expiration time is set to five days and a lifecycle rule specifies deletion after three days, the object will be deleted after five days based on its expiration time.​
tip​
You can set both object expiration times and lifecycle rules simultaneously. For instance, if you configure a rule to transition objects with a specified prefix to Infrequent Access Storage three days after their last modified time, and you set the expiration time for an object with the specified prefix to five days, the object will transition to Infrequent Access Storage after three days and be deleted after five days.​
Versioning​
The process of expiring objects with multiple versions has two steps:​
  • At the first expiration: The object becomes a historical version with a deletion mark added.​
  • On subsequent expiration: The historical version follows the original object's expiration policy and the data is permanently deleted.​
Constraints and limitations​
You cannot set an expiration time for symlink objects.​
​
Steps​
​
Set expiration times
Modify expiration times
View expiration times
​
Adding an expiration time when uploading an object​
You can use the parameter x-tos-object-expires to set an object's expiration time. This parameter accepts a positive integer indicating the number of days after which the object will expire. The count begins at the object's last modified time, and the deletion task begins at midnight after the expiration time is reached. For instance, if the parameter x-tos-object-expires is set to 3 and the object's last modified time is 2024-09-26 12:00, the object will expire at 2024-09-30 00:00. The following APIs support this parameter:​
  • Adding an expiration time when uploading an object​
  • Adding an expiration time when appending an object​
  • Adding an expiration time when copying an object​
Adding an expiration time to an existing object​
You can use the parameter ObjectExpires in the SetObjectExpires API to set an expiration time for an object that has already been uploaded. This parameter accepts a positive integer or 0 and is expressed in days with the following semantics:​
  • Positive integer: The object will expire after the specified number of days. The count begins at the object's last modified time, and the deletion task begins at midnight after the expiration time is reached. For instance, if the parameter ObjectExpires is set to 3 and the object's last modified time is 2024-09-26 12:00, the object will expire at 2024-09-30 00:00.​
  • 0: The object will remain in the bucket indefinitely, unless it is manually deleted or removed via a lifecycle rule.​
For more information, see SetObjectExpires.​
​
Last updated: 2026.07.27 10:24:42