> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# List Files in Source

> List available files and folders in a specific content source. Supports pagination and folder navigation.



## OpenAPI

````yaml get /knowledge/{knowledge_id}/sources/{source_id}/files
openapi: 3.1.0
info:
  title: Agno API Reference
  description: The all-in-one, private, secure agent platform that runs in your cloud.
  version: 3.0.4
servers: []
security: []
paths:
  /knowledge/{knowledge_id}/sources/{source_id}/files:
    get:
      tags:
        - Knowledge
      summary: List Files in Source
      description: >-
        List available files and folders in a specific content source. Supports
        pagination and folder navigation.
      operationId: list_source_files
      parameters:
        - name: knowledge_id
          in: path
          required: true
          schema:
            type: string
            description: ID of the knowledge base
            title: Knowledge Id
          description: ID of the knowledge base
        - name: source_id
          in: path
          required: true
          schema:
            type: string
            title: Source Id
            description: ID of the content source
          description: ID of the content source
        - name: prefix
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Path prefix to filter files
            title: Prefix
          description: Path prefix to filter files
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            maximum: 1000
            minimum: 1
            description: Number of files per page
            default: 100
            title: Limit
          description: Number of files per page
        - name: page
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
            title: Page
            description: Page number (1-indexed)
            default: 1
          description: Page number (1-indexed)
        - name: delimiter
          in: query
          required: false
          schema:
            type: string
            description: Folder delimiter (enables folder grouping)
            default: /
            title: Delimiter
          description: Folder delimiter (enables folder grouping)
        - name: db_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: The ID of the database to use
            title: Db Id
          description: The ID of the database to use
      responses:
        '200':
          description: Files listed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SourceFilesResponseSchema'
              example:
                source_id: company-s3
                source_name: Company Documents
                prefix: reports/
                folders:
                  - prefix: reports/2024/
                    name: '2024'
                    is_empty: false
                files:
                  - key: reports/annual-summary.pdf
                    name: annual-summary.pdf
                    size: 102400
                    last_modified: '2024-01-15T10:30:00Z'
                    content_type: application/pdf
                meta:
                  page: 1
                  limit: 100
                  total_pages: 1
                  total_count: 1
        '400':
          description: Unsupported source type
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthenticatedResponse'
        '403':
          description: 'Insufficient permissions. Required scope(s): knowledge:read'
        '404':
          description: Knowledge base or content source not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorResponse'
        '503':
          description: No knowledge base is configured on this AgentOS
      security:
        - {}
        - HTTPBearer: []
