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

# List files in a knowledge base

> Retrieve all files associated with a knowledge base, including their processing status.

Use this to monitor file processing progress or display file lists in your UI.




## OpenAPI

````yaml /openapi.yaml get /kb/files
openapi: 3.1.0
info:
  title: AsterAgents API
  version: 1.0.0
  description: >
    API for AsterAgents platform operations.


    - **Admin endpoints** (`/admin/*`) require organization admin privileges
    (`org:admin` role)

    - **Agent endpoints** (`/agents`) require agent management permissions or
    `org:admin` role

    - **Knowledge base endpoints** (`/kb/*`) require standard authentication

    - **Skills endpoints** (`/skills/*`) require standard authentication

    - **File endpoints** (`/upload/*`, `/kb/files`, `/skills/files`) require
    standard authentication
  contact:
    name: AsterAgents Support
    url: https://asteragents.com/support
servers:
  - url: https://asteragents.com/api
    description: Production
  - url: http://localhost:3000/api
    description: Local development
security:
  - bearerAuth: []
tags:
  - name: Users
    description: Manage active organization users
  - name: Invitations
    description: Manage organization invitations
  - name: Files
    description: Upload and manage files
  - name: Knowledge Bases
    description: Manage knowledge bases and their files
  - name: Knowledge Base Management
    description: Create, update, and delete knowledge bases
  - name: Agents
    description: Create, update, and delete agents
  - name: Agent Tags
    description: Organize agents with tags
  - name: Tools
    description: Discover the tool catalog available to your organization
  - name: Skills
    description: Manage agent skills
  - name: Skill Files
    description: Manage bundled files for skills
  - name: Conversations
    description: Invoke agents and retrieve conversation history and messages
  - name: Scheduled Tasks
    description: Schedule agents to run automatically on a cron schedule
paths:
  /kb/files:
    get:
      tags:
        - Knowledge Bases
      summary: List files in a knowledge base
      description: >
        Retrieve all files associated with a knowledge base, including their
        processing status.


        Use this to monitor file processing progress or display file lists in
        your UI.
      operationId: listKnowledgeBaseFiles
      parameters:
        - name: kbId
          in: query
          required: true
          description: The ID of the knowledge base
          schema:
            type: integer
            example: 123
      responses:
        '200':
          description: Successfully retrieved files
          content:
            application/json:
              schema:
                type: object
                required:
                  - success
                  - files
                properties:
                  success:
                    type: boolean
                  files:
                    type: array
                    items:
                      $ref: '#/components/schemas/KnowledgeBaseFile'
        '400':
          description: Bad request - invalid or missing kbId
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: Valid knowledge base ID is required
        '404':
          description: Knowledge base not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: Knowledge base not found
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    KnowledgeBaseFile:
      type: object
      required:
        - id
        - knowledgeBaseId
        - fileId
        - fileName
        - fileKey
        - contentKey
        - contentType
        - processingStatus
        - createdAt
        - updatedAt
      properties:
        id:
          type: integer
          description: Database record ID
          example: 456
        knowledgeBaseId:
          type: integer
          description: ID of the parent knowledge base
          example: 123
        fileId:
          type: string
          format: uuid
          description: Unique file identifier (UUID)
          example: 550e8400-e29b-41d4-a716-446655440000
        fileName:
          type: string
          description: Original filename
          example: quarterly-report.pdf
        fileKey:
          type: string
          description: Storage path for the original file
          example: >-
            org_xxx/uploads/550e8400-e29b-41d4-a716-446655440000/quarterly-report.pdf
        contentKey:
          type: string
          description: Storage path for extracted text content
          example: org_xxx/contents/550e8400-e29b-41d4-a716-446655440000.md
        contentType:
          type: string
          description: MIME type
          example: application/pdf
        fileSize:
          type: integer
          nullable: true
          description: File size in bytes
          example: 1048576
        processingStatus:
          type: string
          description: Current processing status
          enum:
            - parsing
            - parsed
            - chunking
            - chunk_failed
            - parse_failed
            - extract_failed
            - completed
          example: completed
        processingError:
          type: string
          nullable: true
          description: Error message if processing failed
          example: null
        imageKeys:
          type: array
          nullable: true
          description: Storage paths for generated page images (PDFs only)
          items:
            type: string
          example:
            - org_xxx/images/file-uuid/page-1.png
            - org_xxx/images/file-uuid/page-2.png
        userMetadata:
          type: object
          nullable: true
          description: Custom user-defined metadata
          additionalProperties: true
        extractedData:
          type: object
          nullable: true
          description: >-
            Structured data extracted from the file (if extraction schema is
            configured)
          additionalProperties: true
        createdAt:
          type: string
          format: date-time
          description: When the file was associated
          example: '2024-01-15T10:30:00.000Z'
        updatedAt:
          type: string
          format: date-time
          description: When the file was last updated
          example: '2024-01-15T10:35:00.000Z'
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          example: Bad Request
        details:
          type: array
          items:
            type: object
            additionalProperties: true
  responses:
    InternalServerError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Internal Server Error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: |
        JWT token from Clerk authentication.

        Must be from a user with `org:admin` role.

````