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

# List Knowledge Base Documents

> List knowledge base documents to verify an upload or inspect the non-deleted files in a knowledge base.

Read only

List knowledge base documents to verify an upload or inspect the non-deleted files in a knowledge base. Results are paginated. Each document carries its `id`, `title`, `knowledge_base_id`, `description`, `source`, `document_type`, `file_size`, `file_path`, the full extracted text in `content`, and its indexing state in `ingest_status`, `ingest_error`, `ingest_updated_at` and `ingest_job_id`. Document IDs and `knowledge_base_id` are raw, without a prefix.

## Before you begin

* Use a knowledge base ID from [List Knowledge Bases](https://dialnexa.com/docs/api-reference/v1/knowledge-base/list.md).
* Send a valid workspace API key.

## List Knowledge Base Documents Request

```http theme={null}
GET /v1/documents?knowledge_base_id=kb_abc123&page=1&limit=10
```

## Query parameters

| Parameter | Description |
| - | - |
| `knowledge_base_id` | Required. Knowledge base ID, with or without the `kb_` prefix. Missing returns `400`. |
| `page` | Page number. Default: `1`. |
| `limit` | Documents per page. Default: `10`. Each document includes its full text, so keep pages small. |
| `sortBy` | Document field to sort by. Default: `id`. |
| `sortOrder` | Sort direction: `ASC` or `DESC`, in any case. Default: `ASC`. Any other value fails with `500`. |

## Verify the result

Read `data.items` and `data.meta` in the `200` response. Pagination metadata includes `totalItems`, `itemsPerPage`, `totalPages`, and `currentPage`. Match an uploaded document by ID and title. `file_size` is in KB, with 1024 bytes per KB.

## Errors and recovery

`401` means the API key is missing or invalid. `400` means `knowledge_base_id` is missing, or `page` or `limit` is a decimal. `404` means the knowledge base ID does not exist in your workspace or the knowledge base has been deleted. Because document listings carry the full text of every file, DialNexa does not confirm that a knowledge base belongs to another workspace, so a valid ID you do not own returns the same `404` as one that was never created. Check the ID against [List Knowledge Bases](https://dialnexa.com/docs/api-reference/v1/knowledge-base/list.md). Send `page` and `limit` as whole numbers of at least `1`: a value that is not a number is ignored and the default is used, a decimal returns `400`, `limit=0` returns an empty page, and `page=0` fails with `500`. Use a valid document field for `sortBy`; an unknown field also fails with `500`. `sortOrder` accepts `ASC` or `DESC` in any case; any other value fails with `500`. This read is safe to retry.

## Related endpoints

* [Upload Knowledge Base Document](https://dialnexa.com/docs/api-reference/v1/knowledge-base/upload-document.md)
* [Manage documents in the dashboard](https://dialnexa.com/docs/knowledge-base/managing-documents.md)


## OpenAPI

````yaml GET /v1/documents
openapi: 3.0.0
info:
  title: DialNexa API
  description: Public `/v1` REST API for the DialNexa voice AI platform.
  version: 1.0.0
servers:
  - url: https://api.dialnexa.com
    description: DialNexa production API
security:
  - bearer: []
tags:
  - name: Agents
  - name: Batch Calls
  - name: Calls
  - name: Knowledge Base
  - name: Languages
  - name: LLMs
  - name: Phone Numbers
  - name: Organization Folders
  - name: Transcribers
  - name: Webhooks
  - name: Voices
  - name: Workflows
  - name: Workflow Leads
  - name: Authentication
  - name: Agent Builder
  - name: Agent Evaluations
paths:
  /v1/documents:
    get:
      tags:
        - Knowledge Base
      summary: List Knowledge Base Documents
      description: >-
        Lists non-deleted documents for the supplied knowledge base with
        pagination metadata.
      operationId: listKnowledgeBaseDocuments
      parameters:
        - name: knowledge_base_id
          in: query
          required: true
          schema:
            type: string
            example: kb_abc123def45678
          description: Knowledge base ID.
        - name: page
          in: query
          required: false
          schema:
            type: integer
            default: 1
          description: Page number.
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            default: 10
          description: Documents per page.
        - name: sortBy
          in: query
          required: false
          schema:
            type: string
            default: id
          description: Document field to sort by.
        - name: sortOrder
          required: false
          in: query
          description: >-
            Sort direction: ASC or DESC, in any case. Default ASC. Any other
            value fails with 500.
          schema:
            type: string
            default: ASC
      responses:
        '200':
          description: Successful response.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  error:
                    type: boolean
                  statusCode:
                    type: integer
                  message:
                    type: string
                  data:
                    type: object
                    properties:
                      items:
                        type: array
                        items:
                          $ref: '#/components/schemas/KnowledgeBaseDocument'
                      meta:
                        type: object
                        properties:
                          totalItems:
                            type: integer
                          itemsPerPage:
                            type: integer
                          totalPages:
                            type: integer
                          currentPage:
                            type: integer
                    required:
                      - items
                      - meta
                  timestamp:
                    type: string
                    format: date-time
                required:
                  - success
                  - error
                  - statusCode
                  - message
                  - data
                  - timestamp
              examples:
                success:
                  value:
                    success: true
                    error: false
                    statusCode: 200
                    message: Success
                    data:
                      items:
                        - id: Dk4mP8vQ2nLz7x
                          title: Support FAQ
                          knowledge_base_id: abc123def45678
                          description: ''
                          content: >-
                            How do I reset my password? Open Settings and choose
                            Reset password.
                          source: ''
                          document_type: txt
                          file_size: 0.0664
                          file_path: >-
                            knowledge-documents/abc123def45678/Support_FAQ-Dk4mP8vQ2nLz7x.txt
                          is_deleted: false
                          ingest_status: processing
                          ingest_error: null
                          ingest_updated_at: '2026-07-03T10:30:00.000Z'
                          ingest_job_id: 3f6c2a9e-8b1d-4e7a-9c5f-2d8e1b7a4c63
                      meta:
                        totalItems: 1
                        itemsPerPage: 10
                        totalPages: 1
                        currentPage: 1
                    timestamp: '2026-09-07T06:00:00.000Z'
        '400':
          description: knowledge_base_id is missing, or page or limit is a decimal.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: Missing knowledge_base_id
                  value:
                    statusCode: 400
                    error: true
                    success: false
                    data: []
                    message: knowledge_base_id is required
                    errors:
                      - knowledge_base_id is required
                decimal:
                  summary: Decimal page
                  value:
                    statusCode: 400
                    error: true
                    success: false
                    data: []
                    message: Validation failed (numeric string is expected)
                    errors:
                      - Validation failed (numeric string is expected)
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  value:
                    statusCode: 401
                    error: true
                    success: false
                    data: []
                    message: Invalid API key
                    errors: []
        '404':
          description: Knowledge base not found in this workspace, or it has been deleted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  value:
                    statusCode: 404
                    error: true
                    success: false
                    data: []
                    message: >-
                      Error fetching documents: Knowledge base with ID
                      Qm4TzR8wLp2VxN not found
                    errors: []
        '500':
          description: An unknown sortBy field, or page 0.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: Unknown sortBy
                  value:
                    statusCode: 500
                    error: true
                    success: false
                    data: []
                    message: >-
                      Error fetching documents: column KnowledgeDocument.bogus
                      does not exist
                    errors: []
      security:
        - bearer: []
components:
  schemas:
    KnowledgeBaseDocument:
      type: object
      properties:
        id:
          type: string
          description: Document ID (raw, no prefix).
        title:
          type: string
        knowledge_base_id:
          type: string
          description: Knowledge base ID without the kb_ prefix.
        description:
          type: string
        content:
          type: string
          description: Full text extracted from the file.
        source:
          type: string
        document_type:
          type: string
        file_path:
          type: string
          description: Storage path of the uploaded file.
        file_size:
          type: number
          description: File size in KB (1024 bytes).
        is_deleted:
          type: boolean
        ingest_status:
          type: string
          enum:
            - processing
            - ready
            - failed
          description: >-
            Indexing state: processing until indexing finishes, then ready. A
            document whose indexing fails is marked failed with ingest_error set
            and deleted at the same time, so it leaves the document list and can
            be uploaded again under the same title.
        ingest_error:
          type: string
          nullable: true
        ingest_updated_at:
          type: string
          format: date-time
          nullable: true
        ingest_job_id:
          type: string
          nullable: true
          description: Identifier of the current indexing attempt.
    ErrorResponse:
      type: object
      description: Error body on endpoints without response filtering.
      properties:
        statusCode:
          type: integer
          example: 404
        error:
          type: boolean
          enum:
            - true
        success:
          type: boolean
          enum:
            - false
        data:
          oneOf:
            - type: object
              properties:
                code:
                  type: string
                  description: Machine-readable refusal code.
            - type: array
              items: {}
          description: >-
            For a coded refusal, an object with code and the details listed for
            that code. Otherwise an empty array.
        message:
          type: string
        errors:
          type: array
          items:
            type: string
          description: Validation messages for a 400. Empty for other errors.
        validation_errors:
          type: array
          description: >-
            Present when uploaded rows fail number validation (batch and
            workflow lead uploads): one group per distinct error.
          items:
            type: object
            properties:
              error:
                type: string
              rows:
                type: array
                items:
                  type: integer
                description: Row numbers with this error.
              phone_numbers:
                type: array
                items:
                  type: string
        invalid_row_count:
          type: integer
          description: 'Present with validation_errors: how many rows failed.'
      required:
        - statusCode
        - error
        - success
        - data
        - message
        - errors
  securitySchemes:
    bearer:
      scheme: bearer
      type: http

````

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