API Reference
The BioCortex backend exposes a REST API and a WebSocket endpoint for the Next.js frontend and external integrations. Base path: /api/v1.Authentication
- Session: Cookie-based; login/register set session cookies.
- Endpoints: Most routes require an authenticated user (session). Unauthenticated requests may receive 401 or redirect to login.
| Method | Path | Description |
|---|---|---|
| GET | /me | Current user (authenticated, username, role). |
| GET | /me/settings | User settings (models, strategy, usage, limits). |
| PUT | /me/settings | Update settings (reasoning_model, coder_model, fast_model, custom_base_url, custom_api_key, strategy). |
| POST | /auth/login | Login (username, password) → session. |
| POST | /auth/register | Register (if enabled). |
| POST | /auth/logout | Logout. |
Chat and Analysis
| Method | Path | Description |
|---|---|---|
| WS | /ws/chat | WebSocket for streaming analysis: send messages, receive plan updates, steps, and final report. Config may include biomni_path to use Biomni tools. |
| GET | /chat/history | Chat history for a project (by project_id). |
Projects
| Method | Path | Description |
|---|---|---|
| GET | /projects | List user projects. |
| POST | /projects | Create project (title). |
| GET | /projects/ | Get project details (conversation, plan_steps, result_files). |
| DELETE | /projects/ | Delete project. |
Files and Results
| Method | Path | Description |
|---|---|---|
| POST | /files/upload | Upload files (multipart). |
| GET | /files/list | List uploaded files. |
| GET | /files/serve | Serve a file (path, optional download=true). |
| GET | /results/files | List result files (tree) for a project. |
| GET | /results/preview | Preview a result file (path, type). For PPTX files, returns extracted slide images for in-page preview. |
Reports and Presentations
| Method | Path | Description |
|---|---|---|
| POST | /projects//generate-report | Generate Markdown report from project results; saved under results dir. Returns report path/metadata. |
| POST | /projects//generate-pptx | Generate PowerPoint (.pptx) from project results; uses same Figure 1..N order and optional LLM captions. Returns path or triggers download. |
| POST | /reports/export | Export an existing report file. Body: { "path": "/abs/path/to/report.md", "format": "html" or "pdf" or "word" }. Returns file or URL. |
| GET | /results/preview | See Files and Results. Used for report/PPT preview (e.g. PPTX → slide images). |
Status and Resources
| Method | Path | Description |
|---|---|---|
| GET | /status | Agent/system status (online, agent loaded, status dict). |
| GET | /resources | Resources page: list tools, databases, packages. Returns { "databases": [...], "tools": [...], "packages": [...] }. Each item: name, description, domain, parameters. |
| GET | /context-budget | Context window budgets for configured models (for Settings/debugging). |
Automation
| Method | Path | Description |
|---|---|---|
| POST | /webhooks/ | Trigger webhook (e.g. experiment_done). Body: optional payload. |
| GET | /webhooks | List registered webhooks. |
| POST | /webhooks//configure | Configure webhook (task_template, description). |
| GET | /webhooks//calls | List recent webhook calls. |
| GET | /cron/jobs | List cron jobs. |
| POST | /cron/jobs | Create cron job (name, task, cron, enabled). |
| GET | /cron/jobs/ | Get cron job details. |
| DELETE | /cron/jobs/ | Remove cron job. |
| POST | /cron/jobs//enable | Enable job. |
| POST | /cron/jobs//disable | Disable job. |
| POST | /cron/start | Start cron scheduler. |
| POST | /cron/stop | Stop cron scheduler. |
Other
| Method | Path | Description |
|---|---|---|
| POST | /quick-chat | Simple LLM chat (BioCortex Assistant; uses framework docs as context). Body: JSON with a message field. |
| POST | /analysis/review | Submit analysis for review (if implemented). |
OpenAPI
For full request/response schemas and examples, run the backend and open:- Swagger UI:
http://localhost:7860/docs(or your backend base URL +/docs) - ReDoc:
http://localhost:7860/redoc
biocortex/web/api.py and mounted in biocortex/web/app.py.