Skip to content

API endpoints ​

The FastAPI service that serves retrieval over the indexed corpus — the HTTP surface a coding agent (or any client) queries.

Overview ​

Authentication is JWT bearer (api/auth.py): /health is open, while /ask and /search require a valid token.

Endpoints ​

GET /health ​

Liveness check. No authentication.

Returns:

json
{ "status": "ok" }

POST /ask ​

Retrieval-augmented answer: retrieve the relevant chunks, then ask the configured LLM. Requires a valid JWT.

FieldTypeRequiredDescription
questionstringyesThe natural-language question

Returns { "answer": "…", "sources": [ … ], "provider": "…", "model": "…" }. provider and model identify the LLM that produced the answer.

POST /search ​

Semantic search only (no LLM) — returns the top matching chunks. Requires a valid JWT.

FieldTypeRequiredDescription
querystringyesThe search query
top_kintegernoHow many chunks to return (default 5)

Returns a bare list of chunks, best match first:

json
[
  {
    "path": "src/store/layers.js",
    "lines": "45-78",
    "score": 0.92,
    "content": "…",
    "commit_history": ["fix: …", "feat: …"]
  }
]
FieldTypeDescription
pathstringRepository-relative path of the file the chunk comes from
linesstringLine range the chunk covers, e.g. 45-78 (a single number for a one-line chunk)
scorefloatCosine similarity with the query, between 0 and 1
contentstringThe chunk itself, headed by its source and symbol
commit_historystring[]Commit subjects for that file, newest first — a sliding window (COMMIT_HISTORY_MAX_AGE_DAYS, 180 days) with a floor (COMMIT_HISTORY_MIN_COMMITS, 5) so a stable file keeps its history
repostringRepository the file belongs to
breadcrumbstringHeading path, symbol or component the chunk belongs to
chunk_indexintegerPosition of the chunk within its file