Zum Inhalt springen

Object Lock: Configure Default Retention

Zuletzt aktualisiert am

A default retention policy automatically applies a retention period to every new object uploaded to a bucket. This saves you from having to set retention on each object individually.

curl -X PUT \
"https://object-storage.api.{region}.stackit.cloud/v1/project/{projectId}/bucket/{bucketName}/default-retention" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"mode": "COMPLIANCE",
"days": 90
}'

Response (HTTP 200):

{
"project": "cd5e788d-5b7b-4ab9-a20d-e790205df10b",
"bucket": "my-compliant-bucket",
"mode": "COMPLIANCE",
"days": 90
}
curl -X GET \
"https://object-storage.api.{region}.stackit.cloud/v1/project/{projectId}/bucket/{bucketName}/default-retention" \
-H "Authorization: Bearer $TOKEN"

Response (HTTP 200):

{
"project": "cd5e788d-5b7b-4ab9-a20d-e790205df10b",
"bucket": "my-compliant-bucket",
"mode": "COMPLIANCE",
"days": 90
}

Returns HTTP 404 if no default retention is configured, if Object Lock is not enabled on the bucket, or if the bucket does not exist.

curl -X DELETE \
"https://object-storage.api.{region}.stackit.cloud/v1/project/{projectId}/bucket/{bucketName}/default-retention" \
-H "Authorization: Bearer $TOKEN"

Response (HTTP 200):

{
"project": "cd5e788d-5b7b-4ab9-a20d-e790205df10b",
"bucket": "my-compliant-bucket"
}

Important: Removing the default retention only affects future uploads. Objects that already have a retention period will keep their existing protection. Object Lock itself remains active on the bucket.

You can change the default retention mode and duration at any time by calling the PUT endpoint again. This change only applies to objects uploaded after the update.