curl -X GET "https://api.sayvy.ai/api/v1/knowledge-base/c5d1e2f3-4a5b-6c7d-8e9f-0123456789ab/download" \
-H "Authorization: Bearer <token>" \
--output product_manual.pdf
import requests
url = "https://api.sayvy.ai/api/v1/knowledge-base/c5d1e2f3-4a5b-6c7d-8e9f-0123456789ab/download"
headers = {
"Authorization": "Bearer <token>"
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
with open("downloaded_document.pdf", "wb") as f:
f.write(response.content)
print("Document downloaded successfully.")
else:
print(response.status_code, response.json())
const response = await fetch(
"https://api.sayvy.ai/api/v1/knowledge-base/c5d1e2f3-4a5b-6c7d-8e9f-0123456789ab/download",
{
method: "GET",
headers: {
"Authorization": "Bearer <token>"
}
}
);
const blob = await response.blob();
const downloadUrl = window.URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = downloadUrl;
a.download = "downloaded_document.pdf";
document.body.appendChild(a);
a.click();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.sayvy.ai/api/v1/knowledge-base/c5d1e2f3-4a5b-6c7d-8e9f-0123456789ab/download"))
.header("Authorization", "Bearer <token>")
.GET()
.build();
HttpResponse<Path> response =
HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofFile(Paths.get("downloaded_document.pdf"))
);
System.out.println("Saved document to " + response.body());
HTTP/1.1 200 OK
Content-Type: application/pdf
Content-Disposition: attachment; filename="product_manual.pdf"
Content-Length: 1048576
<binary document stream>
{
"detail": "Unauthorized"
}
{
"detail": "Document not found."
}
Knowledge Base
Download document
Download raw document file content from secure object storage
GET
/
api
/
v1
/
knowledge-base
/
{document_id}
/
download
curl -X GET "https://api.sayvy.ai/api/v1/knowledge-base/c5d1e2f3-4a5b-6c7d-8e9f-0123456789ab/download" \
-H "Authorization: Bearer <token>" \
--output product_manual.pdf
import requests
url = "https://api.sayvy.ai/api/v1/knowledge-base/c5d1e2f3-4a5b-6c7d-8e9f-0123456789ab/download"
headers = {
"Authorization": "Bearer <token>"
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
with open("downloaded_document.pdf", "wb") as f:
f.write(response.content)
print("Document downloaded successfully.")
else:
print(response.status_code, response.json())
const response = await fetch(
"https://api.sayvy.ai/api/v1/knowledge-base/c5d1e2f3-4a5b-6c7d-8e9f-0123456789ab/download",
{
method: "GET",
headers: {
"Authorization": "Bearer <token>"
}
}
);
const blob = await response.blob();
const downloadUrl = window.URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = downloadUrl;
a.download = "downloaded_document.pdf";
document.body.appendChild(a);
a.click();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.sayvy.ai/api/v1/knowledge-base/c5d1e2f3-4a5b-6c7d-8e9f-0123456789ab/download"))
.header("Authorization", "Bearer <token>")
.GET()
.build();
HttpResponse<Path> response =
HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofFile(Paths.get("downloaded_document.pdf"))
);
System.out.println("Saved document to " + response.body());
HTTP/1.1 200 OK
Content-Type: application/pdf
Content-Disposition: attachment; filename="product_manual.pdf"
Content-Length: 1048576
<binary document stream>
{
"detail": "Unauthorized"
}
{
"detail": "Document not found."
}
Retrieve and stream the raw document file directly from encrypted Cloudflare R2 / AWS S3 object storage by its document UUID.
Authentication
This endpoint requires Bearer token authentication.Authorization: Bearer <token>
| Header | Type | Required | Description | Format |
|---|---|---|---|---|
Authorization | string | Yes | Scoped organization API key or Bearer JWT token | Bearer <token> |
Input parameters
string
required
Unique UUID identifier of the document to download. Example:
c5d1e2f3-4a5b-6c7d-8e9f-0123456789ab.string
required
Bearer token for authentication. Format:
Bearer <token>.Response Headers
The response is returned as binary stream data with the following HTTP headers:| Header | Example Value | Description |
|---|---|---|
Content-Type | application/pdf | Media type of the document (application/pdf, application/vnd.openxmlformats-officedocument.wordprocessingml.document, text/plain). |
Content-Disposition | attachment; filename="product_manual.pdf" | Browser download directive. |
curl -X GET "https://api.sayvy.ai/api/v1/knowledge-base/c5d1e2f3-4a5b-6c7d-8e9f-0123456789ab/download" \
-H "Authorization: Bearer <token>" \
--output product_manual.pdf
import requests
url = "https://api.sayvy.ai/api/v1/knowledge-base/c5d1e2f3-4a5b-6c7d-8e9f-0123456789ab/download"
headers = {
"Authorization": "Bearer <token>"
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
with open("downloaded_document.pdf", "wb") as f:
f.write(response.content)
print("Document downloaded successfully.")
else:
print(response.status_code, response.json())
const response = await fetch(
"https://api.sayvy.ai/api/v1/knowledge-base/c5d1e2f3-4a5b-6c7d-8e9f-0123456789ab/download",
{
method: "GET",
headers: {
"Authorization": "Bearer <token>"
}
}
);
const blob = await response.blob();
const downloadUrl = window.URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = downloadUrl;
a.download = "downloaded_document.pdf";
document.body.appendChild(a);
a.click();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.sayvy.ai/api/v1/knowledge-base/c5d1e2f3-4a5b-6c7d-8e9f-0123456789ab/download"))
.header("Authorization", "Bearer <token>")
.GET()
.build();
HttpResponse<Path> response =
HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofFile(Paths.get("downloaded_document.pdf"))
);
System.out.println("Saved document to " + response.body());
HTTP/1.1 200 OK
Content-Type: application/pdf
Content-Disposition: attachment; filename="product_manual.pdf"
Content-Length: 1048576
<binary document stream>
{
"detail": "Unauthorized"
}
{
"detail": "Document not found."
}
‹ PreviousNext ›
Delete document
DELETE /api/v1/knowledge-base/{document_id}
Was this page helpful?