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

Torch Object Storage

Copy page
Download PDF
Basic Object Operations
SetObjectExpires
Copy page
Download PDF
SetObjectExpires
Feature description​
This interface adds or modifies the expiration time of an object.​
Request syntax​
​
POST /ObjectName?objectExpires HTTP/1.1​
Host: bucketname.tos-cn-beijing.volces.com​
Date: Thu, 28 Aug 2025 09:48:41 GMT​
Authorization: authorization string​
{ ​
"ObjectExpires": 1​
}​
​
Request parameters and headers​
This request uses common request headers. See common parameters.​
​
Name​
Location​
Type​
Required​
Sample value​
Note​
objectExpires​
Query​
String​
Yes​
-​
Special identifier representing the SetObjectExpires request.​
​
Request body elements​
​
Name​
Type​
Required​
Sample value​
Note​
ObjectExpires​
Integer​
Yes​
1​
Add or modify the expiration time of an object. After expiration, TOS automatically deletes the object. The unit is days. The values are described as follows:​
  • Positive integer: the object expires at the specified time, calculated from the object's Last-Modified time. Deletion begins at midnight after the expiration time. For example, if the ObjectExpires parameter is set to3and the object's Last-Modified time is 2024-09-26 12:00, then the object expires at 2024-09-30 00:00.​
  • 0: Never expires; the object will remain in the bucket until you manually delete it or configure a lifecycle rule to delete it.​
  • You can set this parameter value to0to make objects with a specified expiration time never expire.​
tip​
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.​
​
Response headers​
This request returns common response headers. See common parameters.​
Response body elements​
No elements are used in this response.​
Sample request​
​
POST /data.txt?objectExpires HTTP/1.1​
Host: bucketname.tos-cn-beijing.volces.com​
Date: Thu, 28 Aug 2025 09:32:02 +0000​
Authorization: authorization string​
{ ​
"ObjectExpires": 1​
}​
​
Sample response​
​
HTTP/1.1 204 No Content​
Date: Thu, 28 Aug 2025 09:48:41 GMT​
Server: TosServer​
x-tos-id-2: fb7701b025f994d568b025f9-b8943ad​
x-tos-request-id: fb7701b025f994d568b025f9-b8943ad​
​
​
Last updated: 2025.09.08 18:00:17