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

# List Files

> List files and folders in a knowledge base directory.

Both regular files and folders are returned. Folder entries have `content_type` set to `application/vnd.timbal.k2-directory` and `content_length` of `0`. Use the optional directory query parameter to scope results to a specific folder (e.g. `?directory=docs`).


## OpenAPI

````yaml GET /orgs/{org_id}/k2/{kb_id}/files
openapi: 3.1.0
info:
  title: Timbal Platform API
  description: Public API documentation for the Timbal platform
  license:
    name: ''
  version: 2.0.0
servers:
  - url: https://api.timbal.ai
    description: Production
  - url: https://api.dev.timbal.ai
    description: Development
security: []
tags:
  - name: ace
    description: Action Control Engine (ACE) operations
  - name: analytics
    description: Org and project analytics
  - name: billing
    description: Subscriptions, usage, and payment-related operations
  - name: content
    description: Re-sign stored content URLs
  - name: files
    description: File operations
  - name: iam
    description: IAM — actions, roles, users, and authorization introspection
  - name: k2
    description: Knowledge Bases v2 operations
  - name: orgs
    description: Organization operations
  - name: projects
    description: Project operations
  - name: runs
    description: Execution operations
  - name: templates
    description: Public project template catalog
  - name: users
    description: Authenticated user profile
paths:
  /orgs/{org_id}/k2/{kb_id}/files:
    get:
      tags:
        - k2
      description: List files and folders in a knowledge base directory.
      operationId: list
      parameters:
        - name: org_id
          in: path
          required: true
          schema:
            type: string
        - name: kb_id
          in: path
          required: true
          schema:
            type: string
        - name: page_token
          in: query
          description: Page token for pagination
          required: false
          schema:
            type:
              - string
              - 'null'
        - name: directory
          in: query
          description: >-
            Scope listing to the immediate contents of one folder, like a file
            browser:

            the files directly in it plus a folder entry per immediate subfolder
            (one

            level only). Use `"/"` for the KB root. Omit to get a flat dump of
            every

            file in the knowledge base at all depths. Otherwise a normalized
            path such

            as `docs/reports`.
          required: false
          schema:
            type:
              - string
              - 'null'
        - name: q
          in: query
          description: >-
            Case-insensitive substring filter on entry name. When set, results
            are a

            flat recursive search: `directory` scopes the search to that
            folder's

            subtree (omit or use `"/"` to search the whole knowledge base) and
            no

            folder entries are synthesized.
          required: false
          schema:
            type:
              - string
              - 'null'
      responses:
        '200':
          description: Files listed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListK2FilesResponse'
      security:
        - bearer_auth: []
components:
  schemas:
    ListK2FilesResponse:
      type: object
      required:
        - files
      properties:
        files:
          type: array
          items:
            $ref: '#/components/schemas/K2File'
        next_page_token:
          type:
            - string
            - 'null'
    K2File:
      type: object
      required:
        - id
        - uid
        - kb_id
        - name
        - content_type
        - content_length
        - metadata
        - parse_state
        - url
        - created_at
        - updated_at
      properties:
        content_length:
          type: integer
          format: int64
        content_type:
          type: string
        created_at:
          type: string
          format: date-time
        directory:
          type:
            - string
            - 'null'
        id:
          type: integer
          format: int64
        kb_id:
          type: integer
          format: int64
        metadata: {}
        name:
          type: string
        parse_state:
          type: string
          description: >-
            Pipeline state for parsing + embedding.


            One of `pending` (pipeline in flight), `success` (parse + embed both
            completed),

            `failed` (latest attempt failed), or `skipped` (format unsupported,
            never parsed).

            Unsupported files are stored as-is; the indicator lets clients flag
            them in listings

            rather than rejecting the upload.
        signed_url:
          type:
            - string
            - 'null'
          description: >-
            CloudFront signed URL on the new CDN for private content. Omitted
            when

            signing is unavailable or the object is public.
        uid:
          type: string
        updated_at:
          type: string
          format: date-time
        url:
          type: string
          description: >-
            **Deprecated:** prefer `signed_url` when present. Kept for old
            clients.
          deprecated: true
  securitySchemes:
    bearer_auth:
      type: http
      scheme: bearer
      description: >-
        Timbal API key. Obtain your API key from the Timbal platform settings.
        See [Authentication](/api-reference/authentication) for more
        information.

````