Retrieves files and their summary information from a specified knowledge base.
Operation description
Resource Access Management (RAM) users must first obtain API permissions for Model Studio (requires
AliyunBailianDataFullAccess, which includes the sfm:ListIndexFiles permission) and join a workspace before invoking this operation. Alibaba Cloud accounts can invoke this operation directly without authorization. Use the latest Model Studio SDK to invoke this operation.Before invoking this operation, make sure that your knowledge base has been created and has not been deleted (that is, the knowledge base ID
IndexIdis valid).This operation has idempotence.
Throttling: This operation is throttled if called too frequently. Do not exceed 15 calls per second. If you are throttled, retry later.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
sfm:ListIndexFiles |
list |
*All Resource
|
None | None |
Request syntax
GET /{WorkspaceId}/index/list_index_documents HTTP/1.1
Path Parameters
|
Parameter |
Type |
Required |
Description |
Example |
| WorkspaceId |
string |
Yes |
The workspace ID of the knowledge base. For information about how to obtain the workspace ID, see How to use a workspace. |
llm-3z7uw7fwz0vexxxx |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| IndexId |
string |
Yes |
The knowledge base ID, which is the |
79c0alxxxx |
| DocumentStatus |
string |
No |
Filters the returned file list by file import status. Valid values:
Default value: empty, which means no filtering by file import status. Valid values:
|
FINISH |
| DocumentName |
string |
No |
Filters the returned file list by file name (without the file extension). Default value: empty, which means no filtering by file name. |
product-overview |
| EnableNameLike |
string |
No |
Specifies whether to enable fuzzy matching for file names. This parameter is used together with the
Default value: false. Valid values:
|
false |
| PageNumber |
integer |
No |
The page number. Minimum value: 1. Default value: 1. |
1 |
| PageSize |
integer |
No |
The number of files to display per page in a paged query. No maximum limit. Default value: 10. |
10 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
Schema of Response |
||
| RequestId |
string |
The request ID. |
35A267BF-xxxx-54DB-8394-AA3B0742D833 |
| Code |
string |
The error status code. |
InvalidParameter |
| Message |
string |
The error message. |
Required parameter(%s) missing or invalid, please check the request parameters. |
| Success |
boolean |
Indicates whether the operation was successful. Valid values:
|
true |
| Data |
object |
The data field returned by the operation. |
|
| Documents |
array<object> |
The list of files in the knowledge base, sorted by document import time in descending order (consistent with the console). |
|
|
object |
The file object. |
||
| SourceId |
string |
For document search knowledge bases, this parameter specifies the category ID, which is the For data query or image Q&A knowledge bases, this parameter specifies the data table ID. You can obtain it by clicking the ID icon next to the data table name on the Tables tab of Application Data. |
cate_21a407a3372c4ba7aedc649709143f0cxxxxxxxx |
| Id |
string |
The file ID. |
doc_c134aa2073204a5d936d870bf960f56axxxxxxxx |
| Name |
string |
The file name. |
product-overview |
| Size |
integer |
The file size, in bytes. |
996765 |
| DocumentType |
string |
The file format type. Valid values: pdf, docx, doc, txt, md, pptx, ppt, png, jpg, jpeg, bmp, gif, and EXCEL. |
|
| Status |
string |
The file import status. Valid values:
Valid values:
|
RUNNING |
| Code |
string |
The error status code for the file import. |
110002 |
| Message |
string |
The error message for the file import. |
check fileUrlKey[file_path] / fileNameKey[null] / fileExtensionKey[file_extension] is invalid |
| GmtModified |
integer |
The time when the file was imported to the knowledge base, in UNIX timestamp format. |
1744856423000 |
| IndexId |
string |
The knowledge base ID. |
pno97txxxx |
| TotalCount |
integer |
The total number of returned results. |
2437 |
| PageNumber |
integer |
The returned page number. |
1 |
| PageSize |
integer |
The returned number of entries per page. |
10 |
| Status |
string |
The status code returned by the operation. |
200 |
Examples
Success response
JSON format
{
"RequestId": "35A267BF-xxxx-54DB-8394-AA3B0742D833",
"Code": "InvalidParameter",
"Message": "Required parameter(%s) missing or invalid, please check the request parameters.",
"Success": true,
"Data": {
"Documents": [
{
"SourceId": "cate_21a407a3372c4ba7aedc649709143f0cxxxxxxxx",
"Id": "doc_c134aa2073204a5d936d870bf960f56axxxxxxxx",
"Name": "product-overview",
"Size": 996765,
"DocumentType": "pdf",
"Status": "RUNNING",
"Code": "110002",
"Message": "check fileUrlKey[file_path] / fileNameKey[null] / fileExtensionKey[file_extension] is invalid",
"GmtModified": 1744856423000
}
],
"IndexId": "pno97txxxx",
"TotalCount": 2437,
"PageNumber": 1,
"PageSize": 10
},
"Status": "200"
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.