Collection Documents

Batch Delete Documents

Changed on

Batch delete multiple documents by explicit IDs or filters.

Supports TWO modes:

  1. Explicit IDs mode: Provide 'document_ids' array

    • Deletes specific documents by ID
    • Returns detailed per-document results
    • Maximum 1000 documents per batch
  2. Filter mode: Provide 'filters' to delete all matching documents

    • Deletes ALL documents matching the filters
    • Returns total count only
    • Use with caution - can delete many documents

Key Features:

  • Per-document success/failure reporting in explicit mode
  • Validates documents exist in the specified collection
  • Automatic document count update for the collection
  • Efficient bulk deletion

Examples: Explicit IDs mode: json { "document_ids": ["doc_123", "doc_456", "doc_789"] }

Filter mode (logical AND/OR/NOT shape — NOT MVS-native must/key):
```json
{
    "filters": {"AND": [{"field": "metadata.status", "operator": "eq", "value": "archived"}]}
}
```
delete/v1/collections/{collection_identifier}/documents/batch

Request

  • Base URL: https://api.mixpeek.com
  • URL: https://api.mixpeek.com/v1/collections/{collection_identifier}/documents/batch
  • Auth: HTTP bearer and API key in header X-Namespace

Path parameters

collection_identifierstring required

The ID of the collection to delete documents from.

Request body

document_idsstring[] nullable

OPTIONAL. List of document IDs to delete. Use this mode when you know exact document IDs to delete. Mutually exclusive with filters mode. Maximum 1000 documents per batch request.

reasonstring nullable

OPTIONAL. Why this bulk delete is happening — recorded on the DOCUMENT_BULK_SOFT_DELETED audit event so a document-level wipe carries the caller's own context, not just the actor and counts.

Example request

{
  "description": "Explicit IDs mode: Delete 3 specific documents",
  "document_ids": [
    "doc_123",
    "doc_456",
    "doc_789"
  ]
}

Response

Successful Response

task_idstring nullable

Id of the background task for a FILTER-mode delete. Null for explicit-IDs mode (which completes synchronously). Poll GET /v1/tasks/{task_id} for status and the final deleted_count.

statusstring nullable

Task status at enqueue time (PENDING) for a filter-mode delete. Null for the synchronous explicit-IDs mode.

deleted_countinteger nullable

Total number of documents successfully deleted. Null on the async filter-mode enqueue response; populated on the task record when it completes, and returned synchronously in explicit-IDs mode.

failed_countinteger

Total number of documents that failed to delete

limitsobject nullable

Filter mode only: the caps this request ran against. max_rows_inline is the row cap under which a delete by filter runs in the request; matched is how many documents the filter matched when the request arrived. Over the cap the delete runs as a task (task_id).

messagestring

Summary message of the operation

Example response

{
  "deleted_count": 3,
  "failed_count": 0,
  "message": "Successfully deleted 3 document(s)",
  "results": [
    {
      "document_id": "doc_123",
      "success": true
    },
    {
      "document_id": "doc_456",
      "success": true
    },
    {
      "document_id": "doc_789",
      "success": true
    }
  ]
}

Changes

    • warning

      removed the optional property from the response with the status

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the optional property to the response with the status

    • info

      added the required property to the response with the status

    • info

      added the required property to the response with the status

    • info

      added the optional property to the response with the status