Skip to main content

Delete Chunks

Delete chunks in batch — up to 10 per call.

Prerequisites

Configure the endpoint and authentication first. See API overview and Authentication.

Endpoint

POST /api/v1/indices/rag/index/chunk/delete Delete chunks from a specified knowledge base in batch, up to 10 per call.
This operation is irreversible. Deleted chunks cannot be recovered. A single call accepts up to 10 chunks.

Request body

FieldRequiredTypeDescription
pipelineIdYesstringKnowledge base ID.
chunkIdsYesarray<string>List of chunk IDs to delete, up to 10 per call.

Request example

curl -X POST "$BASE_URL/api/v1/indices/rag/index/chunk/delete" \
  -H "Authorization: Bearer $BAILIAN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "pipelineId": "your_index_id",
    "chunkIds": ["chunk_abc123", "chunk_def456"]
  }'
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,
  "request_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}

Response fields

FieldTypeDescription
codestringResponse code. Success on success.
status_codeintegerHTTP status code.
request_idstringUnique request identifier. Provide this ID when troubleshooting.
dataobjectReturned as an empty object when the operation succeeds.
successbooleanWhether the operation succeeded.
messagestringResponse message. success on success.
statusstringRequest status: SUCCESS or FAILED.

Error codes

HTTP status codeError codeMessageDescription
400Index.InvalidParameterRequired parameter missing or invalid.Invalid request parameters.
401InvalidApiKeyInvalid API-key provided.Authentication failed. The API key is invalid or missing.
Managed Agent API
Flow Agent API
Sandbox API
RAG API
Long-term Memory
ParseX API
Security API
Framework Integration