tencent cloud

Smart Media Hosting

Product Introduction
Product Overview
Feature Description
Product Strengths
Use Cases
Basic Concept
Purchase Guide
Quick Start
Create Media Library
Initiate request
Service Level API Document
History
Introduction
API Category
Making API Requests
PaaS Service APIs
Official Cloud Disk APIs
Data Types
Error Codes
Business Level API Document
Introduction
Access Token Operation API
Tenant Space Operation API
File Operation API
Directory or Album Operation API
Recycle Bin Operation API
Quota Operation API
Query Task Operation API
Search Operation API
Historical Version Operations API
Directory and File Batch Operation API
Collection Operation API
Error Codes
SDK Documentation
Android SDK
iOS SDK
HarmonyOS SDK
FAQs
Enterprise Network Disk
Product Introduction
Purchase Guide
Quick Start
FAQs
Service Level Agreement
Glossary

Batch Delete Catalog or File

PDF
フォーカスモード
フォントサイズ
最終更新日: 2026-01-07 14:28:06

Description

Delete directories or files in batches.
Note:
Required permissions: admin, space_admin, or delete_directory/delete_directory_permanent/delete_file/delete_file_permanent. If you need to delete both directories and files simultaneously, you can specify both delete_directory/delete_directory_permanent and delete_file/delete_file_permanent permissions. For details about permissions, refer to Generate Access Token Interface

Request

Request Example

POST /api/v1/batch/{LibraryId}/{SpaceId}?delete&access_token={AccessToken}&user_id={UserId}

Request Parameter

Request parameters.
Description
Type
Required or Not
LibraryId
Media Library ID, obtained after creating a media library in the media hosting console. See Create Media Library
String
Yes
SpaceId
Space ID. If the media library is in single-tenant mode, this parameter is fixed as a hyphen (-); if the media library is in multi-tenant mode, you must specify this parameter.
String
Yes
AccessToken
Access token, see Generate Access Token
String
Yes
UserId
User identity recognition. When the access token corresponds to administrator permissions and the user identity recognition during token application is empty, it is used to temporarily specify user identity. For details, see Generate Access Token.
String
No

Request Body

application/json, specify the path to be deleted. A maximum number of 1000 items can be specified in one request.
Request body example:
[
{
"path": "foo/bar"
},
{
"path": "foo/1.jpg"
},
{
"path": "foo/2.jpg",
"permanent": true
}
]
Request body field description:
Request parameters.
Description
Type
Required or Not
path
Deleted directory, album, or file path
String
Yes
permanent
When the recycle bin is enabled, this parameter specifies whether to move the file to the Recycle Bin or permanently delete the file. It is false by default and includes the following options:
Permanently delete
false: Move to Recycle Bin
Boolean
No

Response

Response code

Execution successful.
When deleting multiple projects asynchronously, it returns HTTP 202 Accepted.
When deleting fewer projects synchronously, it returns HTTP 200 OK (all executions successful) or HTTP 207 Multi-Status (part or all executions failed).

Response Body

application/json
Response body example:
Returns HTTP 200 OK or HTTP 207 Multi-Status:
{
"result": [
{
"status": 200,
"recycledItemId": 123,
"path": [ "foo", "bar" ]
},
{
"status": 200,
"recycledItemId": 124,
"path": [ "foo", "1.jpg" ]
},
{
"status": 204,
"path": [ "foo", "2.jpg" ]
}
]
}
Returns HTTP 202 Accepted:
{ "taskId": 15 }
[
{
"taskId": 15,
"status": 200,
"result": [
{
"status": 200,
"recycledItemId": 123,
"path": [ "foo", "bar" ]
},
{
"status": 200,
"recycledItemId": 124,
"path": [ "foo", "1.jpg" ]
},
{
"status": 204,
"path": [ "foo", "2.jpg" ]
}
]
}
]
Response body field description:
Response Parameters
Description
Type
result.status
Deletion result of individual item
200: Deleted successfully when conflictResolutionStrategy is rename
204: Deleted successfully when conflictResolutionStrategy is ask or overwrite
403/404/409/500: Delete failed
String
result.recycledItemId
Recycle bin project ID, used to permanently delete or restore a designated project from the recycle bin
Int
result.path
When making a request, the corresponding path passed in array format
String Array
taskId
Task ID when deleting asynchronously can be used to query task status via the Query Task API.
Int
Response body field description for query task
Response Parameters
Description
Type
status
Query task status.
202: task in progress
200: all executed successfully
207: part or all execution failed
String

ヘルプとサポート

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

フィードバック