> ## 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.

# Delete Knowledge Base

> Delete one knowledge base from your DialNexa workspace.

Destructive
Delete a knowledge base from your workspace. DialNexa blocks the request while the knowledge base is still attached to the current draft or latest published version of any agent, and while a document upload for it is still being indexed.

## When to use this

* **Retiring content**: remove a knowledge base whose content is obsolete so agents stop answering from it.
* **Multi-tenant offboarding**: delete a per-customer knowledge base when that customer leaves.

## Delete conflict responses

Before deleting, check which agents reference the knowledge base and update their `knowledge_base_ids` via [Update Agent](https://dialnexa.com/docs/api-reference/v1/agents/update.md) if they should switch to a replacement. If any agent still uses the knowledge base, the API returns `409 Conflict` with `data.code` `KNOWLEDGE_BASE_IN_USE` and the affected agents in `data.agent_ids`. A `409 Conflict` with `data.code` `KNOWLEDGE_BASE_INDEXING` means a document is still being indexed; `data.knowledge_base_ids` names the knowledge base, so retry once it finishes. A `404 Not Found` means the knowledge base does not exist in this workspace, which is also what you get for one that belongs to another workspace. See [API errors](https://dialnexa.com/docs/api-reference/api-fundamentals.md#handle-dialnexa-api-errors) for the standard error format.


## OpenAPI

````yaml DELETE /v1/knowledge-base/{id}
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/knowledge-base/{id}:
    delete:
      tags:
        - Knowledge Base
      summary: Delete Knowledge Base
      description: >-
        Deletes a knowledge base. The request is blocked while an agent still
        uses it.
      operationId: deleteKnowledgeBase
      parameters:
        - name: id
          required: true
          in: path
          description: Knowledge base ID
          schema:
            example: kb_abc123
            type: string
      responses:
        '200':
          description: Knowledge base deleted successfully.
          content:
            application/json:
              examples:
                success:
                  summary: Successful response
                  value:
                    success: true
                    error: false
                    statusCode: 200
                    message: Success
                    timestamp: '2026-09-07T06:00:00.000Z'
              schema:
                type: object
                required:
                  - success
                  - error
                  - statusCode
                  - message
                  - timestamp
                description: The standard envelope without a data member.
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  error:
                    type: boolean
                    enum:
                      - false
                  statusCode:
                    type: integer
                    example: 200
                  message:
                    type: string
                    example: Success
                  timestamp:
                    type: string
                    format: date-time
        '401':
          description: Unauthorized - missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: 401 Unauthorized
                  value:
                    statusCode: 401
                    error: true
                    success: false
                    data: []
                    message: Invalid API key
                    errors: []
        '404':
          description: Knowledge base not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: 404 Not Found
                  value:
                    statusCode: 404
                    error: true
                    success: false
                    data: []
                    message: Knowledge base with ID Qm4TzR8wLp2VxN not found
                    errors: []
        '409':
          description: >-
            Conflict. data.code KNOWLEDGE_BASE_IN_USE: agents still use the
            knowledge base and data.agent_ids lists them. data.code
            KNOWLEDGE_BASE_INDEXING: a document is still being indexed and
            data.knowledge_base_ids names the knowledge base; retry once it
            finishes.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                knowledgeBaseInUse:
                  summary: 409 Conflict
                  value:
                    statusCode: 409
                    error: true
                    success: false
                    data:
                      code: KNOWLEDGE_BASE_IN_USE
                      agent_ids:
                        - agent_2g7Xy3tY53gRlp
                    message: >-
                      This knowledge base cannot be deleted because it is being
                      used by 1 agent(s): agent_2g7Xy3tY53gRlp. Please unlink it
                      from these agents before deleting.
                    errors: []
                knowledgeBaseIndexing:
                  summary: Document still indexing
                  value:
                    statusCode: 409
                    error: true
                    success: false
                    data:
                      code: KNOWLEDGE_BASE_INDEXING
                      knowledge_base_ids:
                        - kb_Qm4TzR8wLp2VxN
                    message: >-
                      This knowledge base is indexing a document. Try again in a
                      few minutes.
                    errors: []
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: 500 Internal Server Error
                  value:
                    statusCode: 500
                    error: true
                    success: false
                    data: []
                    message: Internal server error
                    errors: []
      security:
        - bearer: []
components:
  schemas:
    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.