文档中心/ 百度搭子/ 企业版使用指南/ API参考/ 文件管理/ 获取文件列表

获取文件列表

GET
https://api.dumate.cn/api/v1/files

本接口用于查询已上传的文件(File)列表,支持按文件标识过滤、排序和游标分页。

权限说明

使用 API Key 鉴权调用 API 流程,具体调用流程,请查看认证鉴权。

请求参数

Headers 参数
除公共头域外,无其它特殊头域
Query 参数
fileIds array

按文件标识过滤的列表。

可选
显示子属性 隐藏子属性
items string
limit integer

每页返回数量。
默认值:100。
取值范围:0~100。

可选
order string

排序方式。
可选值:asc、desc。
默认值:desc。

可选
cursor string

分页游标。首次请求不传;后续请求传入上一页返回的 nextCursor。

可选
请求结构
GET /api/v1/files?limit=20&order=desc HTTP/1.1
Host: api.dumate.cn
Authorization: Bearer <YOUR_API_KEY>
Content-Type: application/json

示例代码

请求示例
curl --location --request GET "https://api.dumate.cn/api/v1/files?limit=20&order=desc" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer <YOUR_API_KEY>"

返回响应

Headers 参数
除公共头域外,无其它特殊头域
返回参数
data array

文件(File)列表。

可选
显示子属性 隐藏子属性
items object {6}
显示子属性 隐藏子属性
fileID string

文件标识。

可选
name string

文件名。

可选
size integer

文件大小,单位为字节。

可选
mimeType string

文件 MIME 类型。

可选
createdAt integer

创建时间,Unix 秒时间戳。

可选
updatedAt integer

最近更新时间,Unix 秒时间戳。

可选
nextCursor stringnull

下一页游标,取值为本页最后一条记录的 fileID;无下一页时为 null。
查询下一页时将该值作为请求参数 cursor 传入。

可选
hasMore boolean

是否还有下一页。
true:有下一页。
false:已是最后一页。

可选
响应示例
{
    "data": [
        {
            "fileID": "file-01a065f5696f707a8b0fbe5228b550cb",
            "name": "对话1",
            "size": 293710,
            "mimeType": "application/octet-stream",
            "createdAt": 1788445777,
            "updatedAt": 1788445777
        },
        {
            "fileID": "file-01a0656a81c6716785c27b9053dd91e3",
            "name": "dumate-session-file.txt",
            "size": 159,
            "mimeType": "text/plain",
            "createdAt": 1788436674,
            "updatedAt": 1788436674
        },
        {
            "fileID": "file-01a0656a2a7479cda374f5781c2c871e",
            "name": "dumate-test-agent-file.txt",
            "size": 82,
            "mimeType": "text/plain",
            "createdAt": 1788436651,
            "updatedAt": 1788436651
        },
        {
            "fileID": "file-01a0612cd68a72549f2729dc0edba34d",
            "name": "commodity-price-guidance.md",
            "size": 2140,
            "mimeType": "text/markdown",
            "createdAt": 1788365523,
            "updatedAt": 1788365523
        }
    ],
    "nextCursor": "file-01a05c9fa55c7c8b959e564fd2ff208c",
    "hasMore": true
}