tencent cloud

Cloud Object Storage

Release Notes and Announcements
Release Notes
Announcements
Product Introduction
Overview
Features
Use Cases
Strengths
Concepts
Regions and Access Endpoints
Specifications and Limits
Service Regions and Service Providers
Billing
Billing Overview
Billing Method
Billable Items
Free Tier
Billing Examples
Viewing and Downloading Bill
Payment Overdue
FAQs
Getting Started
Console
Getting Started with COSBrowser
User Guide
Creating Request
Bucket
Object
Data Management
Batch Operation
Global Acceleration
Monitoring and Alarms
Operations Center
Data Processing
Content Moderation
Smart Toolbox
Data Processing Workflow
Application Integration
User Tools
Tool Overview
Installation and Configuration of Environment
COSBrowser
COSCLI (Beta)
COSCMD
COS Migration
FTP Server
Hadoop
COSDistCp
HDFS TO COS
GooseFS-Lite
Online Tools
Diagnostic Tool
Use Cases
Overview
Access Control and Permission Management
Performance Optimization
Accessing COS with AWS S3 SDK
Data Disaster Recovery and Backup
Domain Name Management Practice
Image Processing
Audio/Video Practices
Workflow
Direct Data Upload
Content Moderation
Data Security
Data Verification
Big Data Practice
COS Cost Optimization Solutions
Using COS in the Third-party Applications
Migration Guide
Migrating Local Data to COS
Migrating Data from Third-Party Cloud Storage Service to COS
Migrating Data from URL to COS
Migrating Data Within COS
Migrating Data Between HDFS and COS
Data Lake Storage
Cloud Native Datalake Storage
Metadata Accelerator
GooseFS
Data Processing
Data Processing Overview
Image Processing
Media Processing
Content Moderation
File Processing Service
File Preview
Troubleshooting
Obtaining RequestId
Slow Upload over Public Network
403 Error for COS Access
Resource Access Error
POST Object Common Exceptions
API Documentation
Introduction
Common Request Headers
Common Response Headers
Error Codes
Request Signature
Action List
Service APIs
Bucket APIs
Object APIs
Batch Operation APIs
Data Processing APIs
Job and Workflow
Content Moderation APIs
Cloud Antivirus API
SDK Documentation
SDK Overview
Preparations
Android SDK
C SDK
C++ SDK
.NET(C#) SDK
Flutter SDK
Go SDK
iOS SDK
Java SDK
JavaScript SDK
Node.js SDK
PHP SDK
Python SDK
React Native SDK
Mini Program SDK
Error Codes
Harmony SDK
Endpoint SDK Quality Optimization
Security and Compliance
Data Disaster Recovery
Data Security
Cloud Access Management
FAQs
Popular Questions
General
Billing
Domain Name Compliance Issues
Bucket Configuration
Domain Names and CDN
Object Operations
Logging and Monitoring
Permission Management
Data Processing
Data Security
Pre-signed URL Issues
SDKs
Tools
APIs
Agreements
Service Level Agreement
Privacy Policy
Data Processing And Security Agreement
Contact Us
Glossary

POST Bucket inventory

PDF
Focus Mode
Font Size
Last updated: 2025-12-09 11:20:25

Feature Description

This API is used to create a one-time inventory job for a bucket, which is different from PUT Bucket inventory. You can use this API to get the object inventory of a bucket and manage objects in a refined way.
Note:
You must add a bucket policy to the destination bucket for COS to write the output file of the inventory job to the destination bucket.
To call this API, make sure that you have the necessary permission for bucket inventory jobs; the bucket owner has this permission by default. If you do not have it, you should request it from the bucket owner first.
If you specify a prefix for the destination path of the inventory report, COS will automatically append a slash (/) to the specified prefix. For example, if you set the prefix to Prefix, COS will deliver the inventory report to Prefix/inventory_report.
If you submit another inventory job with the same ID or use the same ID as the periodic inventory job before the first one is completed, the server will return a duplication error.
Calling the POST Bucket inventory API to create an inventory task will start execution immediately. Each task will execute only once and not repeat periodically. If you need to export the manifest file periodically, please use the PUT Bucket inventory API.

Request

Sample request

POST /?inventory&id=inventory-configuration-ID HTTP/1.1
Host: <BucketName-APPID>.cos.<Region>.myqcloud.com
Date: GMT Date
Authorization: Auth String
Content-MD5: MD5
Note:
Host: <BucketName-APPID>.cos.<Region>.myqcloud.com. <BucketName-APPID> indicates the bucket name with APPID suffix, for example, examplebucket-1250000000. See Bucket Overview > Basic Information and Bucket Overview > Bucket Naming Conventions documentation. <Region> indicates the available region for COS. See Regions and Access Endpoints documentation.
Authorization: Auth String (For more information, see Request Signature.)

Request parameters

To call POST Bucket inventory, specify the following parameter:
Parameter
Description
Type
Required
id
Inventory job name. Default value: None
Valid character: a-z, A-Z, 0-9, -, _, .
Note: We recommend that you should not use the same ID as the periodic inventory job or submit duplicate IDs within one day. Otherwise, errors will be returned.
String
Yes

Request headers

This API only uses Common Request Headers.

Request body

You can use the XML language in request body to configure the inventory job by following the rules below:
Note:
The one-time inventory job cannot include IsEnabled or Schedule parameter.
All other parameters are the same as PUT Bucket Inventory.
The storage path of the one-time inventory report is the same as that of the periodic inventory report. For details, see Inventory Report Storage Path.
<InventoryConfiguration>
<Id>inventory-id</Id>
<Destination>
<COSBucketDestination>
<Format>CSV</Format>
<AccountId>100000000001</AccountId>
<Bucket>qcs::cos:ap-guangzhou::examplebucket-1250000000</Bucket>
<Prefix>cos_bucket_inventory</Prefix>
<Encryption>
<SSE-COS></SSE-COS>
</Encryption>
</COSBucketDestination>
</Destination>
<Filter>
<And>
<Prefix>myPrefix</Prefix>
<Tag>
<Key>string</Key>
<Value>string</Value>
</Tag>
</And>
</Filter>
<IncludedObjectVersions>All</IncludedObjectVersions>
<OptionalFields>
<Field>Size</Field>
<Field>LastModifiedDate</Field>
<Field>ETag</Field>
<Field>StorageClass</Field>
<Field>IsMultipartUploaded</Field>
<Field>ReplicationStatus</Field>
<Field>Tag</Field>
<Field>Crc64</Field>
<Field>x-cos-meta-*</Field>
</OptionalFields>
</InventoryConfiguration>

Response

Response headers

This API only returns Common Response Headers.

Response body

Upon success of initiating a one-time inventory task, JobId information will be returned.
<PostInventoryResult>
<JobId>Dgesgeqzd0dd***==</JobId>
</PostInventoryResult>
The specific content is as follows:
Node Name
Parent Node
Description
Type
PostInventoryResult
None
The one-time list is returned after successful initiation.
Container
JobId
PostInventoryResult
Upon success of initiating a one-time inventory task, JobId information will be returned.
String

Error codes

This API returns common error responses and error codes. For more information, see Error Codes.

Examples

Example: Filter by the specified prefix to generate a one-time inventory

Request

This example describes initiating an inventory job in examplebucket-1250000000.
The object (including its all versions) prefixed with myPrefix and tagged with {age:18} in the bucket will be analyzed.
Analysis dimensions: Size; LastModifiedDate; StorageClass; ETag; Tag.
The result will be saved in the format of CSV in the bucket examplebucket-1250000000.
If the inventory task was initiated on November 20, 2022, Manifest-related files of the inventory were placed in the following path in the destination bucket.
cos_bucket_inventory/1250000000/examplebucket/disposable/20221120/manifest.json
cos_bucket_inventory/1250000000/examplebucket/disposable/20221120/manifest.checksum
POST /?inventory&id=disposable HTTP/1.1
Date: Mon, 28 Aug 2018 02:53:38 GMT
Authorization: q-sign-algorithm=sha1&q-ak=************************************&q-sign-time=1503888878;1503889238&q-key-time=1503888878;1503889238&q-header-list=host&q-url-param-list=inventory&q-signature=****************************************
Content-MD5: AAq9nzrpsz5LJ4UEe1f6Q==
Host: examplebucket-1250000000.cos.ap-guangzhou.myqcloud.com
Content-Length: 1024

<?xml version = "1.0" encoding = "UTF-8">
<InventoryConfiguration xmlns = "http://....">
<Id>disposable</Id>
<Destination>
<COSBucketDestination>
<Format>CSV</Format>
<AccountId>100000000001</AccountId>
<Bucket>qcs::cos:ap-guangzhou::inventorybucket-1250000000</Bucket>
<Prefix>cos_bucket_inventory</Prefix>
</COSBucketDestination>
</Destination>
<Filter>
<And>
<Prefix>myPrefix</Prefix>
<Tag>
<Key>age</Key>
<Value>18</Value>
</Tag>
</And>
</Filter>
<IncludedObjectVersions>All</IncludedObjectVersions>
<OptionalFields>
<Field>Size</Field>
<Field>LastModifiedDate</Field>
<Field>StorageClass</Field>
<Field>ETag</Field>
<Field>Tag</Field>
</OptionalFields>
</InventoryConfiguration>

Response

After the above request is made, COS will return the following response, indicating that the inventory job has been successfully submitted.
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 0
Date: Mon, 28 Aug 2018 02:53:38 GMT
Server: tencent-cos
x-cos-request-id: NTlhMzg1ZWVfMjQ4OGY3MGFfMWE1NF8****

<PostInventoryResult>
<JobId>Dgesgeqzd0dd***==</JobId>
</PostInventoryResult>


Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback