> ## 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.

# List Documents



## OpenAPI

````yaml post /api/v1/documents/list
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/list:
    post:
      tags:
        - Documents
      summary: List Documents
      operationId: list_documents_api_v1_documents_list_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/DocumentListRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DocumentListResponse'
        '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:
    DocumentListRequest:
      properties:
        document_ids:
          anyOf:
            - items:
                type: integer
              type: array
            - type: 'null'
          title: Document Ids
          description: >-
            Specific document IDs to retrieve. When provided, ignores
            metadata_filter and latest_only parameters.
        metadata_filter:
          anyOf:
            - type: object
            - type: 'null'
          title: Metadata Filter
          description: >-
            Metadata filters using MongoDB-like query syntax. Supports
            comparison, array, and logical operators
        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')
        offset:
          type: integer
          minimum: 0
          title: Offset
          description: Number of items to skip
          default: 0
        limit:
          type: integer
          maximum: 100
          minimum: 1
          title: Limit
          description: Maximum number of items to return
          default: 10
        sort_field:
          allOf:
            - $ref: '#/components/schemas/DocumentSortField'
          description: Field to sort by
          default: last_created_at
        sort_order:
          allOf:
            - $ref: '#/components/schemas/SortOrder'
          description: Sort order (ascending or descending)
          default: desc
        latest_only:
          type: boolean
          title: Latest Only
          description: If True, returns only the latest version of each document
          default: true
      type: object
      title: DocumentListRequest
      example:
        created_at_filter:
          $gte: '2024-01-01T00:00:00'
          $lt: '2024-12-31T23:59:59'
        document_ids:
          - 1
          - 2
          - 3
        latest_only: true
        limit: 10
        metadata_filter:
          $and:
            - category: finance
            - tags:
                $contains:
                  - important
            - $or:
                - priority:
                    $gt: 2
                - status: active
        offset: 0
        sort_field: last_created_at
        sort_order: desc
        updated_at_filter:
          $gte: '2024-01-01T00:00:00'
          $lt: '2024-12-31T23:59:59'
    DocumentListResponse:
      properties:
        success:
          type: boolean
          title: Success
          default: true
        data:
          allOf:
            - $ref: '#/components/schemas/DocumentListData'
          description: Response data
        error:
          anyOf:
            - $ref: '#/components/schemas/ErrorDetail'
            - type: 'null'
        meta:
          $ref: '#/components/schemas/MetaData'
      type: object
      required:
        - data
      title: DocumentListResponse
    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
    DocumentSortField:
      type: string
      enum:
        - first_created_at
        - last_created_at
      title: DocumentSortField
    SortOrder:
      type: string
      enum:
        - asc
        - desc
      title: SortOrder
    DocumentListData:
      properties:
        documents:
          items:
            $ref: '#/components/schemas/DocumentPreview'
          type: array
          title: Documents
        total:
          type: integer
          title: Total
        offset:
          type: integer
          title: Offset
        limit:
          type: integer
          title: Limit
      type: object
      required:
        - documents
        - total
        - offset
        - limit
      title: DocumentListData
    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
    DocumentPreview:
      properties:
        id:
          type: integer
          title: Id
        external_id:
          anyOf:
            - type: string
            - type: 'null'
          title: External Id
        file_path:
          anyOf:
            - type: string
            - type: 'null'
          title: File Path
        document_metadata:
          type: object
          title: Document Metadata
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
        preview:
          anyOf:
            - type: string
            - type: 'null'
          title: Preview
          description: Preview of the first page content (truncated)
      type: object
      required:
        - id
        - external_id
        - file_path
        - document_metadata
        - created_at
        - updated_at
      title: DocumentPreview
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````