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

# Preview Delete By Metadata

> Preview how many documents would be deleted by the metadata filter.



## OpenAPI

````yaml post /api/v1/documents/delete/preview
openapi: 3.1.0
info:
  title: Fieldwise API
  description: API for the Fieldwise platform.
  version: 1.0.0
servers:
  - url: https://api.fieldwise.ai
security:
  - ApiKeyAuth: []
paths:
  /api/v1/documents/delete/preview:
    post:
      tags:
        - Documents
      summary: Preview Delete By Metadata
      description: Preview how many documents would be deleted by the metadata filter.
      operationId: preview_delete_by_metadata_api_v1_documents_delete_preview_post
      parameters:
        - name: X-API-Key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Api-Key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeleteByMetadataRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeletePreviewResponse'
        '401':
          description: Invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDetail'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDetail'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDetail'
components:
  schemas:
    DeleteByMetadataRequest:
      properties:
        metadata_filter:
          type: object
          title: Metadata Filter
          description: Metadata filters using MongoDB-like query syntax
        created_at_filter:
          anyOf:
            - type: object
            - type: 'null'
          title: Created At Filter
          description: >-
            Filter by created_at database field. Supports operators: $eq, $ne,
            $gt, $lt, $gte, $lte, $in, $nin. Use ISO date format (e.g.,
            '2024-01-01T00:00:00')
        updated_at_filter:
          anyOf:
            - type: object
            - type: 'null'
          title: Updated At Filter
          description: >-
            Filter by updated_at database field. Supports operators: $eq, $ne,
            $gt, $lt, $gte, $lte, $in, $nin. Use ISO date format (e.g.,
            '2024-01-01T00:00:00')
      type: object
      required:
        - metadata_filter
      title: DeleteByMetadataRequest
      description: Request model for deleting documents by metadata filter.
      example:
        created_at_filter:
          $gte: '2024-01-01T00:00:00'
          $lt: '2024-12-31T23:59:59'
        metadata_filter:
          $or:
            - category: finance
            - $and:
                - status: archived
                - age:
                    $gt: 365
        updated_at_filter:
          $gte: '2024-01-01T00:00:00'
          $lt: '2024-12-31T23:59:59'
    DeletePreviewResponse:
      properties:
        success:
          type: boolean
          title: Success
          default: true
        data:
          allOf:
            - $ref: '#/components/schemas/DeletePreviewResponseData'
          description: Response data
        error:
          anyOf:
            - $ref: '#/components/schemas/ErrorDetail'
            - type: 'null'
        meta:
          $ref: '#/components/schemas/MetaData'
      type: object
      required:
        - data
      title: DeletePreviewResponse
    ErrorDetail:
      properties:
        message:
          type: string
          title: Message
          description: Error message
        error_code:
          type: string
          title: Error Code
          description: Error code identifier
        details:
          anyOf:
            - items:
                type: object
              type: array
            - type: 'null'
          title: Details
          description: Additional error details
      type: object
      required:
        - message
        - error_code
      title: ErrorDetail
      description: Schema for API error responses.
      example:
        error_code: RESOURCE_NOT_FOUND
        message: Resource not found
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    DeletePreviewResponseData:
      properties:
        document_count:
          type: integer
          title: Document Count
          description: Number of documents that would be deleted
        document_ids:
          items:
            type: integer
          type: array
          title: Document Ids
          description: List of document IDs that would be deleted
      type: object
      required:
        - document_count
        - document_ids
      title: DeletePreviewResponseData
      description: Response data for delete preview operations.
    MetaData:
      properties:
        timestamp:
          type: string
          format: date-time
          title: Timestamp
        version:
          type: string
          title: Version
          default: '1.0'
      type: object
      title: MetaData
      description: Metadata for API responses
    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
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````