Repository navigation
REST and WebSocket API Reference
Manvendra Pratap Singh edited this page Oct 11, 2026
·
1 revision
CodeLens exposes a comprehensive, deterministic HTTP REST, Server-Sent Events (SSE), and streaming WebSocket API. External CI/CD runners, IDE plugins, custom automation scripts, and the frontend web UI interact with the core engine through these contracts.
Base URL: http://localhost:7878
| Method | Endpoint | Description | Payload / Response |
|---|---|---|---|
POST |
/api/scan |
Initiates an asynchronous full 8-stage scan |
{"path": "/abs/repo"} {"scanId": "...", "status": "QUEUED"}
|
POST |
/api/scan/incremental |
Initiates a fast delta scan for modified files |
{"path": "/abs/repo"} {"status": "SCANNING", "deltaCount": 12}
|
GET |
/api/scan/status |
Current scan stage, percentage, and timing | {"stage": "CODESTORY", "progress": 94, "elapsedMs": 4210} |
GET |
/api/scan/events |
Server-Sent Events (SSE) stream of stage updates |
text/event-stream emitting stage_change, progress, complete
|
GET |
/api/scan/changes |
Scans disk and returns detected delta manifest | {"new": [...], "modified": [...], "deleted": [...]} |
POST |
/api/scan/cancel |
Gracefully terminates any active scanning task | {"success": true, "message": "Scan cancelled"} |
| Method | Endpoint | Description | Query Parameters / Response |
|---|---|---|---|
GET |
/api/graph |
Full directed call graph with compound clusters | {"nodes": [...], "edges": [...], "clusters": [...]} |
GET |
/api/graph/subgraph |
Filtered graph slice by package, class, or depth | ?package=com.example.service&depth=2 |
GET |
/api/graph/call-hierarchy |
Upstream callers or downstream callees BFS | ?class=OrderService&direction=BOTH&hops=3 |
GET |
/api/graph/layout |
Precomputed 2D/3D layout coordinates |
?mode=sunflower or ?mode=fcose
|
GET |
/api/graph/cycles |
Strongly connected components (dependency loops) | {"cycles": [["PkgA", "PkgB", "PkgC", "PkgA"]]} |
| Method | Endpoint | Description | Payload / Response |
|---|---|---|---|
GET |
/api/codestory/flows |
Discovered business transaction storylines | [{"id": "flow_1", "name": "Checkout", "steps": 6}] |
GET |
/api/codestory/flows/{id} |
Detailed execution step-by-step trace | {"id": "flow_1", "steps": [...], "sinks": [...]} |
GET |
/api/codestory/tours |
Precomputed 5-layer guided onboarding tour | {"modules": [...], "keyFlows": [...], "risks": [...]} |
GET |
/api/codestory/change-story |
Generates PR impact narrative between git refs |
?base=main&head=feat/x |
POST |
/api/codestory/what-if |
Simulates blast radius of modifying a symbol |
{"symbol": "com.ex.Service.save"} |
| Method | Endpoint | Description | Payload / Response |
|---|---|---|---|
GET |
/api/ai/config |
Returns active AI provider, model, and status | {"provider": "ollama", "model": "qwen3-coder:latest", "hasApiKey": false} |
POST |
/api/ai/config |
Saves AI provider configuration | {"provider": "ollama", "model": "...", "endpoint": "..."} |
POST |
/api/ai/test |
Live external handshake test for selected provider |
{"provider": "ollama", ...} {"ok": true, "message": "Ollama is listening on port 11434"}
|
GET |
/api/ai/models |
Discovers installed models from active provider | {"models": ["qwen3-coder:latest", "llama3", "gemma4:latest"]} |
POST |
/api/ai/models |
Probes ad-hoc provider endpoint for model tags |
{"provider": "ollama", "endpoint": "..."} {"models": [...]}
|
POST |
/api/ai/ask |
Executes architecture-grounded Q&A query |
{"query": "..."} {"answer": "...", "engine": "...", "citations": [...]}
|
| Method | Endpoint | Description | Payload / Response |
|---|---|---|---|
GET |
/api/integrity/audit |
Executes or fetches current 14-rule audit | {"score": 88, "violations": [...], "count": 24} |
GET |
/api/integrity/rules |
Catalog of all 14 class-awareness rules | [{"id": "R01", "name": "DTO Boundary", "enabled": true}] |
POST |
/api/integrity/rules/validate |
Tests custom architecture rule against AST | {"rule": "CONTROLLER -> REPOSITORY : BLOCK"} |
| Method | Endpoint | Description | Query Parameters / Response |
|---|---|---|---|
GET |
/api/macro/modules |
Package coupling ( |
[{"package": "com.ex.service", "ca": 14, "ce": 6, "i": 0.3}] |
GET |
/api/macro/martin |
Robert C. Martin metrics ( |
[{"package": "...", "a": 0.4, "i": 0.6, "d": 0.0}] |
| Method | Endpoint | Description | Payload / Response |
|---|---|---|---|
GET |
/api/tasks |
Live status snapshot across all 18 background tasks | [{"id": "scanner", "status": "RUNNING", "stage": 1}] |
POST |
/api/tasks/{id}/cancel |
Cancels an active or queued background task | {"success": true} |
GET |
/api/system/threads/dump |
Live thread dump and lock monitor diagnostics | Plain text thread stack trace |
GET |
/api/system/health |
Heap usage, circuit breaker status, and memory | {"heapPct": 34, "circuitBreaker": "CLOSED"} |
CodeLens — Offline Java Architectural Intelligence & CodeStory Platform
100% Offline · Air-Gapped Local Operation · Zero Cloud Telemetry
- Home
- Getting Started & Onboarding
- Architecture & System Design
- 8-Stage Scan Pipeline & Readiness
- CodeStory & Guided Tours
- Structural Integrity & Audits
- Interactive Visualizations & 3D Studio
- Macro Architecture Studio
- Process Hub & JVM Sentinel
- Intelligence Reports Guide
- Deployment & Operations
- Developer CLI & Toolsuite
- REST & WebSocket API Reference
Repository Resources