components:
  schemas:
    SourceFilesResponseSchema:
      properties:
        source_id:
          type: string
          title: Source Id
          description: ID of the content source
        source_name:
          type: string
          title: Source Name
          description: Name of the content source
        prefix:
          anyOf:
            - type: string
            - type: 'null'
          title: Prefix
          description: Prefix filter that was applied
        folders:
          items:
            $ref: '#/components/schemas/SourceFolderSchema'
          type: array
          title: Folders
          description: Subfolders at this level
        files:
          items:
            $ref: '#/components/schemas/SourceFileSchema'
          type: array
          title: Files
          description: List of files at this level
        meta:
          $ref: '#/components/schemas/PaginationInfo'
          description: Pagination metadata
      type: object
      required:
        - source_id
        - source_name
        - meta
      title: SourceFilesResponseSchema
      description: Response schema for listing files in a content source.
    BadRequestResponse:
      properties:
        detail:
          type: string
          title: Detail
          description: Human-readable error message
        error_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Id
          description: >-
            Stable identifier for the specific error, present only when the
            error carries one
        error_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Type
          description: Category of the error, present only when the error carries one
      type: object
      required:
        - detail
      title: BadRequestResponse
      example:
        detail: Bad request
    UnauthenticatedResponse:
      properties:
        detail:
          type: string
          title: Detail
          description: Human-readable error message
        error_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Id
          description: >-
            Stable identifier for the specific error, present only when the
            error carries one
        error_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Type
          description: Category of the error, present only when the error carries one
      type: object
      required:
        - detail
      title: UnauthenticatedResponse
      example:
        detail: Unauthenticated access
    NotFoundResponse:
      properties:
        detail:
          type: string
          title: Detail
          description: Human-readable error message
        error_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Id
          description: >-
            Stable identifier for the specific error, present only when the
            error carries one
        error_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Type
          description: Category of the error, present only when the error carries one
      type: object
      required:
        - detail
      title: NotFoundResponse
      example:
        detail: Not found
    ValidationErrorResponse:
      properties:
        detail:
          anyOf:
            - type: string
            - items:
                $ref: '#/components/schemas/ValidationErrorDetail'
              type: array
          title: Detail
          description: >-
            A single message for an explicitly raised 422, or a list of
            field-level errors for a request-validation failure
      type: object
      required:
        - detail
      title: ValidationErrorResponse
      description: >-
        422 body. Two runtime shapes share this status code, and the same
        endpoint can

        return either, so ``detail`` is typed as their union:


        - FastAPI's request-validation handler emits a **list** of field-level
        errors (built-in
          coercion errors and custom-validator ``ValueError``s alike).
        - A route that raises ``HTTPException(status_code=422, detail="...")``
        for a semantic
          check (e.g. an invalid cron expression) emits a **string** through the HTTPException
          handler.
      example:
        detail:
          - loc:
              - body
              - endpoint
            msg: Value error, Endpoint must be a path, not a full URL
            type: value_error
    InternalServerErrorResponse:
      properties:
        detail:
          type: string
          title: Detail
          description: Human-readable error message
        error_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Id
          description: >-
            Stable identifier for the specific error, present only when the
            error carries one
        error_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Type
          description: Category of the error, present only when the error carries one
      type: object
      required:
        - detail
      title: InternalServerErrorResponse
      example:
        detail: Internal server error
    SourceFolderSchema:
      properties:
        prefix:
          type: string
          title: Prefix
          description: Full prefix to use for navigating into this folder
        name:
          type: string
          title: Name
          description: Display name of the folder
        is_empty:
          type: boolean
          title: Is Empty
          description: Whether the folder contains any files
          default: false
      type: object
      required:
        - prefix
        - name
      title: SourceFolderSchema
      description: Schema for a folder in a content source.
    SourceFileSchema:
      properties:
        key:
          type: string
          title: Key
          description: Full path/key of the file
        name:
          type: string
          title: Name
          description: Display name (filename)
        size:
          anyOf:
            - type: integer
            - type: 'null'
          title: Size
          description: File size in bytes
        last_modified:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Last Modified
          description: ISO 8601 timestamp of last modification
        content_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Content Type
          description: MIME type of the file
      type: object
      required:
        - key
        - name
      title: SourceFileSchema
      description: Schema for a file in a content source.
    PaginationInfo:
      properties:
        page:
          type: integer
          minimum: 0
          title: Page
          description: Current page number
          default: 0
        limit:
          type: integer
          minimum: 1
          title: Limit
          description: Number of items per page
          default: 20
        total_pages:
          type: integer
          minimum: 0
          title: Total Pages
          description: Total number of pages
          default: 0
        total_count:
          type: integer
          minimum: 0
          title: Total Count
          description: Total count of items
          default: 0
        search_time_ms:
          type: number
          minimum: 0
          title: Search Time Ms
          description: Search execution time in milliseconds
          default: 0
      type: object
      title: PaginationInfo
    ValidationErrorDetail:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Loc
          description: Path to the offending field, e.g. ['body', 'endpoint']
        msg:
          type: string
          title: Msg
          description: Human-readable error message
        type:
          type: string
          title: Type
          description: Error type identifier, e.g. 'value_error' or 'missing'
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationErrorDetail
      description: >-
        One field-level error inside a 422 body, matching FastAPI's default
        shape.
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.