获取知识库文件列表

通过 OpenAPI 获取通义灵码知识库文件列表。

适用版本

企业专属版、企业标准版

服务接入点

获取服务接入点,替换 API 请求语法中的 {domain}

授权信息

产品

资源

所需权限

通义灵码

知识库文件

只读

请求语法

GET https://{domain}/oapi/v1/lingma/organizations/{organizationId}/knowledgeBases/{kbId}/files

请求说明

企业标准版

获取该知识库下所有文件列表

curl -X 'GET' \
  'https://openapi-rdc.aliyuncs.com/oapi/v1/lingma/organizations/6826e1d0516a9f85a08c****/knowledgeBases/b15aef8442c0fc45492b****/files' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'

根据文件名称模糊查询该知识库下文件列表

curl -X 'GET' \
  'https://openapi-rdc.aliyuncs.com/oapi/v1/lingma/organizations/6826e1d0516a9f85a08c****/knowledgeBases/b15aef8442c0fc45492b****/files?query=Lingma' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'

获取该知识库下文件列表并根据知识库添加时间排序

curl -X 'GET' \
  'https://openapi-rdc.aliyuncs.com/oapi/v1/lingma/organizations/6826e1d0516a9f85a08c****/knowledgeBases/b15aef8442c0fc45492b****/members?orderBy=gmtAdded' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'

企业专属版

获取该知识库下所有文件列表

curl -X 'GET' \
  'https://test-domain-***.rdc.aliyuncs.com/oapi/v1/lingma/organizations/6826e1d0516a9f85a08c****/knowledgeBases/b15aef8442c0fc45492b****/files' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'

根据文件名称模糊查询该知识库下文件列表

curl -X 'GET' \
  'https://test-domain-***.rdc.aliyuncs.com/oapi/v1/lingma/organizations/6826e1d0516a9f85a08c****/knowledgeBases/b15aef8442c0fc45492b****/files?query=Lingma' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'

获取该知识库下文件列表并根据知识库添加时间排序

curl -X 'GET' \
  'https://test-domain-***.rdc.aliyuncs.com/oapi/v1/lingma/organizations/6826e1d0516a9f85a08c****/knowledgeBases/b15aef8442c0fc45492b****/members?orderBy=gmtAdded' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'

请求头(Headers)

x-yunxiao-token string (必选)

个人访问令牌。您可参考个人访问令牌获取。

示例:pt-0fh3****0fbG_35af****0484。

请求参数

organizationId string (必选)

所属组织ID。您可以前往组织管理后台基本信息页面获取organizationId

kbId string (必选)

知识库 ID。请参见获取知识库列表获取知识库ID。

query string (可选)

文件名称模糊查询。

orderBy string (可选)

排序列,支持如下排序字段:

  • gmtAdded:添加时间。

  • kdId:知识库 ID。

  • fileState:文件状态。

sort string (可选)

排序顺序:

  • desc:倒序。

  • asc:正序。

page integer (可选)默认值为1

当前页。

perPage integer (可选)默认值为20

每页数据条数的最大值,取值范围:[1,20]

返回参数

返回示例

[
    {
        "fileId": "03deb350773627922878****",
        "filePath": "lingma/rag_kb/6826e1d0516a9f85a08c****/b15aef8442c0fc45492b****/03deb350773627922878****/Lingma IDE shotcuts-macOS.pdf",
        "fileSize": "455.33 KB",
        "fileState": "PROCESSED",
        "file_md5": "c5c9072e859ec84bf4d62e674b61****",
        "filename": "Lingma IDE shotcuts-macOS.pdf",
        "gmtAdded": 1750050682633,
        "gmtCreated": 1750050680593,
        "gmtModified": 1750050700420,
        "kbId": "b15aef8442c0fc45492b****",
        "organizationId": "6826e1d0516a9f85a08c****",
        "uploadUser": {
            "avatarUrl": "https://tcs-devops.aliyuncs.com/thumbnail/113iaf62a4481af4cd44ad46d8c3e9b5****/w/100/h/100",
            "displayName": "testcloud_com",
            "id": "66a6f60e368d88cff5a5****",
            "userName": "test"
        }
    }
]

fileId string

文件 ID。

filePath string

文件路径。

fileSize string

文件大小。

fileState string

文件状态。

file_md5 string

文件内容的md5值,用来唯一标识一个文件。

filename string

文件名称。

gmtAdded integer

添加时间。

gmtCreated integer

创建时间。

gmtModified integer

修改时间。

kdId string

知识库 ID。

organizationId string

所属组织 ID。

uploadUser Object

文件添加者。

属性

avatarUrl string

添加者头像。

displayName string

添加者登录名。

id string

添加者 ID。

userName string

添加者昵称。

响应头

参数

描述

示例值

x-next-page

下一页

1

x-page

当前页

1

x-per-page

每页大小

20

x-prev-page

前一页

1

x-total

总数

9

x-total-pages

总分页数

1

错误码

访问错误码中心查看 API 相关错误码。