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

# List files in a directory

> List files in a specific directory. When called on the root directory ('/'), this only returns files in the root directory and excludes files in subdirectories. To see all files across all directories, use `?recursive=true` parameter.



## OpenAPI

````yaml get /files
openapi: 3.0.0
info:
  title: OpenFiles SDK API
  description: >-
    AI-native file storage platform with create, read, write operations, version
    control, and semantic search.
  version: 2.0.0
  contact:
    name: OpenFiles Support
    url: https://openfiles.ai
servers:
  - url: https://api.openfiles.ai/functions/v1/api
    description: Production
  - url: http://localhost:54321/functions/v1/api
    description: Local Development
security: []
tags:
  - name: System
    description: System health and status operations
  - name: Files
    description: File storage operations with version control
paths:
  /files:
    get:
      tags:
        - Files
      summary: List files in a directory
      description: >-
        List files in a specific directory. When called on the root directory
        ('/'), this only returns files in the root directory and excludes files
        in subdirectories. To see all files across all directories, use
        `?recursive=true` parameter.
      operationId: listFiles
      parameters:
        - name: directory
          in: query
          schema:
            type: string
            default: /
          description: Directory to list files from
        - name: recursive
          in: query
          schema:
            type: boolean
            default: false
          description: >-
            If true, lists all files across all directories. If false (default),
            only lists files in the specified directory.
        - name: contentType
          in: query
          schema:
            type: string
        - name: limit
          in: query
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 10
        - name: offset
          in: query
          schema:
            type: integer
            minimum: 0
            default: 0
        - name: minSize
          in: query
          schema:
            type: integer
            minimum: 0
        - name: maxSize
          in: query
          schema:
            type: integer
            minimum: 0
        - name: createdAfter
          in: query
          schema:
            type: string
            format: date-time
        - name: createdBefore
          in: query
          schema:
            type: string
            format: date-time
        - name: updatedAfter
          in: query
          schema:
            type: string
            format: date-time
        - name: updatedBefore
          in: query
          schema:
            type: string
            format: date-time
        - name: sortBy
          in: query
          schema:
            type: string
            enum:
              - path
              - created_at
              - updated_at
              - size
            default: path
        - name: sortOrder
          in: query
          schema:
            type: string
            enum:
              - asc
              - desc
            default: asc
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileListResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    FileListResponse:
      type: object
      required:
        - success
        - data
        - operation
        - message
      properties:
        success:
          type: boolean
          example: true
        data:
          type: object
          properties:
            files:
              type: array
              items:
                $ref: '#/components/schemas/FileMetadata'
            total:
              type: integer
              minimum: 0
            limit:
              type: integer
              minimum: 1
            offset:
              type: integer
              minimum: 0
        operation:
          type: string
          example: list_files
        message:
          type: string
          example: Files listed successfully
    FileMetadata:
      type: object
      properties:
        id:
          type: string
          format: uuid
        path:
          type: string
        version:
          type: integer
          minimum: 1
        mimeType:
          type: string
        size:
          type: integer
          minimum: 0
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    ErrorResponse:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          example: false
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
            message:
              type: string
        operation:
          type: string
        details:
          type: object
          additionalProperties: true
  responses:
    Unauthorized:
      description: Authentication required or invalid API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: API key for authentication. Get your API key from the console.

````