Skip to main content
POST
https://api.moorcheh.ai
/
v1
/
namespaces
/
{namespace_name}
/
documents
/
delete
curl -X POST "https://api.moorcheh.ai/v1/namespaces/my-namespace/documents/delete" \
  -H "Content-Type: application/json" \
  -H "x-api-key: your-api-key-here" \
  -d '{
    "ids": [
      "document-001",
      "document-002",
      "document-003"
    ]
  }'
{
  "status": "success",
  "message": "Successfully processed deletion request. Requested: 1, Actually deleted: 0 items from namespace 'test'.",
  "requested_deletions": 1,
  "actual_deletions": 0,
  "remaining_items": 1,
  "requested_ids": [
    "doc-001"
  ]
}

Overview

Delete specific documents or vectors from a namespace by providing their IDs. Use the documents endpoint for text data and vectors endpoint for vector data. Both operations are permanent and decrement your total item count.
This operation permanently deletes data and cannot be undone. Deleted items will decrement your total item count.

Endpoints

  • Documents: POST /namespaces/{namespace_name}/documents/delete - Delete text documents from namespace
  • Vectors: POST /namespaces/{namespace_name}/vectors/delete - Delete vector embeddings from namespace

Authentication

x-api-key
string
required
Your API key for authentication
Content-Type
string
required
Must be application/json

Path Parameters

namespace_name
string
required
Name of the namespace containing the data to delete

Body Parameters

ids
array
required
Array of item IDs to delete (max 1000 items per request). Numbers will be converted to strings.
curl -X POST "https://api.moorcheh.ai/v1/namespaces/my-namespace/documents/delete" \
  -H "Content-Type: application/json" \
  -H "x-api-key: your-api-key-here" \
  -d '{
    "ids": [
      "document-001",
      "document-002",
      "document-003"
    ]
  }'
{
  "status": "success",
  "message": "Successfully processed deletion request. Requested: 1, Actually deleted: 0 items from namespace 'test'.",
  "requested_deletions": 1,
  "actual_deletions": 0,
  "remaining_items": 1,
  "requested_ids": [
    "doc-001"
  ]
}

Response Fields

Success Response (200)

status
string
Always “success” for 200 responses
message
string
Human-readable confirmation message with deletion counts
requested_deletions
number
Number of items requested to be deleted
actual_deletions
number
Number of items actually deleted
remaining_items
number
Total number of items remaining in namespace after deletion
requested_ids
array
List of item IDs that were requested to be deleted

Partial Success Response (207)

status
string
“partial” for 207 responses
unprocessed_ids
array
IDs of items that failed to be deleted

Important Notes

  • Maximum of 1,000 IDs can be deleted in a single request
  • IDs can be strings or numbers - they’ll be converted to strings internally
  • This operation permanently deletes data and cannot be undone
  • Successfully deleted items will decrement your total item count
  • Use the correct endpoint: documents/delete for text data, vectors/delete for vector data
  • Both endpoints use POST method (not DELETE) for security and payload reasons
  • Namespace must exist and belong to your account
  • The API uses batch deletion for efficient processing

Understanding Responses

  • 200 Response: No items failed to process (no unprocessed items)
  • 207 Response: Some items were successfully deleted while others failed
  • Check actual_deletions vs requested_deletions to see if items were found
  • If actual_deletions is 0, the requested IDs may not exist in the namespace
  • The remaining_items count reflects the current namespace size

Use Cases

  • Data Cleanup: Remove outdated or temporary documents/vectors
  • Content Management: Delete specific items by ID
  • Privacy Compliance: Remove specific user data
  • Storage Management: Free up space by removing unused content
  • Testing: Clean specific test data between runs