Skip to main content

Delete Document

Delete a document and all its associated chunks from the 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,在控制台 API Key 页面 获取。

Body

application/json
string
required

知识库 ID。

string[]
required

要删除的文档 ID 列表。

Response

200-application/json
string

响应码,成功时为 Success。

integer

HTTP 状态码。

string

请求唯一标识,排查问题时请提供此 ID。

object
boolean

操作是否成功。

string

响应消息,成功时为 success。

string

请求状态:SUCCESS 或 FAILED。