Expand description
REST API over a Pipeline: document info and search in every retrieval mode.
Authentication is a static API-key list from config (RAG_API_KEYS), accepted
as X-Api-Key: <key> or Authorization: Bearer <key>. Auth is fail-closed:
router errors when the key list is empty. GET /health is public.
Endpoints (all under auth except /health):
| Method | Path | Description |
|---|---|---|
| GET | /health | liveness probe (public) |
| GET | /api/stats | document / chunk counts |
| GET | /api/documents | all documents with metadata + metrics |
| GET | /api/documents/{id} | one document by id |
| GET | /api/search | ?q=…&mode=hybrid&k=5 (also accepts POST) |
| POST | /api/search | {"query", "mode?", "top_k?", "answer?"} |
Search modes: vector, bm25, hybrid, multi-query, hyde. With
answer=true the LLM synthesizes a grounded answer (needs OPENROUTER_API_KEY).