curl --request PUT \
--url https://api.example.com/v1/knowledge-documents/{knowledgeDocumentId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"content": "<string>",
"name": "<string>",
"summary": "<string>"
}
'import requests
url = "https://api.example.com/v1/knowledge-documents/{knowledgeDocumentId}"
payload = {
"content": "<string>",
"name": "<string>",
"summary": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({content: '<string>', name: '<string>', summary: '<string>'})
};
fetch('https://api.example.com/v1/knowledge-documents/{knowledgeDocumentId}', 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.example.com/v1/knowledge-documents/{knowledgeDocumentId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'content' => '<string>',
'name' => '<string>',
'summary' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.example.com/v1/knowledge-documents/{knowledgeDocumentId}"
payload := strings.NewReader("{\n \"content\": \"<string>\",\n \"name\": \"<string>\",\n \"summary\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.example.com/v1/knowledge-documents/{knowledgeDocumentId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"content\": \"<string>\",\n \"name\": \"<string>\",\n \"summary\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/knowledge-documents/{knowledgeDocumentId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"content\": \"<string>\",\n \"name\": \"<string>\",\n \"summary\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"contentType": "<string>",
"createdAt": "<string>",
"createdById": "<string>",
"failureReason": "upload_expired",
"fileName": "<string>",
"fileSize": 123,
"id": "<string>",
"knowledgeFolderId": "<string>",
"name": "<string>",
"nbCitations": 123,
"pageId": "<string>",
"reviewStatus": "to_validate",
"status": "pending",
"summary": "<string>",
"type": "text",
"updatedAt": "<string>",
"updatedById": "<string>",
"url": "<string>",
"validatedAt": "<string>",
"validatedById": "<string>",
"workspace": {
"id": "<string>",
"name": "<string>",
"websiteUrl": "<string>"
},
"content": "<string>"
}Update a knowledge document
Updates the name, summary or text content of a knowledge document. Omitted fields keep their value. Any update re-indexes the document, which goes back to pending until indexing ends. content is only accepted on text documents. A document that is pending or failed cannot be updated and answers 409.
curl --request PUT \
--url https://api.example.com/v1/knowledge-documents/{knowledgeDocumentId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"content": "<string>",
"name": "<string>",
"summary": "<string>"
}
'import requests
url = "https://api.example.com/v1/knowledge-documents/{knowledgeDocumentId}"
payload = {
"content": "<string>",
"name": "<string>",
"summary": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({content: '<string>', name: '<string>', summary: '<string>'})
};
fetch('https://api.example.com/v1/knowledge-documents/{knowledgeDocumentId}', 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.example.com/v1/knowledge-documents/{knowledgeDocumentId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'content' => '<string>',
'name' => '<string>',
'summary' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.example.com/v1/knowledge-documents/{knowledgeDocumentId}"
payload := strings.NewReader("{\n \"content\": \"<string>\",\n \"name\": \"<string>\",\n \"summary\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.example.com/v1/knowledge-documents/{knowledgeDocumentId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"content\": \"<string>\",\n \"name\": \"<string>\",\n \"summary\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/knowledge-documents/{knowledgeDocumentId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"content\": \"<string>\",\n \"name\": \"<string>\",\n \"summary\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"contentType": "<string>",
"createdAt": "<string>",
"createdById": "<string>",
"failureReason": "upload_expired",
"fileName": "<string>",
"fileSize": 123,
"id": "<string>",
"knowledgeFolderId": "<string>",
"name": "<string>",
"nbCitations": 123,
"pageId": "<string>",
"reviewStatus": "to_validate",
"status": "pending",
"summary": "<string>",
"type": "text",
"updatedAt": "<string>",
"updatedById": "<string>",
"url": "<string>",
"validatedAt": "<string>",
"validatedById": "<string>",
"workspace": {
"id": "<string>",
"name": "<string>",
"websiteUrl": "<string>"
},
"content": "<string>"
}Authorizations
API key starting with sk_. Generate one in Settings > API Keys.
Path Parameters
Knowledge document ID.
Body
Response
Default Response
MIME type of the uploaded file. Null when the document has no file.
ISO 8601 creation date.
ID of the user who created the document.
Why processing failed. Null unless the status is failed.
upload_expired, unsupported_type, encrypted, page_too_large, too_large, optimization_timeout, processing_error, kb_failed Original file name. Null when the document has no file.
File size in bytes. Null when the document has no file.
Unique identifier of the knowledge document.
Knowledge folder holding the document. Null for the General folder and for page documents.
Name of the document.
Number of times AI content cited this document. Null for a document created before citations were counted and never cited since.
Page the document is attached to. Null for workspace documents.
to_validate when the document is 18 months old or more and was not validated in the last 3 months, up_to_date otherwise. Null until processing has succeeded.
to_validate, up_to_date Processing status.
pending, success, failed Summary of the document content.
Document type.
text, url, file ISO 8601 date of the last update.
ID of the user who last updated the document.
Source URL of a url document. Known on the single-document routes only, null elsewhere.
ISO 8601 date of the last validation.
ID of the user who last validated the document.
Workspace this knowledge document belongs to.
Show child attributes
Show child attributes
Indexed text of the document. Null until processing has succeeded.
Was this page helpful?