This document details the REST endpoints and Server-Sent Event (SSE) streams exposed by the FastAPI backend server. The API Layer is part of the Repository Intelligence Architecture (RIA), the platform's modular production architecture.
All endpoints are versioned under the /api/v1 prefix. Legacy root paths (e.g. /api/...) are supported as backward-compatible shims.
When the application is configured with an API_KEY (via the environment variable), all resource-intensive endpoints require authentication.
You must supply the API key in one of the following HTTP headers:
-
X-API-Key Header:
X-API-Key: your_secret_api_key_here -
Authorization Bearer Token Header:
Authorization: Bearer your_secret_api_key_here
Failed authentication requests return a 401 Unauthorized response:
{
"detail": "Unauthorized. Invalid or missing API key."
}Triggers synchronous metadata ingestion for a repository.
- Endpoint:
POST /api/v1/indexorPOST /api/index - Method:
POST - Request Body:
{ "repo_url": "https://github.com/fastapi/fastapi", "branch": "master" } - Response (200 OK):
{ "status": "completed", "owner": "fastapi", "repo_name": "fastapi", "files_count": 342, "symbols_count": 1821 }
Triggers repository cloning and AST parsing, streaming progress updates as Server-Sent Events (SSE).
- Endpoint:
POST /api/v1/analyzeorPOST /api/analyze - Method:
POST - Request Body:
{ "url": "https://github.com/fastapi/fastapi", "branch": "master", "model": "deepseek-ai/deepseek-v4-flash", "force_rebuild": false } - SSE Stream Data (Progress Events):
event: progress data: {"status": "cloning", "percent": 15, "message": "Cloning repository..."} event: progress data: {"status": "parsing", "percent": 50, "message": "Parsing abstract syntax trees..."} event: progress data: {"status": "completed", "percent": 100, "message": "Analysis completed."}
Returns metadata for an already analyzed repository.
- Endpoint:
GET /api/v1/analysis/{owner}/{repo_name}orGET /api/analysis/{owner}/{repo_name} - Method:
GET - Response (200 OK):
{ "owner": "fastapi", "repo_name": "fastapi", "indexed_at": "2026-07-04T12:00:00Z", "primary_language": "Python", "files_indexed": 342, "status": "ready" }
Rebuilds the dependency graph and symbol index from the already-cloned repository on disk without re-cloning or re-embedding.
- Endpoint:
POST /api/v1/repos/repairorPOST /api/repos/repair - Method:
POST - Request Body:
{ "owner": "fastapi", "repo": "fastapi" } - Response (200 OK):
{ "status": "completed", "message": "Repository index repaired successfully." }
Queries the multi-agent chatbot about the codebase. Responses are streamed as SSE chunks.
- Endpoint:
POST /api/v1/chatorPOST /api/chat - Method:
POST - Request Body:
{ "repo": "fastapi/fastapi", "message": "What is the entry point of the app?", "history": [ {"role": "user", "content": "Hi"}, {"role": "assistant", "content": "Hello! How can I help?"} ] } - Headers Required:
Accept: text/event-stream - SSE Stream Data Chunks:
event: chunk data: "The " event: chunk data: "main " event: chunk data: "entrypoint " event: citations data: [{"file": "fastapi/main.py", "lines": "1-15", "confidence": 0.95}] event: done data: [DONE]
Runs a live health check against every configured LLM provider.
- Endpoint:
GET /api/v1/chat/healthorGET /api/chat/health - Method:
GET - Response (200 OK):
{ "status": "ok", "healthy": true, "primary_provider": "gemini", "healthy_providers": ["gemini", "deepseek"], "unhealthy_providers": [] }
Hot-reloads the LLM provider configuration from .env without restarting the server.
- Endpoint:
POST /api/v1/chat/reloadorPOST /api/chat/reload - Method:
POST - Response (200 OK):
{ "status": "success", "message": "LLM provider reloaded successfully. Chat is ready." }
Generates a grounded implementation plan for a given issue using a two-LLM-call pipeline.
- Endpoint:
POST /api/v1/issues/maporPOST /api/issues/map - Method:
POST - Request Body:
{ "repo": "fastapi/fastapi", "title": "Fix memory leaks in cache", "description": "The cache store is leaking reference counts." } - Response (200 OK):
{ "issue_summary": "Fix memory leaks in cache", "issue_type": "Bugfix", "relevant_files": ["backend/dependencies.py"], "affected_components": ["Cache System"], "implementation_plan": [ { "step": 1, "action": "Introduce eviction logic to clean stale references." } ], "complexity": "Medium", "confidence": 0.9, "verified": true, "sources": ["backend/dependencies.py"] }
Returns node and edge representations for the file-level import graph.
- Endpoint:
GET /api/v1/graph/{owner}/{repo}/fullorGET /api/graph/{owner}/{repo}/full - Method:
GET - Query Parameters:
q: Optional search keyword to filter nodes.
- Response (200 OK):
{ "nodes": [ { "id": "fastapi/main.py", "label": "main.py", "category": "entry_point", "highlighted": false, "is_focus": false } ], "edges": [ { "source": "fastapi/main.py", "target": "fastapi/applications.py", "relationship": "imports" } ], "matched_count": 1 }
Returns only the immediate imports and dependents of a focus node.
- Endpoint:
GET /api/v1/graph/{owner}/{repo}/neighbors/{focus_id}orGET /api/graph/{owner}/{repo}/neighbors/{focus_id} - Method:
GET - Response (200 OK): (Same schema format as full graph, filtered to neighborhood nodes)
Computes a reachability subgraph using BFS in forward, backward, or bidirectional orientations.
- Endpoint:
GET /api/v1/graph/{owner}/{repo}/trace/{focus_id}orGET /api/graph/{owner}/{repo}/trace/{focus_id} - Method:
GET - Query Parameters:
direction:forward(imports),backward(dependents), orboth.depth: Maximum depth search limit (default6).
- Response (200 OK): (Returns sub-graph representing reachability paths)
Returns function-level call graph details for the repository.
- Endpoint:
GET /api/v1/call-graph/{owner}/{repo}orGET /api/call-graph/{owner}/{repo} - Method:
GET - Response (200 OK): (Returns function node call mappings)
Computes the blast radius of changing a specific function.
- Endpoint:
GET /api/v1/call-graph/{owner}/{repo}/blast-radius/{function_id}orGET /api/call-graph/{owner}/{repo}/blast-radius/{function_id} - Method:
GET - Response (200 OK):
{ "function_id": "fastapi/main.py:app", "affected_functions": ["fastapi/applications.py:FastAPI"], "affected_files": ["fastapi/applications.py"], "depth": 1, "risk_level": "LOW", "recursive_cycles": [] }
Identifies code files with high commit frequency and high topological dependency centrality.
- Endpoint:
GET /api/v1/churn/{owner}/{repo}/hotspotsorGET /api/churn/{owner}/{repo}/hotspots - Method:
GET - Query Parameters:
top_n: Maximum items to return (default25).since_days: Git history window (default365).
- Response (200 OK):
{ "hotspots": [ { "file_path": "backend/api.py", "commit_count": 42, "churn_score": 8.4 } ] }
Triggers report generation or fetches the cached analysis report.
- Endpoint:
POST /api/v1/report/{owner}/{repo}/build - Method:
POST - Response (200 OK):
{ "metadata": { "repo_name": "fastapi", "owner": "fastapi", "total_loc": 25410, "generated_at": "2026-07-04T18:00:00Z" }, "scores": { "overall": 88, "architecture": 90, "api": 85, "hygiene": 92, "churn": 80, "readability": 95, "grade": "A" }, "refactoring_priorities": [ "Refactor volatile hotspot module: fastapi/applications.py (churn score: 95.0)" ] }
Downloads the report in static formats.
- Endpoint:
GET /api/v1/report/{owner}/{repo}/download - Method:
GET - Query Parameters:
format:html,markdown, orpdf.
- Response: File attachment stream (
text/html,text/markdown, orapplication/pdf).
Analyzes the digital twin structure and continuous monitoring states to generate prioritized advisor recommendations and roadmaps.
- Endpoint:
POST /api/v1/repositories/{owner}/{repo}/advisororPOST /api/repositories/{owner}/{repo}/advisor - Method:
POST - Response (200 OK):
{ "repository": "fastapi/fastapi", "overall_priority": "medium", "total_recommendations": 12, "top_recommendations": [ { "id": "rec-1", "title": "Resolve cycle between main and routing", "category": "architecture", "priority": "high", "estimated_effort": "medium" } ], "roadmap_phases": 3, "roadmap_summary": [ { "phase": 1, "title": "Mitigate Security & Dependency Issues", "recommendation_count": 4 } ] }
Fetches the most recently generated advisor report details.
- Endpoint:
GET /api/v1/repositories/{owner}/{repo}/advisor/latestorGET /api/repositories/{owner}/{repo}/advisor/latest - Method:
GET - Response (200 OK): (Same schema format as Advisor Report)
Fetches the roadmap list from the latest Advisor report.
- Endpoint:
GET /api/v1/repositories/{owner}/{repo}/advisor/roadmaporGET /api/repositories/{owner}/{repo}/advisor/roadmap - Method:
GET - Response (200 OK): (Returns Roadmap Phases array)
Constructs an autonomous implementation roadmap from the latest Advisor report.
- Endpoint:
POST /api/v1/repositories/{owner}/{repo}/execution-planorPOST /api/repositories/{owner}/{repo}/execution-plan - Method:
POST - Response (200 OK):
{ "repository": "fastapi/fastapi", "total_tasks": 8, "total_batches": 2, "critical_path_length": 5, "rollback_checkpoints": 2, "conflict_count": 0, "overall_risk": "low", "batches": [ { "batch_id": "batch-1", "order": 1, "title": "Initial Refactoring Pass", "task_count": 3, "parallel": true, "estimated_effort": "1 day" } ], "critical_path": ["task-1", "task-3"], "metadata": {} }
Fetches the most recently generated execution plan.
- Endpoint:
GET /api/v1/repositories/{owner}/{repo}/execution-plan/latestorGET /api/repositories/{owner}/{repo}/execution-plan/latest - Method:
GET - Response (200 OK): (Same schema format as Execution Plan)
Returns the consolidated data for all workspace views to power the IDE dashboard panels in a single request.
- Endpoint:
GET /api/v1/repositories/{owner}/{repo}/workspaceorGET /api/repositories/{owner}/{repo}/workspace - Method:
GET - Query Parameters:
file: Optional path of currently open file to contextualize snapshot.symbol: Optional currently active symbol.panel: Active panel focus name.
- Response (200 OK):
(Returns
WorkspaceSnapshotcontaining Overview, Explorer, Chat, Findings, Timeline, Monitor, Advisor, and Execution panel structures)
Retrieve individual panel snapshots using these sub-routes (available with root, /api, and /api/v1 prefixes):
GET /api/v1/repositories/{owner}/{repo}/workspace/overview(Overview Panel)GET /api/v1/repositories/{owner}/{repo}/workspace/explorer(Knowledge Graph Explorer)GET /api/v1/repositories/{owner}/{repo}/workspace/findings(Findings Panel)GET /api/v1/repositories/{owner}/{repo}/workspace/timeline(Timeline Panel)GET /api/v1/repositories/{owner}/{repo}/workspace/monitor(Continuous Monitor Panel)GET /api/v1/repositories/{owner}/{repo}/workspace/advisor(Advisor Panel)GET /api/v1/repositories/{owner}/{repo}/workspace/execution(Execution Plan Panel)
- Endpoint:
GET /healthorGET /api/v1/health - Method:
GET - Response (200 OK):
{ "status": "healthy", "backend": "online", "llm_provider": "gemini", "llm_model": "gemini-2.5-flash", "embedding_provider": "BAAI/bge-small-en-v1.5", "vector_db": "chromadb" }
- Endpoint:
GET /metricsorGET /api/v1/metrics - Method:
GET - Response (200 OK): Standard Prometheus text format listing HTTP request counts, active gauges, and processing latencies.