跳到主要内容

删除文档

删除当前 RAG 知识库下的指定文档。服务会尝试删除物理文件、向量数据和数据库记录。

Try It

DELETE/documents/documentshttps://api-platform.ope.ai

认证

使用 Bearer Token 认证。

  • Header:Authorization: Bearer <token>
  • 示例:Authorization: Bearer sk-xxxxxx

请求体(application/json)

字段类型必填说明默认值 / 范围
doc_idstring要删除的文档 ID-

请求示例

curl -X DELETE "https://api-platform.ope.ai/documents/documents" \
-H "Authorization: Bearer $OPEAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"doc_id":"doc_1"}'

响应示例

{
"status": "deleted",
"doc_id": "doc_1"
}

错误响应

状态码场景说明
401鉴权失败API Key 缺失、无效或权限不足
422参数校验失败doc_id 缺失或格式不正确
500删除失败文件、向量数据或数据库记录删除失败