All Products
Search
Document Center

Object Storage Service:GetBucketWorm

Last Updated:Jun 16, 2026

Queries the retention policy configured for a specified bucket.

Note

If the retention policy specified by the ID in the request does not exist, OSS returns 404.

Usage notes

OSS supports the Write Once Read Many (WORM) strategy, which prevents objects from being deleted or overwritten for a specified period of time. You can configure a time-based retention policy for a bucket with a retention period ranging from one day to 70 years.

After a bucket's retention policy is locked, you can read objects from or upload objects to the bucket. However, the objects and the retention policy cannot be deleted within the retention period. You can delete objects only after the retention period expires.

Request headers

A GetBucketWorm request contains only common request headers. For more information, see Common request headers.

Response headers

The response to a GetBucketWorm request contains only common response headers. For more information, see Common response headers.

Response elements

Element

Type

Description

WormConfiguration

Container

The root node.

Child nodes: WormId, State, RetentionPeriodInDays, and CreationDate

WormId

String

The ID of the retention policy.

State

String

The status of the retention policy.

Valid values:

  • InProgress: the retention policy has been created but is not yet locked. By default, a retention policy enters the InProgress state after creation. The state remains valid for 24 hours.

  • Locked: the retention policy is locked.

RetentionPeriodInDays

Positive integer

The number of days for which objects can be retained.

CreationDate

String

The time when the retention policy was created.

Examples

  • Sample request

    GET /? worm HTTP/1.1
    Date: Fri, 16 Oct 2020 11:18:32 GMT
    Host: BucketName.oss.aliyuncs.com
    Authorization: SignatureValue
  • Sample response

    HTTP/1.1 200 OK
    x-oss-request-id: 5374A2880232A65C2300****
    Date: Fri, 16 Oct 2020 11:18:32 GMT
    Content-Type: application/xml
    Content-Length: length
    <WormConfiguration>
      <WormId>1666E2CFB2B3418****</WormId>
      <State>Locked</State>
      <RetentionPeriodInDays>1</RetentionPeriodInDays>
      <CreationDate>2020-10-15T15:50:32</CreationDate>
    </WormConfiguration>

OSS SDKs

The following OSS SDKs support the GetBucketWorm operation:

ossutil

For the ossutil command that corresponds to the GetBucketWorm operation, see get-bucket-worm.