Skip to main content

Delete Document

Delete a document and all of its chunks from a Knowledge Base.

POST
/api/v1/indices/rag/index/delete_file
cURL
curl -X POST "https://{workspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/indices/rag/index/delete_file" \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "index_id": "your_index_id",
    "doc_ids": ["file_xxx"]
  }'
{
  "code": "Success",
  "status_code": 200,
  "data": {
    "deleted": []
  },
  "success": true,
  "message": "success",
  "request_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "status": "SUCCESS"
}
This operation is irreversible. This endpoint uses snake_case parameters — index_id and doc_ids — unlike the camelCase (indexId) used by other endpoints. Sending IndexId or indexId returns Index.InvalidParameter.When a parameter is missing, the server returns Required parameter(IndexId) missing or invalid. The IndexId in that message is the server's internal field name, not the request parameter name — still send index_id.

Authorizations

string
header
required

DashScope API Key, obtained from the API Key page in the console.

Body

application/json
string
required

Knowledge base ID.

string[]
required

List of document IDs to delete.

Response

200-application/json
string

Response code. Success on success.

integer

HTTP status code.

string

Unique request identifier. Include this ID when reporting an issue.

object
boolean

Whether the operation succeeded.

string

Response message. success on success.

string

Request status: SUCCESS or FAILED.