Skip to main content
DELETE
Delete a document from a given assistant

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

External ID: This is the same externalId you provided when uploading the document with POST /api/documents/assistant/raw.

Response Structure

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:
  1. βœ… Ragie Document: Removed from AI knowledge platform
  2. βœ… Database Record: Removed from knowledge_base_document table
  3. βœ… AI Knowledge: Assistant will no longer use this content
  4. ❌ Folder: The containing folder is NOT deleted
  5. ❌ Assistant Link: Assistant-folder link remains (only document removed)

Error Responses

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"
Make sure to track these IDs in your system!

Best Practices

1. Track External IDs

2. Confirm Before Delete

3. Handle Not Found Gracefully

Headers

x-api-key
string
required

API key needed to authorize the request

Path Parameters

externalId
string
required

The external id of the document

Response

Document deleted successfully.