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

> Delete a document from a knowledge base

# Delete Knowledge Document



## OpenAPI

````yaml delete /v1/knowledge/{knowledge_id}/document/{document_id}
openapi: 3.1.0
info:
  title: spectra-server
  description: The API for Spectra Backend.
  version: 0.1.0
servers:
  - url: https://api-spectra.duplik.cn
security: []
paths:
  /v1/knowledge/{knowledge_id}/document/{document_id}:
    delete:
      tags:
        - Knowledge
      summary: Delete Knowledge Document
      description: >-
        Delete a document from a knowledge base. The document and the file
        behind it are soft deleted (status set to 0) and a background task takes
        the derived chunks out of retrieval, so a 200 means the request was
        accepted rather than fully applied — allow a few seconds before the
        content stops being returned by search.


        Status changes on one document are serialised through a lock. If the
        lock cannot be taken within roughly 30 seconds the call still returns
        200 without having deleted anything, so re-issue it if a later read
        still shows the document.


        The document must belong to the knowledge base in the path, otherwise
        the call fails.
      operationId: >-
        delete_knowledge_document_v1_knowledge__knowledge_id__document__document_id__delete
      parameters:
        - name: knowledge_id
          in: path
          required: true
          schema:
            type: string
            title: Knowledge Id
            description: Knowledge base ID
          description: Knowledge base ID
        - name: document_id
          in: path
          required: true
          schema:
            type: string
            title: Document Id
            description: ID of the document to delete
          description: ID of the document to delete
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StatusMessage'
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Bad Request
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unprocessable Entity
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
      security:
        - HTTPBearer: []
components:
  schemas:
    StatusMessage:
      properties:
        status:
          type: boolean
          title: Status
          default: true
        message:
          type: string
          title: Message
          default: success
      type: object
      title: StatusMessage
    ErrorResponse:
      properties:
        code:
          type: integer
          title: Code
        message:
          type: string
          title: Message
      type: object
      required:
        - code
        - message
      title: ErrorResponse
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````