Delete Knowledge Base
Permanently delete a Knowledge Base along with all of its documents and chunks. This operation is irreversible — confirm nothing depends on the Knowledge Base before calling.
Prerequisites
Get an API key and a workspace ID, and configure authentication first. See API overview and Authentication.
Endpoint
POST /api/v1/indices/rag/index/delete
Permanently delete a Knowledge Base. Deleting the Knowledge Base also removes every document, chunk, and index it contains, with no way to recover them. Confirm the operation before calling.
WarningThis operation is irreversible. Deleting the Knowledge Base also removes every document, chunk, and index it contains, with no way to recover them. Confirm nothing depends on it before calling.
Request body
| Field | Required | Type | Description |
|---|---|---|---|
index_id | Yes | string | ID of the Knowledge Base to delete, that is, the data.pipelineId returned by Create Knowledge Base and Import. |
Request example
curl -X POST "$BASE_URL/api/v1/indices/rag/index/delete" \
-H "Authorization: Bearer $BAILIAN_API_KEY" \
-H "Content-Type: application/json" \
-d '{"index_id": "your-kb-id"}'
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.
{
"code": "Success",
"status_code": 200,
"success": true,
"message": "success",
"request_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"status": "SUCCESS"
}
Response fields
| Field | Type | Description |
|---|---|---|
code | string | Response code. Success when successful. |
status_code | integer | HTTP status code. |
success | boolean | Whether the operation succeeded. |
message | string | Response message. success when successful. |
request_id | string | Unique request identifier. Provide this ID when troubleshooting. |
status | string | Request status. SUCCESS when successful. |