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

Document Transcoding

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

Description

Used for document format conversion, currently only support doc/docx to pdf.
Note:
Requires permissions. For details about permissions, see Generate Access Token API.
Non-ACL authentication: admin or space_admin
acl authorization: canDownload (downloadable for the current folder) & canUpload (uploadable for the target folder)
(Non-acl authentication refers to the current user's operation permissions on all files. For details, see the Generate Access Token API; acl authentication grants folder-level permissions to specified users via the shared authorization interface. For details, see the Role Authorization module.)
This API requires both source and target to specify the complete file path. Source and target can span directories to achieve the feature of moving files to any other directory, and supports renaming files at the same time.
It does not automatically create the intermediate parent directories required, so you must ensure that all levels of directories in the path exist.

Request

Request Example

PUT /api/v1/file/{LibraryId}/{SpaceId}/{FilePath}?convert&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
Specify the complete file path to save the transcoded document, such as foo/bar/file_new.pdf, and ensure the foo/bar directory exists.
String
No
ConflictResolutionStrategy
Handling method for 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 with an earlier version exists in the target space, do not support moving and overwriting.
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 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, specify the source file for document transcoding

{
"convertFrom": "a/b/xxx.docx"
}
Request body field description:
Request parameters.
Description
Type
Required or Not
convertFrom
Specify the source file for document transcoding
String
Yes

Response

Response code

Document transcoding task created successfully, return HTTP 202 Accepted.

Response Body

application/json
Response body example:
{ "taskId": 23 }

[
{
"taskId": 23,
"status": 200,
"result": {
"convertFrom": [ "a", "b", "xxx.docx" ],
"path": [ "foo", "bar", "file_new (2).pdf" ],
"srcInode": "a04db459dea9042e0006412d47189f3f",
"dstInode": "737c04ae9a20dca00006412e97bc5b8c"
}
}
]
Query task response body field description:
Response Parameters
Description
Type
taskId
The task ID when recovering asynchronously can be used to query task status via the Query Task API.
Int
status
202: Task in progress 200: Task executed successfully
Int
result
Transcoding Operation Result
Array
The result contains the following parameters:
Response Parameters
Description
Type
convertFrom
Source file path for transcoding
String Array
path
Final file path after transcoding
String Array
srcInode
File inode to transcode
String
dstInode
File inode after transcoding
String

Error Codes

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

ヘルプとサポート

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

フィードバック