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

Copy Directory or Album

PDF
Focus Mode
Font Size
Last updated: 2026-01-07 14:52:07

Description

Copy directories or albums.
Note:
Required permissions: admin, space_admin, or copy_directory. For permission details, refer to generate access token interface.
Automatically create the required intermediate parent directories at all levels.

Request

Request Example

PUT /api/v1/directory/{LibraryId}/{SpaceId}/{DirPath}?conflict_resolution_strategy={ConflictResolutionStrategy}&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 hyphen (`-`). If the media library is in multi-tenant mode, you must specify this parameter. See create tenant space.
String
No
DirPath
Target directory path or album name.
For multi-level directories, use a slash (/) to separate, such as foo/bar_new
String
Yes
ConflictResolutionStrategy
Handling method when last-level directory conflicts, default is ask:
HTTP 409 Conflict and SameNameDirectoryOrFileExists error code returned when conflicts with
rename the last level directory if conflicts with
String
No
AccessToken
Access token, see Generate access token
String
Yes
UserId
User identity recognition. When the permission corresponding to the access token is admin permission and the user identity recognition when applying for the access token is empty, it is used to temporarily designate the user identity. For details, see Generate Access Token API.
String
No

Request Body

application/json, specify the source directory path or album name to be copied.
Request body example:
{
"copyFrom": "foo/bar"
}
Request body field description:
Request parameters.
Description
Type
Required or Not
copyFrom
The source directory or album path to be copied
String
Yes

Response

Response code

Copied successfully, return HTTP 202 Accepted.

Response Body

Empty, no response body (return HTTP 204 No Content) or application/json (return HTTP 200 OK or HTTP 202 Accepted).
Response body example:
Returns HTTP 200 OK:
{ "path": [ "foo", "bar (1)" ] }
Returns HTTP 202 Accepted:
{ "taskId": 10 }
[
{
"id": 10,
"status": 200,
"result": { "path": [ "foo", "bar (1)" ] }
}
]
Response body field description:
Response Parameters
Description
Type
path
Indicates the final directory or album path. Since automatic renaming may exist, the final path here may not equal the path specified when copying the directory or album.
Array
taskId
The task ID for asynchronous copying can be used to query task status via the Query Task API.
String

Error Codes

This request operation has no special error messages. For common error messages, see Error Codes.

Help and Support

Was this page helpful?

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

Feedback