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

# List knowledge documents

> Paginated knowledge-base metadata (requires knowledge:read scope).

Requires scope **`knowledge:read`**.

This API returns **metadata only** — not file bytes and not a public download URL.

Use each document’s `fileId` in inbound agent create/PATCH: `selectedKnowledgebases: ["fileId", …]`. See [Create inbound agent](/api-reference/endpoint/inbound-agents/create-inbound-agent).

Query params: `page`, `limit` (max 100), optional `search`.


## OpenAPI

````yaml openapi.json GET /api/v1/knowledge-bases/documents
openapi: 3.0.3
info:
  title: Ondial Public API
  version: 1.0.0
  description: >-
    Tenant API-key surface for lead ingest, contacts (including dial
    conversation + analysis), events, inbound agents, company profiles, and
    knowledge-base documents.


    **Campaign definition is UI-only** — create and start an API-ingest campaign
    in the dashboard, then push leads here.


    **Auth:** `Authorization: Bearer ond_live_…` or `ond_test_…` (or
    `X-API-Key`). Keys are requested in **API Access** with a friendly **key
    name**, then approved by Super Admin (not self-serve). Tenants can rename
    keys later without rotating the secret.


    **Scopes:** Company and knowledge-base routes require opt-in scopes
    (`companies:read`, `companies:write`, `knowledge:read`, `knowledge:write`)
    granted at key approval. Missing scope → `403 forbidden`.


    **Sandbox** keys never place PSTN dials or live WhatsApp/email and do not
    burn credits (KB upload skips debit).


    **Security:** Company responses never include SMTP/WhatsApp credentials. KB
    v1 is metadata-only — no file download.


    **Kill switch:** Super Admin can disable all `/api/v1/*` (`503` /
    `api_globally_disabled`) without stopping UI CSV campaigns.


    **Compliance:** Call channel requires `consent.outboundCall: true` and phone
    not on tenant/platform DNC.
servers:
  - url: https://dashboard.ondial.ai
    description: Production
  - url: http://localhost:3001
    description: Local
security:
  - BearerAuth: []
tags:
  - name: Core
    description: Auth check and lead ingest
  - name: Contacts
    description: Status, dials/conversation/analysis, cancel, delete, follow-ups, list
  - name: Events
    description: ERP event bus slice — eventType → campaign
  - name: Outbound
    description: >-
      Read-only campaign lookup for API / Custom CRM. Create and start campaigns
      in the dashboard.
  - name: Inbound agents
    description: Configure inbound agents; list/buy pool numbers; read credits
  - name: Companies
    description: >-
      Company profile CRUD (requires companies:read / companies:write scopes).
      Never returns SMTP or WhatsApp credentials.
  - name: Knowledge bases
    description: >-
      Knowledge document upload/list/delete (requires knowledge:read /
      knowledge:write scopes). Metadata only — no file download via API.
paths:
  /api/v1/knowledge-bases/documents:
    get:
      tags:
        - Knowledge bases
      summary: List knowledge documents
      description: >-
        Paginated metadata list. Requires scope `knowledge:read`. Does not
        return file bytes or download URLs.
      operationId: listKnowledgeDocuments
      parameters:
        - name: page
          in: query
          schema:
            type: integer
            default: 1
        - name: limit
          in: query
          schema:
            type: integer
            default: 20
            maximum: 100
        - name: search
          in: query
          schema:
            type: string
      responses:
        '200':
          description: Document list
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KnowledgeDocumentListResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          description: Missing knowledge:read scope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
components:
  schemas:
    KnowledgeDocumentListResponse:
      type: object
      properties:
        documents:
          type: array
          items:
            $ref: '#/components/schemas/KnowledgeDocument'
        pagination:
          type: object
          properties:
            page:
              type: integer
            limit:
              type: integer
            total:
              type: integer
            totalPages:
              type: integer
            hasNext:
              type: boolean
            hasPrev:
              type: boolean
    ErrorBody:
      type: object
      properties:
        error:
          type: string
        reasonCode:
          type: string
        missing:
          type: array
          items:
            type: string
    KnowledgeDocument:
      type: object
      properties:
        fileId:
          type: string
        knowledgebaseId:
          type: string
          nullable: true
        fileName:
          type: string
          nullable: true
        title:
          type: string
          nullable: true
        wordCount:
          type: integer
        uploadDate:
          type: string
          format: date-time
          nullable: true
        fileType:
          type: string
          enum:
            - pdf
            - word
            - excel
            - text
      description: Metadata only. No download URL or file bytes.
  responses:
    Unauthorized:
      description: Missing, invalid, or inactive API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBody'
          example:
            error: Invalid or inactive API key
            reasonCode: unauthorized
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: ond_live | ond_test
      description: >-
        Paste only your API key (`ond_live_…` or `ond_test_…`). Do not type the
        word Bearer — the playground adds it.

````