Overview
Delete a document from your AI assistantβs knowledge base using its external ID. This removes the document from both Ragie (AI platform) and your database, ensuring your assistant no longer uses this content. Use this endpoint to remove outdated, incorrect, or sensitive information from your AIβs knowledge.Use Cases
- Content Updates: Remove old versions before uploading new ones
- Data Cleanup: Remove outdated or deprecated documentation
- Compliance: Delete sensitive information that shouldnβt be in AI knowledge
- Content Management: Remove documents that are no longer relevant
- Error Correction: Delete incorrectly uploaded documents
- Bulk Cleanup: Programmatically remove multiple outdated documents
Authentication
This endpoint requires authentication using an API key. Include your API key in the request header:Path Parameters
Parameter | Type | Required | Description |
---|---|---|---|
externalId | string | Yes | The external ID you assigned when uploading |
External ID: This is the same
externalId
you provided when uploading the
document with POST /api/documents/assistant/raw
.Response Structure
Field | Type | Description |
---|---|---|
status | string | Deletion status (e.g., βdeletedβ) |
Example Request
Example Response
Common Use Cases
1. Delete Single Document
2. Update Document (Delete + Upload)
3. Bulk Delete Documents
4. Clean Up Old Documents
5. Safe Delete with Confirmation
What Gets Deleted
When you delete a document:- β Ragie Document: Removed from AI knowledge platform
- β Database Record: Removed from knowledge_base_document table
- β AI Knowledge: Assistant will no longer use this content
- β Folder: The containing folder is NOT deleted
- β Assistant Link: Assistant-folder link remains (only document removed)
Error Responses
Status Code | Description |
---|---|
400 | Bad Request - Invalid external ID |
401 | Unauthorized - Invalid or missing API key |
404 | Not Found - Document not found |
500 | Internal Server Error - Something went wrong |
Important Notes
- Uses External ID: Delete by YOUR external ID, not Ragieβs internal ID
- Permanent: Deletion is permanent and cannot be undone
- Both Systems: Deletes from both Ragie and your database
- Folder Intact: Only document is deleted, folder remains
- Immediate Effect: AI will stop using this content immediately
- Not Found OK: Deleting non-existent document returns 404
External ID Format
Your external ID can be any string:- β
"product-guide-v2"
- β
"cms-article-12345"
- β
"faq-${Date.now()}"
- β
"user-manual-en"
Related Endpoints
- POST /api/documents/assistant/raw - Upload a new document
- GET /api/documents/assistant/folders - List folders and documents
- POST /api/documents/assistant/folders - Create folders
Best Practices
1. Track External IDs
2. Confirm Before Delete
3. Handle Not Found Gracefully
Headers
API key needed to authorize the request
Path Parameters
The external id of the document
Response
Document deleted successfully.