Documents

Delete Document

Remove a document from your database by its ID. This permanently deletes the document and its associated embeddings.

DELETE/databases/{db_id}/documents/{doc_id}

Request

Replace {db_id} with your database ID and {doc_id} with the id you got back from the insert. No request body is needed.

Response

Returns the deleted document.

Example response
{
  "id": "4de5bed5-e483-4bd7-9760-a54ec07aefd9",
  "content": "How to fix a leaky kitchen faucet",
  "metadata": {
    "category": "home-repair"
  },
  "created_at": "2024-01-15T10:30:00Z"
}
id string
ID of the deleted document
content string | null
Document text. null for images
metadata object | null
Metadata stored with the document
created_at string
When the document was created, in ISO 8601

Delete Multiple Documents

Delete up to 1,000 documents in one request. IDs that don't exist are skipped, and the response lists the documents that were actually deleted.

DELETE/databases/{id}/documents/batch
Example request
{
  "ids": [
    "4de5bed5-e483-4bd7-9760-a54ec07aefd9",
    "9b1c2f7e-3a6d-4c1e-8f0a-2d5e7b9c1a34"
  ]
}
ids string[] required
1–1,000 document IDs to delete
Example response
{
  "count": 2,
  "ids": [
    "4de5bed5-e483-4bd7-9760-a54ec07aefd9",
    "9b1c2f7e-3a6d-4c1e-8f0a-2d5e7b9c1a34"
  ]
}
count integer
Number of documents deleted
ids string[]
IDs of the documents that were deleted

Delete by Filter

Delete every document whose metadata matches a filter, such as all products where color is red.

DELETE/databases/{id}/documents
Example request
{
  "metadata": {
    "color": "red",
    "size": { "$in": ["S", "M"] }
  }
}

Filter ·required

metadata object
Delete documents matching this filter. Supports values, $in and ranges. Must have at least one key. Metadata Filters
Example response
{
  "count": 42
}

Response

count integer
Number of documents deleted