tencent cloud

Downloading Files
Last updated: 2026-01-07 14:15:03
Downloading Files
Last updated: 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.
Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback