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

Torch Object Storage

Copy page
Download PDF
Retention Policy
PutBucketObjectLockConfiguration
Copy page
Download PDF
PutBucketObjectLockConfiguration
Function Description​
This interface is used to configure the bucket retention policy. After configuring the bucket retention policy, if no retention period is specified when uploading an object, the newly uploaded object will inherit the bucket's retention period by default.​
Precautions​
  • Once a retention period is set for an object, it cannot be canceled and will only expire automatically when the retention period ends.​
  • After the bucket retention policy is configured, if a newly uploaded object does not have an individual retention period set, it will inherit the bucket retention period by default and automatically enter the locked state. Objects uploaded before the bucket retention period is set will not automatically inherit that retention period.​
  • If only the object lock feature is enabled without setting either the bucket retention period or the object retention period, objects will not enter the locked state and cannot obtain protection against deletion or overwriting.​
Request syntax​
​
PUT /?object-lock HTTP/1.1​
Host: bucketname.tos-cn-beijing.volces.com​
Date: GMT Date​
Authorization: authorization string​
​
{ ​
"ObjectLockEnabled": "Enabled",​
"Rule": {​
"DefaultRetention": {​
"Days": 100,​
"Mode": "COMPLIANCE"​
}​
} ​
}​
​
Request parameters and headers​
The public message header used by this request. See Common parameters.​
​
Name​
Location​
Type​
Required​
Sample Value​
Description​
object-lock​
Query​
String​
Yes​
-​
A special identifier representing the PutBucketObjectLockConfiguration request.​
​
Request body elements​
​
Name​
Type​
Required​
Sample Value​
Description​
ObjectLockEnabled​
String​
Yes​
Enabled​
Whether to enable the retention policy; the only valid value is Enabled, which indicates that the retention policy is enabled.​
Rule​
Object​
No​
-​
Bucket retention policy rules.​
DefaultRetention​
Object​
No​
-​
Default retention policy for buckets.​
Parent Node: Rule.​
Days​
Integer​
No​
1​
Object lock duration: During the specified number of days, the object cannot be deleted or overwritten. The unit is days, with a valid range of 1 to 36,500 days.​
tip​
Only one of the Days or Years parameters needs to be set.​
Parent Node: DefaultRetention​
Years​
Integer​
No​
1​
Object lock duration: During the specified number of years, the object cannot be deleted or overwritten. The unit is years, with a valid range of 1 to 100 years. One year is defined as 365 days.​
tip​
Only one of the Days or Years parameters needs to be set.​
Parent Node: DefaultRetention​
Mode​
String​
No​
COMPLIANCE​
Retention policy mode, with the only valid value being COMPLIANCE, indicates compliance mode, in which no user can delete or overwrite locked objects during the retention period.​
Parent Node: DefaultRetention​
​
Response headers​
This request returns public response message headers.​
Response body elements​
There is no message element in this request response.​
Sample request 1​
Enable the object lock feature and set the retention period to 100 days.​
​
PUT /?object-lock HTTP/1.1​
Host: bucketname.tos-cn-beijing.volces.com​
Date: Fri, 30 Jul 2021 13:59:18 GMT​
Authorization: authorization string​
​
{ ​
"ObjectLockEnabled": "Enabled",​
"Rule": {​
"DefaultRetention": {​
"Days": 100,​
"Mode": "COMPLIANCE"​
}​
} ​
}​
​
Sample response 1​
​
HTTP/1.1 200 OK​
x-tos-id-2: f91b0c03a01300c1-a444cd0 ​
x-tos-request-id: f91b0c03a01300c1-a444cd0 ​
Date: Fri, 30 Jul 2021 06:45:39 GMT​
server: TosServer​
Content-Length: 0​
​
Sample request 2​
Enable only the object lock function without setting a retention period.​
​
PUT /?object-lock HTTP/1.1​
Host: bucketname.tos-cn-beijing.volces.com​
Date: Fri, 30 Jul 2021 13:59:18 GMT​
Authorization: authorization string​
​
{ ​
"ObjectLockEnabled": "Enabled" ​
}​
​
Sample response 2​
​
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