curl --request POST \
--url https://api-spectra.duplik.cn/v1/knowledge/{knowledge_id}/document/{document_id}/reupload \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file='@example-file' \
--form 'document_metadata=<string>' \
--form 'document_setting=<string>'import requests
url = "https://api-spectra.duplik.cn/v1/knowledge/{knowledge_id}/document/{document_id}/reupload"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"document_metadata": "<string>",
"document_setting": "<string>"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('document_metadata', '<string>');
form.append('document_setting', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api-spectra.duplik.cn/v1/knowledge/{knowledge_id}/document/{document_id}/reupload', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-spectra.duplik.cn/v1/knowledge/{knowledge_id}/document/{document_id}/reupload",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document_metadata\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document_setting\"\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-spectra.duplik.cn/v1/knowledge/{knowledge_id}/document/{document_id}/reupload"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document_metadata\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document_setting\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api-spectra.duplik.cn/v1/knowledge/{knowledge_id}/document/{document_id}/reupload")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document_metadata\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document_setting\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-spectra.duplik.cn/v1/knowledge/{knowledge_id}/document/{document_id}/reupload")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document_metadata\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document_setting\"\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"org_id": "<string>",
"user_id": "<string>",
"dataset_id": "<string>",
"file_id": "<string>",
"document_id": "<string>",
"created_at": 123,
"updated_at": 123,
"overall_summarize_enabled": true,
"smart_indexing_mode": 0,
"smart_indexing_enabled": true,
"split_media_enabled": true,
"pdf_parsing_mode": 2,
"pdf_parsing_element_types": [
1,
2
],
"read_pdf_pages": "<string>",
"audio_parsing_mode": 123,
"audio_chunk_mode": 1,
"name": "<string>",
"document_type": 1,
"next_step": true,
"llm": {},
"metadata_info": {},
"task_priority": 123,
"description": "",
"summary": "",
"step_status": 100,
"status": 1,
"process_status": 100,
"version": 2,
"splitter_type": 1,
"splitter": {},
"sections": [],
"content_text": "<string>",
"trim_text": true
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}Reupload Knowledge Document
Overwrite an existing document with a new file (seamless hot swap). A NEW document object is returned immediately — its document_id differs from the one in the path — and the background swap is atomic: the stable file_id is handed over to the new document and the old document_id is retired. Poll progress with the returned document_id. Metadata is carried over from the previous document by default (including the entity_names tags used for retrieval filtering); only the file information is replaced. Pass a field in document_metadata to change it.
curl --request POST \
--url https://api-spectra.duplik.cn/v1/knowledge/{knowledge_id}/document/{document_id}/reupload \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file='@example-file' \
--form 'document_metadata=<string>' \
--form 'document_setting=<string>'import requests
url = "https://api-spectra.duplik.cn/v1/knowledge/{knowledge_id}/document/{document_id}/reupload"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"document_metadata": "<string>",
"document_setting": "<string>"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('document_metadata', '<string>');
form.append('document_setting', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api-spectra.duplik.cn/v1/knowledge/{knowledge_id}/document/{document_id}/reupload', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-spectra.duplik.cn/v1/knowledge/{knowledge_id}/document/{document_id}/reupload",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document_metadata\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document_setting\"\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-spectra.duplik.cn/v1/knowledge/{knowledge_id}/document/{document_id}/reupload"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document_metadata\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document_setting\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api-spectra.duplik.cn/v1/knowledge/{knowledge_id}/document/{document_id}/reupload")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document_metadata\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document_setting\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-spectra.duplik.cn/v1/knowledge/{knowledge_id}/document/{document_id}/reupload")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document_metadata\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document_setting\"\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"org_id": "<string>",
"user_id": "<string>",
"dataset_id": "<string>",
"file_id": "<string>",
"document_id": "<string>",
"created_at": 123,
"updated_at": 123,
"overall_summarize_enabled": true,
"smart_indexing_mode": 0,
"smart_indexing_enabled": true,
"split_media_enabled": true,
"pdf_parsing_mode": 2,
"pdf_parsing_element_types": [
1,
2
],
"read_pdf_pages": "<string>",
"audio_parsing_mode": 123,
"audio_chunk_mode": 1,
"name": "<string>",
"document_type": 1,
"next_step": true,
"llm": {},
"metadata_info": {},
"task_priority": 123,
"description": "",
"summary": "",
"step_status": 100,
"status": 1,
"process_status": 100,
"version": 2,
"splitter_type": 1,
"splitter": {},
"sections": [],
"content_text": "<string>",
"trim_text": true
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The existing document to overwrite
Body
Extra document metadata as a JSON string. It is merged into the existing metadata_info rather than replacing it. Business fields such as title, entity_names, time_periods and custom_data are carried over from the previous document when omitted — the entity_names tags used for metadata pre-filtering survive a reupload, so you do not have to resend them. Passing a field overrides it; pass null to clear one. folder_id, folder_ids, url, source_url, file_path, file_size, file_name and file_type are filled in by the server from the new file and are ignored if supplied. Example: {"title":"SY500 Service Manual","entity_names":["model:SY500"]}
Processing settings as a JSON string. Omit it and the previous document's settings are reused in full — the knowledge base is not consulted. Supplying it overrides only the fields you pass and leaves the rest of the previous document's settings untouched, which is the opposite of the upload endpoints, where the field is all-or-nothing. Example: {"pdf_parsing_mode":2,"smart_indexing_enabled":false}
Response
Successful Response
2020Generate an overall summary. Boolean
Smart indexing mode. 0: disabled (recommended), 1: standard, 2: advanced
Enable smart indexing. Boolean. Takes effect only together with smart_indexing_mode 2 (advanced); leaving it false is recommended unless the corpus needs it, as it adds noticeable processing time and token cost
Generate media segments. Boolean
PDF parsing mode. 1: page, 2: section (recommended), 3: section v2
pdf parsing element list, eg: [1, 2]. 1: table, 2: image, 3: formula
read pdf pages, Example: '1,3,4' or '1,4-end' or 'all'
audio parsing mode, 1: transcript, 2: speaker diarization
256next step
task priority
512