> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mixpeek.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Batch Delete Documents

> 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"}]}
    }
    ```



## OpenAPI

````yaml delete /v1/collections/{collection_identifier}/documents/batch
openapi: 3.1.0
info:
  title: Mixpeek API
  description: >-
    This is the Mixpeek API, providing access to various endpoints for data
    processing and retrieval.
  termsOfService: https://mixpeek.com/terms
  contact:
    name: Mixpeek Support
    url: https://mixpeek.com/contact
    email: info@mixpeek.com
  version: '0.82'
servers:
  - url: https://api.mixpeek.com
    description: Production
security: []
paths:
  /v1/collections/{collection_identifier}/documents/batch:
    delete:
      tags:
        - Collection Documents
      summary: Batch Delete Documents
      description: |-
        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"}]}
            }
            ```
      operationId: >-
        batch_delete_documents_v1_collections__collection_identifier__documents_batch_delete
      parameters:
        - name: collection_identifier
          in: path
          required: true
          schema:
            type: string
            description: The ID of the collection to delete documents from.
            title: Collection Identifier
          description: The ID of the collection to delete documents from.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BatchDeleteDocumentsRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatchDeleteDocumentsResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    BatchDeleteDocumentsRequest:
      properties:
        document_ids:
          anyOf:
            - items:
                type: string
              type: array
              maxItems: 1000
              minItems: 1
            - type: 'null'
          title: Document Ids
          description: >-
            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.
          examples:
            - - doc_123
              - doc_456
              - doc_789
            - - doc_frame_001
              - doc_frame_002
        filters:
          anyOf:
            - $ref: '#/components/schemas/LogicalOperator-Input'
            - type: 'null'
          description: >-
            OPTIONAL. Filter conditions to match documents for deletion.
            Mutually exclusive with 'document_ids' array. If provided, deletes
            ALL documents matching the filters. Use with caution - can delete
            many documents at once. Uses the logical AND/OR/NOT shape (not
            MVS-native must/key).
          examples:
            - AND:
                - field: metadata.status
                  operator: eq
                  value: archived
      type: object
      title: BatchDeleteDocumentsRequest
      description: >-
        Request model for batch deleting multiple documents by explicit IDs or
        filters.


        Supports TWO modes:

        1. Explicit IDs mode: Provide 'document_ids' array

        2. Filter mode: Provide 'filters' to delete all matching documents


        Use Cases:
            - Delete 5 specific documents in one API call
            - Delete all documents matching criteria
            - Bulk cleanup operations

        Requirements:
            - EITHER 'document_ids' OR 'filters' must be provided
            - NOT BOTH modes simultaneously
      examples:
        - description: 'Explicit IDs mode: Delete 3 specific documents'
          document_ids:
            - doc_123
            - doc_456
            - doc_789
        - description: 'Filter mode: Delete all archived documents'
          filters:
            AND:
              - field: metadata.status
                operator: eq
                value: archived
    BatchDeleteDocumentsResponse:
      properties:
        deleted_count:
          type: integer
          title: Deleted Count
          description: Total number of documents successfully deleted
        failed_count:
          type: integer
          title: Failed Count
          description: Total number of documents that failed to delete
          default: 0
        results:
          items:
            $ref: '#/components/schemas/BatchDocumentDeleteResult'
          type: array
          title: Results
          description: >-
            Detailed per-document results. Each entry shows document_id, success
            status, and error message (if failed). Empty list when using filter
            mode (only counts returned).
        message:
          type: string
          title: Message
          description: Summary message of the operation
          default: Batch delete completed
      type: object
      required:
        - deleted_count
      title: BatchDeleteDocumentsResponse
      description: >-
        Response model for batch document delete operation.


        Provides detailed per-document results showing success/failure for each
        deletion.
      examples:
        - 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
    ErrorResponse:
      properties:
        success:
          type: boolean
          title: Success
          description: Always false for error responses
          default: false
        status:
          type: integer
          title: Status
          description: HTTP status code for this error
        error:
          $ref: '#/components/schemas/ErrorDetail'
          description: Error details payload
      type: object
      required:
        - status
        - error
      title: ErrorResponse
      description: Error response model.
      examples:
        - error:
            details:
              id: ns_123
              resource: namespace
            message: Namespace not found
            type: NotFoundError
          status: 404
          success: false
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    LogicalOperator-Input:
      properties:
        AND:
          anyOf:
            - items:
                anyOf:
                  - $ref: '#/components/schemas/LogicalOperator-Input'
                  - $ref: '#/components/schemas/FilterCondition'
              type: array
            - type: 'null'
          title: And
          description: Logical AND operation - all conditions must be true
          example:
            - field: name
              operator: eq
              value: John
            - field: age
              operator: gte
              value: 30
        OR:
          anyOf:
            - items:
                anyOf:
                  - $ref: '#/components/schemas/LogicalOperator-Input'
                  - $ref: '#/components/schemas/FilterCondition'
              type: array
            - type: 'null'
          title: Or
          description: Logical OR operation - at least one condition must be true
          example:
            - field: status
              operator: eq
              value: active
            - field: role
              operator: eq
              value: admin
        NOT:
          anyOf:
            - items:
                anyOf:
                  - $ref: '#/components/schemas/LogicalOperator-Input'
                  - $ref: '#/components/schemas/FilterCondition'
              type: array
            - type: 'null'
          title: Not
          description: Logical NOT operation - all conditions must be false
          example:
            - field: department
              operator: eq
              value: HR
            - field: location
              operator: eq
              value: remote
        case_sensitive:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Case Sensitive
          description: Whether to perform case-sensitive matching
          default: false
          example: true
      additionalProperties: true
      type: object
      title: LogicalOperator
      description: >-
        Represents a logical operation (AND, OR, NOT) on filter conditions.


        Allows nesting with a defined depth limit.


        Also supports shorthand syntax where field names can be passed directly

        as key-value pairs for equality filtering (e.g., {"metadata.title":
        "value"}).
    BatchDocumentDeleteResult:
      properties:
        document_id:
          type: string
          title: Document Id
          description: Document ID that was deleted
        success:
          type: boolean
          title: Success
          description: Whether the deletion succeeded
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
          description: Error message if deletion failed
      type: object
      required:
        - document_id
        - success
      title: BatchDocumentDeleteResult
      description: Result of a single document deletion in a batch operation.
    ErrorDetail:
      properties:
        message:
          type: string
          title: Message
          description: Human-readable error message
        type:
          type: string
          title: Type
          description: Stable error type identifier (machine-readable)
        code:
          anyOf:
            - type: string
            - type: 'null'
          title: Code
          description: >-
            Fine-grained error code for programmatic handling (e.g.,
            namespace_name_taken, feature_extractor_not_found). Present only
            when consumers may need to branch on a specific error condition.
        details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Details
          description: >-
            Optional structured details to help debugging (validation errors,
            IDs, etc.)
      type: object
      required:
        - message
        - type
      title: ErrorDetail
      description: Error detail model.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    FilterCondition:
      properties:
        field:
          type: string
          title: Field
          description: Field name to filter on
        operator:
          $ref: '#/components/schemas/FilterOperator'
          description: Comparison operator
          default: eq
        value:
          anyOf:
            - $ref: '#/components/schemas/DynamicValue'
            - {}
          title: Value
          description: Value to compare against
      type: object
      required:
        - field
        - value
      title: FilterCondition
      description: |-
        Represents a single filter condition.

        Attributes:
            field: The field to filter on
            operator: The comparison operator
            value: The value to compare against
    FilterOperator:
      type: string
      enum:
        - eq
        - ne
        - gt
        - lt
        - gte
        - lte
        - in
        - nin
        - contains
        - starts_with
        - ends_with
        - regex
        - exists
        - is_null
        - text
        - phrase
      title: FilterOperator
      description: Supported filter operators across database implementations.
    DynamicValue:
      properties:
        type:
          type: string
          const: dynamic
          title: Type
          default: dynamic
        field:
          type: string
          title: Field
          description: >-
            The dot-notation path to the value in the runtime query request,
            e.g., 'inputs.user_id'
          examples:
            - inputs.query_text
            - filters.AND[0].value
      type: object
      required:
        - field
      title: DynamicValue
      description: A value that should be dynamically resolved from the query request.

````