Notebooks¶
Notebooks are the top-level organizational unit. Each notebook has its own documents, conversations, settings, and vector store. Notebooks are scoped to a database type (cloud or local) and a storage provider.
Base path: /api/notebooks
POST /api/notebooks/¶
Create a new notebook with default settings. The notebook_id is client-generated (typically crypto.randomUUID()). The embedding_model is locked at creation time and cannot be changed later.
Auth: Admin
Headers:
| Header | Value |
|---|---|
Authorization | Bearer <token> |
Content-Type | application/json |
Body:
{
"notebook_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"notebook_title": "Customer Support KB",
"notebook_description": "Knowledge base for support agents",
"icon": "\ud83d\udcca",
"embedding_model": "openai/text-embedding-3-small",
"db_type": "cloud",
"storage_provider": "supabase",
"user_id": "user_abc123"
}
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
notebook_id | string | Yes | -- | Client-generated UUID |
notebook_title | string | Yes | -- | Notebook title (1-200 chars) |
notebook_description | string | No | "" | Optional description |
icon | string | No | "\ud83d\udcca" | Emoji icon |
embedding_model | string | No | "openai/text-embedding-3-small" | Embedding model (immutable after creation) |
db_type | string | No | "cloud" | "cloud" or "local" |
storage_provider | string | No | "supabase" | "supabase", "s3", "local", or "none" |
user_id | string | Yes | -- | Owner user ID (auto-filled from auth if empty) |
Status: 201 Created
{
"success": true,
"data": {
"notebook_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"notebook_title": "Customer Support KB",
"notebook_description": "Knowledge base for support agents",
"icon": "\ud83d\udcca",
"db_type": "cloud",
"storage_provider": "supabase",
"number_of_documents": 0,
"created_at": "2026-02-25T10:00:00Z",
"updated_at": "2026-02-25T10:00:00Z"
}
}
| Code | Cause |
|---|---|
400 | Invalid db_type or storage_provider value |
400 | Missing or empty notebook_title |
401 | Invalid or missing token |
403 | Non-admin user |
import httpx
import uuid
response = httpx.post(
"http://localhost:8000/api/notebooks/",
headers={"Authorization": f"Bearer {token}"},
json={
"notebook_id": str(uuid.uuid4()),
"notebook_title": "Customer Support KB",
"user_id": "dev-user",
},
)
notebook = response.json()["data"]
print(f"Created: {notebook['notebook_id']}")
GET /api/notebooks/¶
List all notebooks with file-job status counts. Queries both cloud and local databases if configured. Admins see all notebooks; non-admins see only notebooks shared with them.
Auth: User
Headers:
| Header | Value |
|---|---|
Authorization | Bearer <token> |
Status: 200 OK
{
"success": true,
"data": [
{
"notebook_id": "a1b2c3d4-...",
"notebook_title": "Customer Support KB",
"notebook_description": "",
"icon": "\ud83d\udcca",
"db_type": "cloud",
"storage_provider": "supabase",
"number_of_documents": 12,
"pending_count": 0,
"processing_count": 0,
"error_count": 1,
"success_count": 11,
"total_files": 12,
"is_finished": true,
"created_at": "2026-02-25T10:00:00Z",
"updated_at": "2026-02-25T12:00:00Z"
}
]
}
| Code | Cause |
|---|---|
401 | Invalid or missing token |
GET /api/notebooks/{notebook_id}¶
Get a single notebook by ID. Auto-resolves the correct database (cloud or local).
Auth: User
Headers:
| Header | Value |
|---|---|
Authorization | Bearer <token> |
Status: 200 OK
{
"success": true,
"data": {
"notebook_id": "a1b2c3d4-...",
"notebook_title": "Customer Support KB",
"notebook_description": "",
"icon": "\ud83d\udcca",
"db_type": "cloud",
"storage_provider": "supabase",
"number_of_documents": 12,
"created_at": "2026-02-25T10:00:00Z",
"updated_at": "2026-02-25T12:00:00Z"
}
}
| Code | Cause |
|---|---|
401 | Invalid or missing token |
404 | Notebook not found |
GET /api/notebooks/{notebook_id}/status¶
Get detailed notebook status including document stats, conversation stats, enhancement stats, and file job details.
Auth: User
Headers:
| Header | Value |
|---|---|
Authorization | Bearer <token> |
Status: 200 OK
{
"success": true,
"data": {
"notebook": {
"notebook_id": "a1b2c3d4-...",
"notebook_title": "Customer Support KB",
"number_of_documents": 12
},
"documents": {
"total_documents": 12,
"total_chunks": 340,
"tabular_documents": 2,
"non_tabular_documents": 10
},
"conversations": {
"total_conversations": 5,
"total_messages": 48
},
"enhancement": {
"total_chunks": 340,
"enhanced_chunks": 200,
"pending_chunks": 100,
"failed_chunks": 3
},
"file_jobs": [
{
"file_id": "...",
"file_name": "handbook.pdf",
"status": "success"
}
]
}
}
| Code | Cause |
|---|---|
401 | Invalid or missing token |
404 | Notebook not found |
import httpx
notebook_id = "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
response = httpx.get(
f"http://localhost:8000/api/notebooks/{notebook_id}/status",
headers={"Authorization": f"Bearer {token}"},
)
status = response.json()["data"]
print(f"Chunks: {status['documents']['total_chunks']}")
print(f"Enhanced: {status['enhancement']['enhanced_chunks']}")
PATCH /api/notebooks/{notebook_id}¶
Update a notebook's title and/or description.
Auth: Admin
Headers:
| Header | Value |
|---|---|
Authorization | Bearer <token> |
Content-Type | application/json |
Body:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
notebook_title | string | No | -- | New title |
notebook_description | string | No | -- | New description |
Status: 200 OK
| Code | Cause |
|---|---|
401 | Invalid or missing token |
403 | Non-admin user |
404 | Notebook not found |
DELETE /api/notebooks/all¶
Delete all notebooks and their related data. This is a destructive operation.
Auth: Admin
Headers:
| Header | Value |
|---|---|
Authorization | Bearer <token> |
| Code | Cause |
|---|---|
401 | Invalid or missing token |
403 | Non-admin user |
Destructive Operation
This permanently deletes all notebooks, documents, conversations, and vector data. There is no undo.
DELETE /api/notebooks/{notebook_id}¶
Delete a single notebook and all related data via database cascade (RPC call).
Auth: Admin
Headers:
| Header | Value |
|---|---|
Authorization | Bearer <token> |
Status: 200 OK
{
"success": true,
"data": {
"notebook_id": "a1b2c3d4-...",
"notebook_title": "Customer Support KB",
"documents_deleted": 12,
"document_records_deleted": 12,
"jobs_deleted": 12,
"chunks_deleted": 340,
"chat_messages_deleted": 48,
"conversations_deleted": 5,
"raw_data_deleted": 12,
"cache_deleted": 8,
"deleted_at": "2026-02-25T15:00:00Z"
}
}
| Code | Cause |
|---|---|
401 | Invalid or missing token |
403 | Non-admin user |
404 | Notebook not found |