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

<span data-api-safety-label="destructive"><Badge color="red" size="sm" shape="pill">Destructive</Badge></span>
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.

## 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](/docs/api-reference/v1/agents/update) if they should switch to a replacement. If any agent still uses the knowledge base, the API returns `409 Conflict` with the affected `agent_ids`. A `404 Not Found` means the knowledge base does not exist in this workspace. See [Errors](/docs/api-reference/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: Transcribers
  - name: Webhooks
  - name: Voices
  - name: Workflows
  - name: Workflow Leads
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
          schema:
            type: string
      responses:
        '200':
          description: Knowledge base deleted successfully.
          content:
            application/json:
              examples:
                success:
                  summary: Successful response
                  value:
                    success: true
                    message: Knowledge base deleted successfully
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Knowledge base deleted successfully
        '401':
          description: Unauthorized - missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: 401 Unauthorized
                  value:
                    statusCode: 401
                    message: API key is missing or invalid
                    error: Unauthorized
        '403':
          description: Forbidden - knowledge base does not belong to your organization.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: 403 Forbidden
                  value:
                    statusCode: 403
                    message: You do not have permission to access this resource
                    error: Forbidden
        '404':
          description: Knowledge base not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: 404 Not Found
                  value:
                    statusCode: 404
                    message: Knowledge base not found
                    error: Not Found
        '409':
          description: Knowledge base is still used by one or more agents.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/ErrorResponse'
                properties:
                  agent_ids:
                    type: array
                    items:
                      type: string
                    example:
                      - agent_2g7Xy3tY53gRlp
              examples:
                knowledgeBaseInUse:
                  summary: 409 Conflict
                  value:
                    statusCode: 409
                    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.
                    agent_ids:
                      - agent_2g7Xy3tY53gRlp
                    error: Conflict
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: 500 Internal Server Error
                  value:
                    statusCode: 500
                    message: Internal server error
                    error: Internal Server Error
      security:
        - bearer: []
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        statusCode:
          type: integer
          example: 400
        message:
          oneOf:
            - type: string
            - type: array
              items:
                type: string
          example: phone_number must be a valid E.164 phone number
        error:
          type: string
          example: Bad Request
      required:
        - statusCode
        - message
        - error
  securitySchemes:
    bearer:
      scheme: bearer
      type: http

````