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

Creating a Directory or Album

PDF
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-01-07 14:52:06

Description

To create a directory or album.
Note:
Requires admin, space_admin, or create_directory permissions. For details about the permissions, see the Generate Access Token API.
Media-type media libraries can be further configured to determine whether they are album-based. When set to non-album-based, creating directories or albums is not allowed. When set to album-based, only one level of directories or albums can be created. File-type media libraries impose no limitation on directory levels.
Automatically create the required intermediate parent directories at all levels.
Even if ConflictResolutionStrategy is set to rename, the system will still return HTTP 409 Conflict and the SameNameDirectoryOrFileExists error code when a parent in the path is actually a file.

Request Example

PUT /api/v1/directory/`{LibraryId}`/`{SpaceId}`/`{DirPath}`?conflict_resolution_strategy=`{ConflictResolutionStrategy}`&access_token=`{AccessToken}`&user_id=`{UserId}&with_inode={WithInode}`

Request Parameter

Request parameters.
Description
Type
Required or Not
LibraryId
Media Library ID, obtained after creating a media library through 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. See Create Tenant Space
String
No
DirPath
Directory path or album name.
For multi-level directories, use slash (`/`) to separate, such as `foo/bar`.
For the root directory, leave this parameter empty.
String
No
ConflictResolutionStrategy
Handling method when a conflict occurs in the last first-level directory.
Return HTTP 409 Conflict and SameNameDirectoryOrFileExists error code when conflicts with
rename: automatically rename the last level directory when conflicts with
ask by default
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 specify user identity. For details, see Generate Access Token API.
String
No
WithInode
0 or 1, whether to return inode (file directory ID), default do not return
String
No

Request Body

This request does not have a request body.

Response

Response code

Creation succeeded, return HTTP 201 Created.

Response Body

Empty, no response body (ConflictResolutionStrategy is ask and WithInode is 0) or application/json (ConflictResolutionStrategy is rename or WithInode is 1).
Response body example:
ConflictResolutionStrategy is ask and WithInode is 1:
{
"creationTime": "2025-09-29T02:53:09.000z"
"inode": "b63393076d249110000631c316d9751a"}
}
ConflictResolutionStrategy is rename and WithInode is 0:
{
"creationTime": "2025-09-29T02:53:09.000z"
"path": [ "foo", "bar (1)" ]
}
ConflictResolutionStrategy is rename and WithInode is 1:
{
"creationTime": "2025-09-29T02:53:09.000z"
"path": [ "foo", "bar (1)" ],
"inode": "b63393076d249110000631c316d9751a"
}
Response body field description:
Response Parameters
Description
Type
creationTime
Creation time.
String
path
The final path of the directory or album may not match the specified path when creating it, as automatic renaming may occur.
String
inode
Last level file directory ID
String

Error Codes

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

도움말 및 지원

문제 해결에 도움이 되었나요?

피드백