Skip to main content

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.
This 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

FieldRequiredTypeDescription
index_idYesstringID 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

FieldTypeDescription
codestringResponse code. Success when successful.
status_codeintegerHTTP status code.
successbooleanWhether the operation succeeded.
messagestringResponse message. success when successful.
request_idstringUnique request identifier. Provide this ID when troubleshooting.
statusstringRequest status. SUCCESS when successful.
Managed Agent API
Flow Agent API
Sandbox API
RAG API
Long-term Memory
ParseX API
Security API
Framework Integration