tencent cloud

Cloud Object Storage

最新情報とお知らせ
製品アップデート情報
製品のお知らせ
製品概要
製品概要
機能概要
応用シナリオ
製品の優位性
基本概念
リージョンとアクセスドメイン名
仕様と制限
製品の課金
課金概要
課金方式
課金項目
無料利用枠
記帳例
請求書の確認とダウンロード
お支払い遅れについて
よくある質問
クイックスタート
コンソールクイックスタート
COSBrowserクイックスタート
ユーザーガイド
リクエストの作成
バケット
オブジェクト
データ管理
バッチ処理
グローバルアクセラレーション
監視とアラーム
運用管理センター
データ処理
インテリジェントツールボックス使用ガイド
データワークフロー
アプリ統合
ツールガイド
ツール概要
環境のインストールと設定
COSBrowserツール
COSCLIツール
COSCMDツール
COS Migrationツール
FTP Serverツール
Hadoopツール
COSDistCpツール
HDFS TO COSツール
オンラインツール (Onrain Tsūru)
セルフ診断ツール
実践チュートリアル
概要
アクセス制御と権限管理
パフォーマンスの最適化
AWS S3 SDKを使用したCOSアクセス
データディザスタリカバリバックアップ
ドメイン名管理の実践
画像処理の実践
COSオーディオビデオプレーヤーの実践
データセキュリティ
データ検証
COSコスト最適化ソリューション
サードパーティアプリケーションでのCOSの使用
移行ガイド
サードパーティクラウドストレージのデータをCOSへ移行
データレークストレージ
クラウドネイティブデータレイク
メタデータアクセラレーション
データアクセラレーター GooseFS
データ処理
データ処理概要
画像処理
メディア処理
コンテンツ審査
ファイル処理
ドキュメントプレビュー
トラブルシューティング
RequestId取得の操作ガイド
パブリックネットワーク経由でのCOSへのファイルアップロード速度の遅さ
COSへのアクセス時に403エラーコードが返される
リソースアクセス異常
POST Objectの一般的な異常
セキュリティとコンプライアンス
データ災害復帰
データセキュリティ
クラウドアクセスマネジメント
よくある質問
よくあるご質問
一般的な問題
従量課金に関するご質問
ドメインコンプライアンスに関するご質問
バケット設定に関する質問
ドメイン名とCDNに関するご質問
ファイル操作に関するご質問
権限管理に関するご質問
データ処理に関するご質問
データセキュリティに関するご質問
署名付きURLに関するご質問
SDKクラスに関するご質問
ツール類に関するご質問
APIクラスに関するご質問
Agreements
Service Level Agreement
プライバシーポリシー
データ処理とセキュリティ契約
連絡先
用語集
ドキュメントCloud Object Storage

DELETE Multiple Objects

フォーカスモード
フォントサイズ
最終更新日: 2025-09-09 17:20:19

Overview

This API is used to delete multiple objects (up to 1,000) from a bucket in a single request. COS provides the following two response modes:
Quiet: returns only information about objects that failed to delete and the error messages.
Verbose: returns the deletion results of each object.
To call this API, you need to have permission to write to the bucket.


Authorization Description

In anonymous access scenarios, the action in the authorization policy needs to be set to ["name/cos:DeleteObject","name/cos:DeleteMultipleObjects"]. In non-anonymous scenarios, each deleted object will be checked individually to see if the current account has the cos:DeleteObject permission. View all actions.

Versioning

If versioning is enabled, you can specify a version ID for each object to delete so that these objects/delete markers of the specified versions can be deleted permanently. If no version ID is specified, a new delete marker will be created for the object.
If a delete marker is created or deleted in this request, the <DeleteMarker>true</DeleteMarker> and <DeleteMarkerVersionId> nodes will be returned for this object.
If an object of a specified version (including the delete marker version) is deleted permanently in this request, the <VersionId> node will be returned, indicating the version ID that is deleted in this request.

Request

Sample request

POST /?delete HTTP/1.1
Host: <BucketName-APPID>.cos.<Region>.myqcloud.com
Date: GMT Date
Content-Type: application/xml
Content-Length: Content Length
Content-MD5: MD5
Authorization: Auth String

[Request Body]
Note:
Host:<BucketName-APPID>.cos.<Region>.myqcloud.com, where <BucketName-APPID> is the bucket name followed by the APPID, such as examplebucket-1250000000 (see Bucket Overview > Basic Information and Bucket Overview > Bucket Naming Conventions), and <Region> is a COS region (see Regions and Access Endpoints).
Authorization: Auth String (See Request Signature for details.)

