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

Torch Object Storage

Copy page
Download PDF
WORM object
PutObjectRetention
Copy page
Download PDF
PutObjectRetention
Function Description​
This interface is used to create or modify the retention policy of an object.​
Prerequisites​
Before creating an object retention policy using the PutObjectRetention API, you must first enable the object lock feature. For detailed instructions, see Set Object Retention Period.​
Precautions​
  • When versioning is enabled for a storage bucket, if no version number is specified, a retention policy will be applied to the latest version of the object.​
  • The object retention period can only be extended and cannot be shortened.​
Request syntax​
​
PUT /objectname?retention HTTP/1.1​
Host: bucketname.tos-cn-beijing.volces.com​
Date: GMT Date​
Authorization: authorization string​
​
{ ​
"Mode": "COMPLIANCE",​
"RetainUntilDate": "2025-07-22T00:00:00Z"​
}​
​
Request parameters and headers​
The public message header used by this request. See Common parameters.​
​
Name​
Location​
Type​
Required​
Sample Value​
Description​
retention​
Query​
String​
Yes​
-​
A special identifier representing a PutObjectRetention request.​
versionId​
Query​
String​
No​
57AF1A32CECB56721267​
The version number of the object.​
​
Request body elements​
​
Name​
Type​
Required​
Sample Value​
Description​
Mode​
String​
Yes​
COMPLIANCE​
The retention policy mode only accepts COMPLIANCE as its value, which represents compliance mode. In this mode, no user can delete or overwrite locked objects during the retention period.​
RetainUntilDate​
String​
Yes​
2025-01-01T00:00:00Z​
Retention period, used to specify the deadline by which an object cannot be deleted or overwritten. The time format is YYYY-MM-DDTHH:mm:ssZ.​
​
Response headers​
This request returns public response message headers.​
Response body elements​
There is no message element in the response to this request.​
Sample request​
​
PUT /objectname?retention HTTP/1.1​
Host: bucketname.tos-cn-beijing.volces.com​
Date: Fri, 30 Jul 2021 13:59:18 GMT​
Authorization: authorization string​
​
{ ​
"Mode": "COMPLIANCE",​
"RetainUntilDate": "2025-07-22T00:00:00Z"​
}​
​
Sample response​
​
HTTP/1.1 200 OK​
x-tos-id-2: f91b0c03a01300c1-a444ed0 ​
x-tos-request-id: f91b0c03a01300c1-a444ed0 ​
Date: Fri, 30 Jul 2021 06:45:39 GMT​
server: TosServer​
Content-Length: 0​
​
​
Last updated: 2025.09.29 17:27:02