List knowledge base files

Updated at:

Lists files in a Lingma knowledge base.

Supported editions

Enterprise Dedicated Edition, Enterprise Standard Edition

Service endpoints

Get the service endpoint and replace {domain} in the API request syntax with your endpoint .

Authorization

Product

Resource

Required permission

Lingma

knowledge base file

Read-only

Request syntax

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

Request

Enterprise standard edition

List all 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'

Filter by name

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'

Sort by time added

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

Enterprise dedicated edition

List all files

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'

Filter by name

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'

Sort by time added

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

Request Headers(Headers)

x-yunxiao-token string (Required)

Personal Access Token。You can refer toPersonal Access Tokento obtain it。

Example:pt-0fh3****0fbG_35af****0484。

Request Parameters

organizationId string (Required)

OrganizationID。You can go toOrganization Management Console'sBasic Information pageto obtainorganizationId

kbId string (Required)

Knowledge base ID。For more information, seeList Knowledge Basesto obtain the knowledge baseID。

query string (Optional)

Fuzzy search by file name。

orderBy string (Optional)

Sort field,The following sort fields are supported:

  • gmtAdded:Creation time。

  • kdId:Knowledge base ID。

  • fileState:File status。

sort string (Optional)

Sort order:

  • desc:Descending。

  • asc:Ascending。

page integer (Optional)Default value is1

Current page。

perPage integer (Optional)Default value is20

Maximum number of data entries per page,Value range:[1,20]

Return parameters

Response example

[
    {
        "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

The file ID.

filePath string

The file path.

fileSize string

The file size.

fileState string

The file state.

file_md5 string

The MD5 hash of the file content. This hash uniquely identifies the file.

filename string

The file name.

gmtAdded integer

The time when the file was added.

gmtCreated integer

The time when the file was created.

gmtModified integer

The time when the file was last modified.

kdId string

The knowledge base ID.

organizationId string

The organization ID.

uploadUser Object

The user who added the file.

Properties

avatarUrl string

The avatar URL of the user.

displayName string

The login name of the user.

id string

The ID of the user.

userName string

The nickname of the user.

Response header

Parameter

Description

Example value

x-next-page

Next page

1

x-page

Current page

1

x-per-page

Page size

20

x-prev-page

Previous page

1

x-total

Total count

9

x-total-pages

Total number of pages

1

Error codes

For more information, see Error code center.