获取文件信息
更新时间:2025-11-21
GET
https://qianfan.baidubce.com/v2/files/{file_id}
获取指定已上传的文件的meta信息。
权限说明
调用本文API,需使用API Key鉴权方式。使用API Key鉴权调用API流程,具体调用流程,请查看 认证鉴权。
请求参数
Headers 参数
除公共头域外,无其它特殊头域
URL 参数
file_id
string
文件唯一标识符。
必选
请求结构
GET /v2/files/file-abc123 HTTP/1.1
Host: qianfan.baidubce.com
Authorization: Bearer <API Key>
示例代码
请求示例
curl -X GET https://qianfan.baidubce.com/v2/files/file-abc123 \
-H "Authorization: Bearer bce-v3/ALTAK-*********/614fb**********" > file.jsonl \
返回响应
Headers 参数
除公共头域外,无其它特殊头域
返回参数
id
string
文件唯一标识符。
可选
object
string
固定值 file。
可选
bytes
integer
文件大小,单位字节。
可选
created_at
integer
文件上传的时间戳。
可选
filename
string
文件名称。
可选
purpose
string
文件用途,对于请求中的purpose字段。
可选
JSON
{
"id": "file-abc123",
"object": "file",
"bytes": 515,
"created_at": 1763691789,
"filename": "mydata.jsonl",
"purpose": "fine-tune"
}
JSON
{
"error": {
"code": "invalid_retrieve_file",
"message": "file not found",
"type": "invalid_request_error"
},
"id": "as-dtqq0pw1is"
}
错误码
如果请求错误,服务器返回的JSON文本包含以下参数。
| 名称 | 描述 |
|---|---|
| code | 错误码 |
| message | 错误描述信息,帮助理解和解决发生的错误 |
| type | 错误类型 |
更多相关错误码,请查看模型错误码说明。
