All Products
Search
Document Center

Object Storage Service:GetBucketInventory

Last Updated:Aug 28, 2026

The GetBucketInventory operation queries the specified inventory configuration for a bucket.

Usage notes

By default, an Alibaba Cloud account has the permission to view the specified inventory configuration of a bucket. To call this operation as a Resource Access Management (RAM) user or by using Security Token Service (STS), you must have the oss:GetBucketInventory permission.

Request syntax

GET /?inventory&inventoryId=inventoryId HTTP/1.1

Request parameters

ParameterTypeRequiredDescription
inventoryIdstringYesThe ID of the inventory rule to query.

Response elements

The following table describes the elements returned in the response. Some elements apply only to specific inventory configurations. For example, DayOfMonth applies only when Frequency is set to Monthly, and AutoDelete applies only when Frequency is set to Once. The elements that are specific to incremental inventories are described in the following subsection.

ElementTypeDescription
IdstringThe user-specified name of the inventory. The name must be unique within the bucket.
IsEnabledbooleanIndicates whether the inventory is enabled. Valid values: true and false. If the value is true, the inventory feature takes effect. If the value is false, no inventory is generated.
FiltercontainerThe prefix used to filter the inventory. If a prefix is specified, the inventory includes only the objects whose names match the prefix.
PrefixstringThe matching prefix of the filter rule. Parent node: Filter
DestinationcontainerThe information about where the inventory results are stored.
OSSBucketDestinationcontainerThe information about the bucket where the exported inventory results are stored. Parent node: Destination
FormatstringThe format of the exported inventory file. Valid values: CSV and Parquet. The Parquet format is currently supported only in the UK (London) region. Parent node: OSSBucketDestination
AccountIdstringThe account ID granted by the bucket owner. Parent node: OSSBucketDestination
RoleArnstringThe name of the role granted by the bucket owner for operation permissions. Format: acs:ram::uid:role/rolename Parent node: OSSBucketDestination
BucketstringThe bucket where the exported inventory file is stored. Parent node: OSSBucketDestination
PrefixstringThe prefix of the storage path for the inventory file. Parent node: OSSBucketDestination
EncryptioncontainerThe encryption method of the inventory file. Valid values: SSE-OSS and SSE-KMS. If the inventory file is not encrypted, this element is empty. Parent node: OSSBucketDestination
SSE-OSScontainerThe container for the SSE-OSS encryption method. Parent node: Encryption
SSE-KMScontainerThe container for the key used in the SSE-KMS encryption method. Parent node: Encryption
KeyIdstringThe ID of the KMS key. Parent node: SSE-KMS
SchedulecontainerThe container for the schedule information of the inventory export.
FrequencystringThe schedule for exporting the inventory file. Valid values: Daily, Weekly, Monthly, and Once. Parent node: Schedule
DayOfMonthpositive integerThe day of the month on which the inventory is exported. This element applies only when Frequency is set to Monthly. Valid values: 1 to 31. Parent node: Schedule
AutoDeletebooleanSpecifies whether the inventory configuration is automatically deleted after the one-time inventory run completes. This element is present only when Frequency is set to Once. Valid values: true and false. Parent node: Schedule
IncludedObjectVersionsstringSpecifies whether to include object version information in the inventory. Valid values: All and Current. If the value is All, the version information of all versions of the object is exported. If the value is Current, the version information of the current version of the object is exported.
OptionalFieldscontainerThe configuration items to include in the inventory results.
FieldstringThe configuration items included in the inventory results. Optional configuration items: Size, LastModifiedDate, TransitionTime, ETag, StorageClass, IsMultipartUploaded, EncryptionStatus, ObjectAcl, TaggingCount, ObjectType, and Crc64. Parent node: OptionalFields

Incremental inventory elements

The following table describes the elements that are specific to incremental inventories.

ElementTypeDescription
IncrementalInventorycontainerThe configuration information of the incremental inventory.
IsEnabledbooleanSpecifies whether to enable the incremental inventory. Valid values: true (enabled) and false (disabled). When the value is true, the incremental inventory feature is enabled and is not affected by the parent element being set to false. Parent node: IncrementalInventory
SchedulecontainerThe schedule of the incremental inventory export. Parent node: IncrementalInventory
Frequencypositive integerThe export frequency of the incremental inventory, in seconds. The system currently uses a fixed period of 600 seconds. During each period, the system automatically creates a directory prefix and generates the corresponding manifest file and multiple CSV files produced within that period. Custom frequency settings are not supported. Parent node: Schedule
OptionalFieldscontainerThe configuration items to include in the incremental inventory. Parent node: IncrementalInventory
FieldstringThe configuration items included in the incremental inventory. Parent node: OptionalFields