Request parameters

This API has no request parameter.

Request headers

This API only uses Common Request Headers.

Request body

The request body contains application/xml data that includes information about the objects to delete.
<Delete>
<Quiet>boolean</Quiet>
<Object>
<Key>string</Key>
</Object>
<Object>
<Key>string</Key>
<VersionId>string</VersionId>
</Object>
</Delete>
The nodes are described as follows:
Node Name (Keyword)
Parent Node
Description
Type
Required
Delete
None
Stores information about the DELETE Multiple Objects request.
Container
Yes
Content of Delete:
Node Name (Keyword)
Parent Node
Description
Type
Required
Quiet
Delete
Whether to use the Quiet mode for the response
true: yes (returns only information about objects that failed to delete and the error messages)
false (default): no (uses the Verbose mode instead, returning the deletion results of all objects)
Note:
When the specified key is empty or does not exist, COS itself will not return an error message.
boolean
Yes
Object
Delete
Information about a single object to delete
Container
Yes
Content of Object:
Node Name (Keyword)
Parent Node
Description
Type
Required
Key
Delete.Object
Key of the object to delete (The key does not need to start with a /)
string
Yes
VersionId
Delete.Object
Version ID of the object to delete (if versioning is enabled). If versioning is not enabled, or you want to create a delete marker with versioning enabled, you don’t need to specify this node.
string
Yes

Response

Response headers

This API only returns Common Response Headers.

Response body

application/xml data that contains the deletion results will be returned for a successful request.
<DeleteResult>
<Deleted>
<Key>string</Key>
<DeleteMarker>boolean</DeleteMarker>
<DeleteMarkerVersionId>string</DeleteMarkerVersionId>
</Deleted>
<Deleted>
<Key>string</Key>
<VersionId>string</VersionId>
</Deleted>
<Deleted>
<Key>string</Key>
<DeleteMarker>boolean</DeleteMarker>
<DeleteMarkerVersionId>string</DeleteMarkerVersionId>
<VersionId>string</VersionId>
</Deleted>
<Error>
<Key>string</Key>
<VersionId>string</VersionId>
<Code>string</Code>
<Message>string</Message>
</Error>
</DeleteResult>
The nodes are described as follows:
Node Name (Keyword)
Parent Node
Description
Type
DeleteResult
None
Stores the results of DELETE Multiple Objects
Container
Content of DeleteResult:
Node Name (Keyword)
Parent Node
Description
Type
Deleted
DeleteResult
An object entry that is successfully deleted. This node is returned only in Verbose mode.
Container
Error
DeleteResult
An object entry that failed to delete
Container
Content of Deleted:
Node Name (Keyword)
Parent Node
Description
Type
Key
DeleteResult.Deleted
Key of the object that is successfully deleted
string
DeleteMarker
DeleteResult.Deleted
Fixed to true. This node is returned when a delete marker is created or deleted for an object.
boolean
DeleteMarkerVersionId
DeleteResult.Deleted
ID of the delete marker that is created or deleted. This node is returned only when a delete marker is created or deleted for an object.
string
VersionId
DeleteResult.Deleted
Version ID of the object that is successfully deleted. This node is returned only when a version ID is specified in the request.
string
Content of Error:
Node Name (Keyword)
Parent Node
Description
Type
Key
DeleteResult.Error
Key of the object that failed to delete
string
VersionId
DeleteResult.Error
Version ID of the object that failed to delete. This node is returned only when a version ID is specified in the request.
string
Code
DeleteResult.Error
Error code for the deletion failure. The error code can be used to locate the error conditions and scenario.
string
Message
DeleteResult.Error
Error message for the deletion failure
string

Error codes

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

Sample

Sample 1: simple use case

Request

POST /?delete HTTP/1.1
Host: examplebucket-1250000000.cos.ap-beijing.myqcloud.com
Date: Tue, 20 Aug 2019 11:59:35 GMT
Content-Type: application/xml
Content-Length: 158
Content-MD5: zUd/xgzNGDrqJMJUOWV2AQ==
Authorization: q-sign-algorithm=sha1&q-ak=************************************&q-sign-time=1566302375;1566309575&q-key-time=1566302375;1566309575&q-header-list=content-length;content-md5;content-type;date;host&q-url-param-list=delete&q-signature=****************************************
Connection: close

