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

> 用新文件覆盖已有文档（无缝热替换）。立即返回一个新的文档对象（document_id 与路径中的不同），构建完成后后台原子切换：稳定的 file_id 交接给新文档，原 document_id 作废。请用返回的新 document_id 轮询进度。

# Reupload Knowledge Document



## OpenAPI

````yaml post /v1/knowledge/{knowledge_id}/document/{document_id}/reupload
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}/reupload:
    post:
      tags:
        - Knowledge
      summary: Reupload Knowledge Document
      description: >-
        Re-upload a new file to overwrite an existing document (seamless
        hot-swap). Returns a NEW document object whose document_id differs from
        the path document_id; track that new id for progress. The stable file_id
        is reassigned to the new document after the background atomic swap
        completes; the old document_id becomes DELETED.
      operationId: >-
        reupload_knowledge_document_v1_knowledge__knowledge_id__document__document_id__reupload_post
      parameters:
        - name: knowledge_id
          in: path
          required: true
          schema:
            type: string
            title: Knowledge Id
        - name: document_id
          in: path
          required: true
          schema:
            type: string
            title: Document Id
          description: The existing document to overwrite
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
                  title: File
              required:
                - file
              title: Body_reupload_knowledge_document
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Document'
        '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:
    Document:
      properties:
        created_at:
          type: integer
          title: Created At
        updated_at:
          type: integer
          title: Updated At
        org_id:
          type: string
          maxLength: 20
          title: Org Id
        user_id:
          type: string
          maxLength: 20
          title: User Id
        overall_summarize_enabled:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Overall Summarize Enabled
          description: 'generate overall summary, 1: enabled, 2: disabled'
          default: true
        smart_indexing_mode:
          anyOf:
            - type: integer
            - type: 'null'
          title: Smart Indexing Mode
          description: 'smart indexing mode, 0: disabled, 1: standard, 2: advanced'
          default: 0
        smart_indexing_enabled:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Smart Indexing Enabled
          description: 'generate intelligent indexing, 1: enabled, 2: disabled'
          default: true
        split_media_enabled:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Split Media Enabled
          description: 'generate media segments, 1: enabled, 2: disabled'
          default: true
        pdf_parsing_mode:
          anyOf:
            - type: integer
            - type: 'null'
          title: Pdf Parsing Mode
          description: 'pdf parsing mode, 1: page, 2: section'
          default: 2
        pdf_parsing_element_types:
          anyOf:
            - items:
                type: integer
              type: array
            - type: 'null'
          title: Pdf Parsing Element Types
          description: 'pdf parsing element list, eg: [1, 2]. 1: table, 2: image, 3: formula'
          default:
            - 1
            - 2
        read_pdf_pages:
          anyOf:
            - type: string
            - type: 'null'
          title: Read Pdf Pages
          description: 'read pdf pages, Example: ''1,3,4'' or ''1,4-end'' or ''all'''
        audio_parsing_mode:
          anyOf:
            - type: integer
            - type: 'null'
          title: Audio Parsing Mode
          description: 'audio parsing mode, 1: transcript, 2: speaker diarization'
        audio_chunk_mode:
          anyOf:
            - type: integer
            - type: 'null'
          title: Audio Chunk Mode
          default: 1
        dataset_id:
          type: string
          title: Dataset Id
        file_id:
          type: string
          title: File Id
        name:
          anyOf:
            - type: string
              maxLength: 256
            - type: 'null'
          title: Name
        document_type:
          anyOf:
            - type: integer
            - type: 'null'
          title: Document Type
          default: 1
        next_step:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Next Step
          description: next step
          default: true
        llm:
          anyOf:
            - type: object
            - type: 'null'
          title: Llm
          default: {}
        metadata_info:
          type: object
          title: Metadata Info
          default: {}
        task_priority:
          anyOf:
            - type: integer
            - type: 'null'
          title: Task Priority
          description: task priority
        description:
          anyOf:
            - type: string
              maxLength: 512
            - type: 'null'
          title: Description
          default: ''
        summary:
          anyOf:
            - type: string
            - type: 'null'
          title: Summary
          default: ''
        step_status:
          anyOf:
            - type: integer
            - type: 'null'
          title: Step Status
          default: 100
        status:
          anyOf:
            - type: integer
            - type: 'null'
          title: Status
          default: 1
        process_status:
          anyOf:
            - type: integer
            - type: 'null'
          title: Process Status
          default: 100
        version:
          anyOf:
            - type: integer
            - type: 'null'
          title: Version
          default: 2
        splitter_type:
          anyOf:
            - type: integer
            - type: 'null'
          title: Splitter Type
          default: 1
        splitter:
          type: object
          title: Splitter
          default: {}
        sections:
          items:
            type: object
          type: array
          title: Sections
          default: []
        content_text:
          anyOf:
            - type: string
            - type: 'null'
          title: Content Text
          description: ''
        trim_text:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Trim Text
          description: ''
          default: true
        document_id:
          type: string
          title: Document Id
      type: object
      required:
        - org_id
        - user_id
        - dataset_id
        - file_id
        - document_id
      title: Document
    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

````