Delete Document
Delete the specified document under the current RAG knowledge base. The service will attempt to delete the physical files, vector data, and database records.
Try It
DELETE
/documents/documentshttps://api-platform.ope.aiAuthentication
Uses Bearer Token authentication.
- Header:
Authorization: Bearer <token> - Example:
Authorization: Bearer sk-xxxxxx
Request Body (application/json)
| Field | Type | Required | Description | Default / Range |
|---|---|---|---|---|
doc_id | string | Yes | The ID of the document to delete | - |
Request Examples
- cURL
- JavaScript
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"}'
const res = await fetch("https://api-platform.ope.ai/documents/documents", {
method: "DELETE",
headers: {
Authorization: `Bearer ${process.env.OPEAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({doc_id: "doc_1"}),
});
console.log(await res.json());
Response Example
{
"status": "deleted",
"doc_id": "doc_1"
}
Error Responses
| Status Code | Scenario | Description |
|---|---|---|
401 | Authentication failed | API Key is missing, invalid, or has insufficient permissions |
422 | Validation failed | doc_id is missing or in an incorrect format |
500 | Deletion failed | Failed to delete file, vector data, or database records |