<Delete>
<Quiet>false</Quiet>
<Object>
<Key>example-object-1.jpg</Key>
</Object>
<Object>
<Key>example-object-2.jpg</Key>
</Object>
</Delete>

Response

HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 144
Connection: close
Date: Tue, 20 Aug 2019 11:59:35 GMT
Server: tencent-cos
x-cos-request-id: NWQ1YmUwYTdfM2FiMDJhMDlfYzczN18zMGM1****

<DeleteResult>
<Deleted>
<Key>example-object-1.jpg</Key>
</Deleted>
<Deleted>
<Key>example-object-2.jpg</Key>
</Deleted>
</DeleteResult>

Sample 2: simple use case (using the Quiet mode)

Request

POST /?delete HTTP/1.1
Host: examplebucket-1250000000.cos.ap-beijing.myqcloud.com
Date: Tue, 20 Aug 2019 12:12:26 GMT
Content-Type: application/xml
Content-Length: 157
Content-MD5: +iI9kJvM2k/y5y3nHcn8BQ==
Authorization: q-sign-algorithm=sha1&q-ak=************************************&q-sign-time=1566303146;1566310346&q-key-time=1566303146;1566310346&q-header-list=content-length;content-md5;content-type;date;host&q-url-param-list=delete&q-signature=****************************************
Connection: close

<Delete>
<Quiet>true</Quiet>
<Object>
<Key>example-object-1.jpg</Key>
</Object>
<Object>
<Key>example-object-2.jpg</Key>
</Object>
</Delete>

Response

HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 15
Connection: close
Date: Tue, 20 Aug 2019 12:12:27 GMT
Server: tencent-cos
x-cos-request-id: NWQ1YmUzYWFfMTljMDJhMDlfNTg3ZV8zNDI0****

<DeleteResult/>

Sample 3: versioning-enabled (creating a delete marker)

Request

POST /?delete HTTP/1.1
Host: examplebucket-1250000000.cos.ap-beijing.myqcloud.com
Date: Wed, 21 Aug 2019 12:04:03 GMT
Content-Type: application/xml
Content-Length: 100
Content-MD5: MowFtlG7iwK7Wmk79IVXFA==
Authorization: q-sign-algorithm=sha1&q-ak=************************************&q-sign-time=1566389043;1566396243&q-key-time=1566389043;1566396243&q-header-list=content-length;content-md5;content-type;date;host&q-url-param-list=delete&q-signature=****************************************
Connection: close

<Delete>
<Quiet>false</Quiet>
<Object>
<Key>example-object-1.jpg</Key>
</Object>
</Delete>

Response

HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 200
Connection: close
Date: Wed, 21 Aug 2019 12:04:03 GMT
Server: tencent-cos
x-cos-request-id: NWQ1ZDMzMzNfNDhiNDBiMDlfMmIzNzZfMTBh****

<DeleteResult>
<Deleted>
<Key>example-object-1.jpg</Key>
<DeleteMarker>true</DeleteMarker>
<DeleteMarkerVersionId>MTg0NDUxNzc2ODQ2NjU3ODM4NTc</DeleteMarkerVersionId>
</Deleted>
</DeleteResult>

Sample 4: deleting an object of a specified version

Request

POST /?delete HTTP/1.1
Host: examplebucket-1250000000.cos.ap-beijing.myqcloud.com
Date: Wed, 21 Aug 2019 11:24:43 GMT
Content-Type: application/xml
Content-Length: 154
Content-MD5: EwFydeQSMzaHWi0qMTOGWw==
Authorization: q-sign-algorithm=sha1&q-ak=************************************&q-sign-time=1566386683;1566393883&q-key-time=1566386683;1566393883&q-header-list=content-length;content-md5;content-type;date;host&q-url-param-list=delete&q-signature=****************************************
Connection: close

<Delete>
<Quiet>false</Quiet>
<Object>
<Key>example-object-2.jpg</Key>
<VersionId>MTg0NDUxNzc2ODcwMjYyNjIwMTM</VersionId>
</Object>
</Delete>

Response

HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 140
Connection: close
Date: Wed, 21 Aug 2019 11:24:44 GMT
Server: tencent-cos
x-cos-request-id: NWQ1ZDI5ZmJfNDhiNDBiMDlfMmIzODNfMTA0****

