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
The slug of the knowledge base.
The file key from Get Knowledge Base Files. Format: {timestamp}-{filename}
Response
Returns
Binary file stream with headers
MIME type of the file (e.g., “application/pdf”, “text/plain”).
Attachment header with original filename.