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

# List Source Files

> List files available for ingestion from a data source (S3, SharePoint).

This endpoint queries the actual source storage (not the vector DB) to show files 
before they are ingested. Use this to enable selective file ingestion.

## Request Body

| Field                 | Type     | Description                                      |
|-----------------------|----------|--------------------------------------------------|
| `data_connector_name` | `str`    | Name of the data connector to query              |
| `prefix`              | `str`    | Optional path prefix to filter files             |
| `search_query`        | `str`    | Optional filename search (case-insensitive)      |
| `limit`               | `int`    | Max files to return (default: 1000, max: 10000)  |
| `offset`              | `int`    | Number of files to skip for pagination           |

## Response

- `files`: List of file objects with path, size, last_modified
- `total_count`: Total number of matching files in the source
- `next_offset`: Offset for next page (null if no more pages)
- `selection_enabled`: False if total_count > 10000 (use full ingestion instead)



## OpenAPI

````yaml /deasy-openapi-stainless.yml post /ocr/list_source_files
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: /rest/unstructured
security: []
paths:
  /ocr/list_source_files:
    post:
      tags:
        - Data Connectors
      summary: List Source Files
      description: >-
        List files available for ingestion from a data source (S3, SharePoint).


        This endpoint queries the actual source storage (not the vector DB) to
        show files 

        before they are ingested. Use this to enable selective file ingestion.


        ## Request Body


        | Field                 | Type     |
        Description                                      |

        |-----------------------|----------|--------------------------------------------------|

        | `data_connector_name` | `str`    | Name of the data connector to
        query              |

        | `prefix`              | `str`    | Optional path prefix to filter
        files             |

        | `search_query`        | `str`    | Optional filename search
        (case-insensitive)      |

        | `limit`               | `int`    | Max files to return (default: 1000,
        max: 10000)  |

        | `offset`              | `int`    | Number of files to skip for
        pagination           |


        ## Response


        - `files`: List of file objects with path, size, last_modified

        - `total_count`: Total number of matching files in the source

        - `next_offset`: Offset for next page (null if no more pages)

        - `selection_enabled`: False if total_count > 10000 (use full ingestion
        instead)
      operationId: list_source_files_ocr_list_source_files_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ListSourceFilesRequest'
        required: true
      responses:
        '200':
          description: Files listed successfully
          content:
            application/json:
              schema: {}
        '400':
          description: Invalid request or unsupported connector type
        '401':
          description: Invalid or expired credentials
        '403':
          description: Missing token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPError'
        '404':
          description: Data connector not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '429':
          description: Too many requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPError'
        '500':
          description: >-
            Internal Server Error. An unexpected error occurred while processing
            the request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPError'
        '502':
          description: Failed to connect to data source
      security:
        - BasicAuth: []
        - BearerAuth: []
          UserIdAuth: []
      x-codeSamples:
        - lang: Python
          source: |-
            import os
            from unstructured import UnstructuredClient

            client = UnstructuredClient(
                username=os.environ.get("UNSTRUCTURED_USERNAME"),  # This is the default and can be omitted
                password=os.environ.get("UNSTRUCTURED_PASSWORD"),  # This is the default and can be omitted
            )
            response = client.data_source.list_source_files(
                data_connector_name="data_connector_name",
            )
            print(response)
        - lang: JavaScript
          source: |-
            import UnstructuredClient from 'unstructured-sdk';

            const client = new UnstructuredClient({
              authMethod: 'My Auth Method',
              username: process.env['UNSTRUCTURED_USERNAME'], // This is the default and can be omitted
              password: process.env['UNSTRUCTURED_PASSWORD'], // This is the default and can be omitted
            });

            const response = await client.dataSource.listSourceFiles({
              data_connector_name: 'data_connector_name',
            });

            console.log(response);
components:
  schemas:
    ListSourceFilesRequest:
      properties:
        data_connector_name:
          type: string
          title: Data Connector Name
        prefix:
          anyOf:
            - type: string
            - type: 'null'
          title: Prefix
        search_query:
          anyOf:
            - type: string
            - type: 'null'
          title: Search Query
        limit:
          type: integer
          maximum: 10000
          minimum: 1
          title: Limit
          default: 1000
        offset:
          type: integer
          minimum: 0
          title: Offset
          default: 0
      type: object
      required:
        - data_connector_name
      title: ListSourceFilesRequest
      description: Request to list files from a data source.
    HTTPError:
      properties:
        detail:
          type: string
          title: Detail
      type: object
      required:
        - detail
      title: HTTPError
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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:
    BasicAuth:
      type: http
      scheme: basic
    BearerAuth:
      type: http
      scheme: bearer
    UserIdAuth:
      type: apiKey
      in: header
      name: X-User-ID

````