<DeleteResult>
<Deleted>
<Key>example-object-2.jpg</Key>
<VersionId>MTg0NDUxNzc2ODcwMjYyNjIwMTM</VersionId>
</Deleted>
</DeleteResult>

Sample 5: deleting a delete marker

Request

POST /?delete HTTP/1.1
Host: examplebucket-1250000000.cos.ap-beijing.myqcloud.com
Date: Wed, 21 Aug 2019 12:04:04 GMT
Content-Type: application/xml
Content-Length: 154
Content-MD5: EKphCPpHcKiVqJtMqE+DmA==
Authorization: q-sign-algorithm=sha1&q-ak=************************************&q-sign-time=1566389044;1566396244&q-key-time=1566389044;1566396244&q-header-list=content-length;content-md5;content-type;date;host&q-url-param-list=delete&q-signature=****************************************
Connection: close

<Delete>
<Quiet>false</Quiet>
<Object>
<Key>example-object-1.jpg</Key>
<VersionId>MTg0NDUxNzc2ODQ2NjU3ODM4NTc</VersionId>
</Object>
</Delete>

Response

HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 253
Connection: close
Date: Wed, 21 Aug 2019 12:04:04 GMT
Server: tencent-cos
x-cos-request-id: NWQ1ZDMzMzRfYmIwMmEwOV83YTQzXzEyM2Ri****

<DeleteResult>
<Deleted>
<Key>example-object-1.jpg</Key>
<DeleteMarker>true</DeleteMarker>
<DeleteMarkerVersionId>MTg0NDUxNzc2ODQ2NjU3ODM4NTc</DeleteMarkerVersionId>
<VersionId>MTg0NDUxNzc2ODQ2NjU3ODM4NTc</VersionId>
</Deleted>
</DeleteResult>

Sample 6: failed to delete some objects

Request

POST /?delete HTTP/1.1
Host: examplebucket-1250000000.cos.ap-beijing.myqcloud.com
Date: Wed, 21 Aug 2019 12:04:05 GMT
Content-Type: application/xml
Content-Length: 436
Content-MD5: ZAbgvje31aO+0j7pkEkYvQ==
Authorization: q-sign-algorithm=sha1&q-ak=************************************&q-sign-time=1566389045;1566396245&q-key-time=1566389045;1566396245&q-header-list=content-length;content-md5;content-type;date;host&q-url-param-list=delete&q-signature=****************************************
Connection: close

<Delete>
<Quiet>false</Quiet>
<Object>
<Key>example-object-1.jpg</Key>
</Object>
<Object>
<Key>example-object-2.jpg</Key>
<VersionId>MTg0NDUxNzc2ODQ2NjQ1MjM5MTk</VersionId>
</Object>
<Object>
<Key>example-object-3.jpg</Key>
<VersionId>MTg0NDUxNzc2ODQ2NjQwMTIwMDI</VersionId>
</Object>
<Object>
<Key>example-object-4.jpg</Key>
<VersionId>MTg0NDUxNzc2ODQ2NjQ0NjI0MDQ</VersionId>
</Object>
</Delete>

Response

HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 703
Connection: close
Date: Wed, 21 Aug 2019 12:04:06 GMT
Server: tencent-cos
x-cos-request-id: NWQ1ZDMzMzVfOTNjMjJhMDlfMzhiM18xMWY3****

<DeleteResult>
<Deleted>
<Key>example-object-1.jpg</Key>
<DeleteMarker>true</DeleteMarker>
<DeleteMarkerVersionId>MTg0NDUxNzc2ODQ2NjM1NTI2NDY</DeleteMarkerVersionId>
</Deleted>
<Deleted>
<Key>example-object-2.jpg</Key>
<VersionId>MTg0NDUxNzc2ODQ2NjQ1MjM5MTk</VersionId>
</Deleted>
<Deleted>
<Key>example-object-3.jpg</Key>
<DeleteMarker>true</DeleteMarker>
<DeleteMarkerVersionId>MTg0NDUxNzc2ODQ2NjQwMTIwMDI</DeleteMarkerVersionId>
<VersionId>MTg0NDUxNzc2ODQ2NjQwMTIwMDI</VersionId>
</Deleted>
<Error>
<Key>example-object-4.jpg</Key>
<VersionId>MTg0NDUxNzc2ODQ2NjQ0NjI0MDQ</VersionId>
<Code>PathConflict</Code>
<Message>Path conflict.</Message>
</Error>
</DeleteResult>


ヘルプとサポート

この記事はお役に立ちましたか?

フィードバック