Document Viewer¶
The viewer endpoints provide raw parsed document content and file listings. These are used by the frontend document viewer panel to display the original text alongside chunk boundaries.
Base path: /api/notebooks/{notebook_id}
GET /api/notebooks/{notebook_id}/documents/{file_id}/content¶
Get the raw parsed text content of a document. Returns the full text as extracted during the parsing stage of ingestion.
Auth: Admin
Headers:
| Header | Value |
|---|---|
Authorization | Bearer <token> |
Status: 200 OK
| Code | Cause |
|---|---|
401 | Invalid or missing token |
403 | Non-admin user |
404 | Document content not found |
import httpx
notebook_id = "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
file_id = "f1a2b3c4-..."
response = httpx.get(
f"http://localhost:8000/api/notebooks/{notebook_id}/documents/{file_id}/content",
headers={"Authorization": f"Bearer {token}"},
)
data = response.json()["data"]
print(f"Document: {data.get('file_name', file_id)}")
print(f"Content length: {len(data.get('content', ''))} chars")
print(data.get("content", "")[:500])
GET /api/notebooks/{notebook_id}/files¶
List all files in a notebook with their status. Similar to the documents list but optimized for the viewer panel.
Auth: Admin
Headers:
| Header | Value |
|---|---|
Authorization | Bearer <token> |
Status: 200 OK
{
"success": true,
"data": [
{
"file_id": "f1a2b3c4-...",
"file_name": "handbook.pdf",
"file_type": "PDF",
"status": "success",
"chunk_count": 45,
"created_at": "2026-02-25T10:00:00Z"
},
{
"file_id": "f5e6d7c8-...",
"file_name": "faq.docx",
"file_type": "DOCX",
"status": "success",
"chunk_count": 12,
"created_at": "2026-02-25T10:05:00Z"
}
]
}
| Code | Cause |
|---|---|
401 | Invalid or missing token |
403 | Non-admin user |
import httpx
notebook_id = "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
response = httpx.get(
f"http://localhost:8000/api/notebooks/{notebook_id}/files",
headers={"Authorization": f"Bearer {token}"},
)
files = response.json()["data"]
for f in files:
print(f" {f['file_name']} ({f['file_type']}) - {f['chunk_count']} chunks")