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 Symbolic Link

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

Description

Create a symbolic link.
Note:
Required permissions: admin, space_admin, or upload_file/upload_file_force/create_symlink/create_symlink_force. For details about permissions, refer to the Interface for Generating Access Tokens.
The symbolic link itself is consistent with the concept of a file. It can be deleted, renamed, moved, or copied through interfaces such as deleting files, renaming or moving files, and copying files, without affecting the file that the symbolic link points to.
Unlike the standard file system, a symbolic link will not lose its reference to the target file when the target is renamed or moved.
When the file pointed to by a symbolic link is overwritten during upload, the symbolic link will point to the newly uploaded file.
When the file pointed to by a symbolic link is deleted, the symbolic link itself will also be deleted.
When the file pointed to by a symbolic link is moved to the recycle bin, the symbolic link will be synchronously deleted. When the file in the recycle bin is restored, the previously deleted symbolic link will be restored accordingly.
When the directory containing the file pointed to by a symbolic link is deleted, the deletion of the symbolic link will also be asynchronous since directory deletion is an asynchronous operation.
When the directory containing the file pointed to by a symbolic link is moved to the recycle bin, the symbolic link remains unaffected.
When the file pointed to by a symbolic link in the recycle bin is permanently deleted, the symbolic link will also be permanently deleted.

Request

Request Example

PUT /api/v1/file/{LibraryId}/{SpaceId}/{FilePath}?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 a hyphen (`-`); if the media library is in multi-tenant mode, you must specify this parameter. See Create Tenant Space
String
No
FilePath
Complete file path, such as foo/bar2/file.docx
String
No
ConflictResolutionStrategy
Handling method when filename conflict, default is rename
ask: returns HTTP 409 Conflict and the SameNameDirectoryOrFileExists error code when conflicts with
rename: automatically rename file when conflicts with
overwrite:
If the target is a directory or album, it defaults to ask and does not support overwrite
If the target is a file, overwrite the existing file
When a file exists in the target space with an earlier version, moving to overwrite is not supported.
String
No
AccessToken
Access token, see Generate Access Token
String
Yes
UserId
User identity recognition. When the access token has admin permission and the user identity recognition during token application is empty, it is used to temporarily specify user identity. For details, see Generate Access Token API.
String
No

Request Body

application/json, specifies the source file path to point to. Does not support creation of symbolic links to directories or albums currently.
Request body example:
{
"linkTo": "foo/bar/file.docx"
}
Request body field description:
Request parameters.
Description
Type
Required or Not
linkTo
The absolute path of the source file pointed to by the symbolic link. For retrieval, see View File Details.
String
Yes

Response

Response code

Successfully created, returns HTTP 200 OK.

Response Body

application/json
Response body example:
{ "path": [ "foo", "bar2", "file (1).docx" ] }
Response body field description:
Response Parameters
Description
Type
path
String array or null
If it is an array of strings, it indicates the final symbolic link path. The last element in the array represents the final file name, and the other elements represent each first-level directory name. Because existing files with the same name may be renamed automatically, the final path here may not equal the designated target path during move or rename operations.
If it is null, it means that a parent directory of the target path has been deleted, and the target symbolic link can no longer be accessed.
Array

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