Skip to main content
{
  "Content-Type": {},
  "Content-Length": {},
  "Content-Disposition": {}
}
Download the original file from a knowledge base. Returns the file as a binary stream.

Examples

import requests

kb_slug = "product-documentation"
file_id = "1705320000000-api.pdf"

url = f"https://labs.chonkie.ai/api/v1/knowledge/{kb_slug}/{file_id}"
headers = {
    "Authorization": "Bearer YOUR_API_KEY"
}

response = requests.get(url, headers=headers)

# Save to file
with open("downloaded-api.pdf", "wb") as f:
    f.write(response.content)

print(f"Downloaded: {file_id}")
print(f"Size: {len(response.content)} bytes")

Request

Path Parameters

knowledge_base_slug
string
required
The slug of the knowledge base.
file_id
string
required
The file key from Get Knowledge Base Files. Format: {timestamp}-{filename}

Response

Returns

Binary file stream with headers
Content-Type
header
MIME type of the file (e.g., “application/pdf”, “text/plain”).
Content-Length
header
File size in bytes.
Content-Disposition
header
Attachment header with original filename.
I