curl --request GET \
--url https://api.example.com/knowledge_bases/{knowledge_base_id}/documents/{document_id}import requests
url = "https://api.example.com/knowledge_bases/{knowledge_base_id}/documents/{document_id}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/knowledge_bases/{knowledge_base_id}/documents/{document_id}', 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/knowledge_bases/{knowledge_base_id}/documents/{document_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/knowledge_bases/{knowledge_base_id}/documents/{document_id}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/knowledge_bases/{knowledge_base_id}/documents/{document_id}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/knowledge_bases/{knowledge_base_id}/documents/{document_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Fetch the original uploaded file of a document
Stream the raw uploaded file back for preview or download.
Mirrors GET /workspace/files: the body is piped chunk by chunk
from the blob store rather than read whole, so one large file
cannot exhaust the shared API process. Only media types that
cannot carry script are served inline; everything else is forced
to an attachment.
Args:
knowledge_base_id (str):
The parent knowledge base.
document_id (str):
The document whose original file should be fetched.
download (bool, defaults to False):
Force an attachment disposition.
token (str | None, optional):
Signed download token, accepted instead of X-User-ID.
x_user_id (str | None, optional):
The normal identity header.
service (KnowledgeBaseService):
Injected knowledge base service.
download_secret (str):
Injected app-wide signing secret.
Returns:
StreamingResponse:
The file bytes with content-type / length / disposition
headers derived from the upload-time record.
curl --request GET \
--url https://api.example.com/knowledge_bases/{knowledge_base_id}/documents/{document_id}import requests
url = "https://api.example.com/knowledge_bases/{knowledge_base_id}/documents/{document_id}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/knowledge_bases/{knowledge_base_id}/documents/{document_id}', 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/knowledge_bases/{knowledge_base_id}/documents/{document_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/knowledge_bases/{knowledge_base_id}/documents/{document_id}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/knowledge_bases/{knowledge_base_id}/documents/{document_id}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/knowledge_bases/{knowledge_base_id}/documents/{document_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Headers
Path Parameters
The knowledge base id.
The document id.
Query Parameters
Force a Content-Disposition attachment.
A token from POST .../documents/{document_id}/download_token, accepted in place of the X-User-ID header so a browser navigation can fetch the file directly.
Response
Successful Response