Skip to main content
get/files/{file_id}/preview
Request example
Response
get/files/{file_id}/preview

Authorization

Authorizationstringheaderrequired#

每个请求都通过 API Key 认证:Authorization: Bearer {API_KEY}。应用接口使用应用 API Key,知识库接口使用知识库 API Key(快速开始)。

API Key 应保存在服务端,切勿嵌入客户端代码。缺失或无效的 Key 会返回 HTTP 401(unauthorized)。

Path parameters

file_idstringrequired#
要下载的文件 ID,来自上传文件的响应。

Query parameters

as_attachmentboolean#
为 true 时,文件以附件形式下载,而不是在浏览器中内联渲染。

Default: false

userstring#
终端用户标识,由你的应用定义,需在应用内唯一。此处对文件访问没有影响,文件访问按应用和消息(而非 user)限定。参见 终端用户身份。

Responses

application/octet-stream
返回原始文件内容。Content-Type 头设置为文件的 MIME 类型。如果 as_attachment 为 true,文件将以 Content-Disposition: attachment 方式作为下载返回。