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

# Read file or get metadata

> Read file content, get metadata, or list versions



## OpenAPI

````yaml get /files/{path}
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/{path}:
    get:
      tags:
        - Files
      summary: Read file or get metadata
      description: Read file content, get metadata, or list versions
      operationId: readFile
      parameters:
        - name: path
          in: path
          required: true
          schema:
            type: string
          description: File path (S3-style, no leading slash)
          example: src/index.js
        - name: version
          in: query
          schema:
            type: integer
            minimum: 1
          description: Specific version to read
        - name: metadata
          in: query
          schema:
            type: string
            enum:
              - ''
          description: Get file metadata instead of content
        - name: versions
          in: query
          schema:
            type: string
            enum:
              - ''
          description: List all versions of the file
        - name: limit
          in: query
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 10
          description: Limit for versions listing
        - name: offset
          in: query
          schema:
            type: integer
            minimum: 0
            default: 0
          description: Offset for versions listing
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/FileContentResponse'
                  - $ref: '#/components/schemas/FileMetadataResponse'
                  - $ref: '#/components/schemas/FileVersionsResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    FileContentResponse:
      type: object
      required:
        - success
        - data
        - operation
        - message
      properties:
        success:
          type: boolean
          example: true
        data:
          type: object
          properties:
            id:
              type: string
              format: uuid
            path:
              type: string
            content:
              type: string
            version:
              type: integer
            mimeType:
              type: string
            size:
              type: integer
            createdAt:
              type: string
              format: date-time
            updatedAt:
              type: string
              format: date-time
        operation:
          type: string
          example: read_file
        message:
          type: string
          example: File read successfully
    FileMetadataResponse:
      type: object
      required:
        - success
        - data
        - operation
        - message
      properties:
        success:
          type: boolean
          example: true
        data:
          $ref: '#/components/schemas/FileMetadata'
        operation:
          type: string
          example: get_file_metadata
        message:
          type: string
          example: File metadata retrieved successfully
    FileVersionsResponse:
      type: object
      required:
        - success
        - data
        - operation
        - message
      properties:
        success:
          type: boolean
          example: true
        data:
          type: object
          properties:
            file:
              type: object
              properties:
                path:
                  type: string
                mimeType:
                  type: string
            versions:
              type: array
              items:
                type: object
                properties:
                  version:
                    type: integer
                  size:
                    type: integer
                  createdAt:
                    type: string
                    format: date-time
                  updatedAt:
                    type: string
                    format: date-time
            total:
              type: integer
              minimum: 0
            limit:
              type: integer
              minimum: 1
            offset:
              type: integer
              minimum: 0
        operation:
          type: string
          example: get_file_versions
        message:
          type: string
          example: File versions retrieved 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'
    NotFound:
      description: Resource not found
      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.

````