Incremental inventory record fields

The following fields describe records in an incremental inventory file:

  • SequenceNumber: The serial number of the record. The SequenceNumber of each record is unique. Records of the same object in the same bucket can be sorted by SequenceNumber, and the sorted records typically follow chronological order.

  • RecordType: The event type. Valid values:

    • CREATE: all upload operations that occur under the selected prefix, such as Put, Post, Append, MultipartUpload, and Copy.

    • UPDATE_METADATA: all metadata updates under the selected prefix.

    • DELETE: all deletion operations of objects under the selected prefix, such as DeleteObject and DeleteMultipleObjects, the generation of a delete marker after versioning is enabled, and lifecycle-based deletion. Deletions include creating a delete marker and permanent deletion. For a permanent deletion, the record retains only the core fields Bucket, Key, SequenceNumber, RecordType, RecordTimestamp, and VersionId, and all other columns are null.

  • RecordTimestamp: The timestamp of the record, in Greenwich Mean Time and accurate to the millisecond. Example: 2024-08-25 18:08:01.024.

  • Requester: The Alibaba Cloud ID or Principal ID of the requester.

  • RequestId: The unique identifier of the request.

  • SourceIp: The source IP address of the requester.

  • Key: The URL-encoded name of the object in the bucket.

  • VersionId: The version ID of the object. This field appears only when the configured inventory rule exports all versions.

    • If versioning is not enabled on the bucket for which the inventory rule is configured, this field is empty.

    • If versioning is enabled on the bucket for which the inventory rule is configured, this field displays the VersionId of the object.

  • IsDeleteMarker: Specifies whether the object version is a delete marker. This field appears only when the configured inventory rule exports all versions.

    • If versioning is not enabled on the bucket for which the inventory rule is configured, this field defaults to false.

    • If versioning is enabled on the bucket for which the inventory rule is configured, this field is true when the object is a delete marker, and false when the object is not a delete marker.

  • Size: The size of the object.

  • StorageClass: The storage class of the object.

  • LastModifiedDate: The last modified time of the object.

  • ETag: The ETag of the object. An ETag is created when the object is generated and identifies the content of the object.

    • For an object created by using the PutObject operation, the ETag is the MD5 hash of its content.

    • For an object created by using other methods, the ETag is a unique value generated based on certain calculation rules and is not the MD5 hash of its content.

  • IsMultipartUploaded: Specifies whether the object was uploaded by using multipart upload.

  • ObjectType: The type of the object.

  • ObjectAcl: The access control list of the object.

  • Crc64: The CRC-64 value of the object.

  • EncryptionStatus: Specifies whether the object is encrypted.

Examples

  • Example request

GET /?inventory&inventoryId=report1 HTTP/1.1
  • Example response

HTTP/1.1 200 OK
  x-oss-request-id: 56594298207FB304438516F9
  Date: Mon, 31 Oct 2016 12:00:00 GMT
  Server: AliyunOSS
  Content-Length: length

  <?xml version="1.0" encoding="UTF-8"?>
  <InventoryConfiguration>
     <Id>report1</Id>
     <IsEnabled>true</IsEnabled>
     <Destination>
        <OSSBucketDestination>
           <Format>CSV</Format>
           <AccountId>1000000000000000</AccountId>
           <RoleArn>acs:ram::1000000000000000:role/AliyunOSSRole</RoleArn>
           <Bucket>acs:oss:::bucket_0001</Bucket>
           <Prefix>prefix1</Prefix>
           <Encryption>
              <SSE-OSS/>
           </Encryption>
        </OSSBucketDestination>
     </Destination>
     <Schedule>
        <Frequency>Daily</Frequency>
     </Schedule>
     <Filter>
       <Prefix>myprefix/</Prefix>
     </Filter>
     <IncludedObjectVersions>All</IncludedObjectVersions>
     <OptionalFields>
        <Field>Size</Field>
        <Field>LastModifiedDate</Field>
        <Field>ETag</Field>
        <Field>StorageClass</Field>
        <Field>IsMultipartUploaded</Field>
        <Field>EncryptionStatus</Field>
     </OptionalFields>
  </InventoryConfiguration>

SDKs

The following SDKs support this operation:

ossutil CLI

For the ossutil command that corresponds to the GetBucketInventory operation, see get-bucket-inventory.