docs/7-DEVELOPMENT/api-reference.md
Complete REST API for Open Notebook. All endpoints are served from the API backend (default: http://localhost:5055).
Base URL: http://localhost:5055 (development) or environment-specific production URL
Interactive Docs: Use FastAPI's built-in Swagger UI at http://localhost:5055/docs for live testing and exploration. This is the primary reference for all endpoints, request/response schemas, and real-time testing.
Simple password-based (development only):
curl http://localhost:5055/api/notebooks \
-H "Authorization: Bearer your_password"
⚠️ Production: Replace with OAuth/JWT. See Security Configuration for details.
Most operations follow this pattern:
Instead of memorizing endpoints, use the interactive API docs:
http://localhost:5055/docsNotebooks - Research projects containing sources and notes
GET/POST /notebooks - List and createGET/PUT/DELETE /notebooks/{id} - Read, update, deleteSources - Content items (PDFs, URLs, text)
GET/POST /sources - List and add contentGET /sources/{id} - Fetch source detailsPOST /sources/{id}/retry - Retry failed processingGET /sources/{id}/download - Download original fileNotes - User-created or AI-generated research notes
GET/POST /notes - List and createGET/PUT/DELETE /notes/{id} - Read, update, deleteChat - Conversational AI interface
GET/POST /chat/sessions - Manage chat sessionsPOST /chat/execute - Send message and get responsePOST /chat/context/build - Prepare context for chatSearch - Find content by text or semantic similarity
POST /search - Full-text or vector searchPOST /ask - Ask a question (search + synthesize)Transformations - Custom prompts for extracting insights
GET/POST /transformations - Create custom extraction rulesPOST /sources/{id}/insights - Apply transformation to sourceModels - Configure AI providers
GET /models - Available modelsGET /models/defaults - Current defaultsPOST /models/config - Set defaultsCredentials - Manage AI provider credentials
GET/POST /credentials - List and create credentialsGET/PUT/DELETE /credentials/{id} - CRUD operationsPOST /credentials/{id}/test - Test connectionPOST /credentials/{id}/discover - Discover models from providerPOST /credentials/{id}/register-models - Register discovered modelsGET /credentials/status - Provider status overviewGET /credentials/env-status - Environment variable statusPOST /credentials/migrate-from-env - Migrate env vars to credentialsHealth & Status
GET /health - Health checkGET /commands/{id} - Track async operationsAll requests require password header:
curl -H "Authorization: Bearer your_password" http://localhost:5055/api/notebooks
Password configured via OPEN_NOTEBOOK_PASSWORD environment variable.
📖 See Security Configuration for complete authentication setup, API examples, and production hardening.
⚠️ Not secure. Replace with:
See Security Configuration for production setup.
# List sources with limit/offset
curl 'http://localhost:5055/sources?limit=20&offset=10'
# Filter by notebook, sort by date
curl 'http://localhost:5055/sources?notebook_id=notebook:abc&sort_by=created&sort_order=asc'
Some operations (source processing, podcast generation) return immediately with a command ID:
# Submit async operation
curl -X POST http://localhost:5055/sources -F async_processing=true
# Response: {"id": "source:src001", "command_id": "command:cmd123"}
# Poll status
curl http://localhost:5055/commands/command:cmd123
The /ask endpoint streams responses as Server-Sent Events:
curl -N 'http://localhost:5055/ask' \
-H "Content-Type: application/json" \
-d '{"question": "What is AI?"}'
# Outputs: data: {"type":"strategy",...}
# data: {"type":"answer",...}
# data: {"type":"final_answer",...}
curl -X POST http://localhost:5055/sources \
-F "type=upload" \
-F "notebook_id=notebook:abc" \
-F "[email protected]"
All errors return JSON with status code:
{"detail": "Notebook not found"}
| Code | Meaning | Example |
|---|---|---|
| 200 | Success | Operation completed |
| 400 | Bad Request | Invalid input |
| 404 | Not Found | Resource doesn't exist |
| 409 | Conflict | Resource already exists |
| 500 | Server Error | Database/processing error |
http://localhost:5055/docs) - this is the definitive referencedocker logs)/models)X-Password header to all requestsPOST /notebooks with name and descriptionPOST /sources with file, URL, or textPOST /chat/execute to ask questionsSee Security Configuration and Reverse Proxy Setup for complete production setup.