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

Downloading Files

PDF
Mode fokus
Ukuran font
Terakhir diperbarui: 2026-01-07 14:15:03

Description

File download
Note:
You can directly specify the URL in the parameters when using files. For example, for image files, you can directly use it in the mini-program <image> tag, HTML <img> tag, or mini-program wx.previewImage interface, and so on. This interface will automatically 302 redirect to the actual image URL; the same applies to videos and files.

Request

Request Example

GET /api/v1/file/{LibraryId}/{SpaceId}/{FilePath}?history_id={HistoryId}&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
FilePath
complete file path, such as foo/bar/file.docx
String
Yes
HistoryId
Version ID, which is used to obtain file content of different versions. If not specified, it defaults to the latest version. To retrieve, see View historical version list.
String
No
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 API.
String
No

Response

Response code

Successful retrieval, back HTTP 200 OK.

Response Header

Response Parameters
Description
Type
Location
Includes URLs for files that can be directly shown or downloaded
String
x-smh-type
media library type
String
x-smh-creation-time
The time when file upload completes
String
x-smh-content-type
File type
String
x-smh-size
File size.
String
x-smh-etag
File etag
String
x-smh-crc64
File CRC64-ECMA182 check value, to avoid precision issues, here in string format
String
x-smh-meta-*
custom metadata
String

Response Body

File content

Error Codes

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

Bantuan dan Dukungan

Apakah halaman ini membantu?

masukan