List the documents in a Knowledge Base with pagination support.
Prerequisites
Configure the endpoint and authentication first. See API overview and Authentication.
Endpoint
GET /api/v1/indices/rag/index/files
List the documents in a specified knowledge base with pagination support.
Query parameters
| Field | Required | Type | Description |
|---|---|---|---|
index_id | Yes | string | Knowledge base ID, corresponding to the pipelineId returned when the knowledge base is created. |
page_number | No | integer | Page number, starting from 1. Default: 1. |
page_size | No | integer | Number of documents returned per page. Default: 10. Maximum: 100. |
Request example
BASE_URL is https://{workspace_id}.cn-beijing.maas.aliyuncs.com ({workspace_id} is the workspace ID), and BAILIAN_API_KEY is your Alibaba Cloud Model Studio API key.
Response example
Returns 200 on success.
Response fields
| Field | Type | Description |
|---|---|---|
code | string | Response code. Success on success. |
status_code | integer | HTTP status code. |
request_id | string | Unique request identifier. Provide this ID when troubleshooting. |
data | object | Business data. Sub-fields: page_number (integer, current page number), total_count (integer, total number of documents), rows (array<object>, document list. Element fields: doc_id (string, unique document identifier), doc_name (string, document name), doc_type (string, document type, such as pdf, docx, or txt), code (string, fine-grained processing status code, such as FINISH, PARSE_FAILED, or PIPELINE_JOB_RETRY_IMPORT_ERROR), status (string, coarse-grained processing status, such as FINISH, PARSE_FAILED, or INSERT_ERROR; usually consistent with code, while code provides finer error classification), message (string, processing status description; the error reason on failure), size (integer, file size in bytes), gmt_modified (integer, last modified time as a millisecond Unix timestamp), dataSync (boolean, whether the document is incremental sync data), categoryId (string, ID of the category), categoryName (string, name of the category), connectorId (string, ID of the connector), source_id (string, data source ID), ingestion_id (string, import task ID), tags (array<string>, document tag list), meta_extract_info (array, metadata extraction information), canDelete (boolean, whether the document can be deleted)). |
success | boolean | Whether the request succeeded. |
message | string | Message. success on success. |
status | string | Request status: SUCCESS or FAILED. |
Error codes
| HTTP status code | Error code | Message | Description |
|---|---|---|---|
| 400 | Index.InvalidParameter | Required parameter missing or invalid. | Invalid request parameters. |
| 401 | InvalidApiKey | Invalid API-key provided. | Authentication failed. The API key is invalid or missing. |