KubeLens API is served under /api.
Formal schema source of truth: backend/internal/httpapi/openapi.yaml.
This guide focuses on practical endpoint groups and operational behavior.
- Local:
http://localhost:3000/api - In-cluster: your service/ingress URL +
/api
POST /auth/loginwith{ "token": "<token>" }- Server validates token and sets an HttpOnly session cookie.
GET /auth/sessionreturns current session state.POST /auth/logoutclears the session.
viewer: read + assist + streamoperator: viewer + write routes (if write gate enabled)admin: operator + admin-level routes
Mutating cluster routes are additionally blocked unless WRITE_ACTIONS_ENABLED=true.
{ "error": "message" }GET /healthzGET /readyzGET /openapi.yamlGET /versionGET /runtimeGET /metricsGET /metrics/prometheusGET /sloGET /rightsizing
GET /auth/sessionPOST /auth/loginPOST /auth/logoutGET /clustersPOST /clusters/select
GET /stream(SSE)GET /stream/ws(WebSocket)GET /audit
Notes:
- WebSocket upgrades enforce same-origin/trusted-origin checks.
- Cross-origin upgrade attempts are rejected with
403.
POST /alerts/dispatchPOST /alerts/testGET /alerts/lifecyclePOST /alerts/lifecycle
GET /cluster-infoGET /namespacesGET /podsGET /pods/{namespace}/{name}GET /pods/{namespace}/{name}/eventsGET /pods/{namespace}/{name}/logsGET /pods/{namespace}/{name}/logs/streamGET /pods/{namespace}/{name}/describeGET /nodesGET /nodes/{name}GET /nodes/{name}/podsGET /nodes/{name}/eventsGET /eventsGET /resources/{kind}GET /resources/{kind}/{namespace}/{name}/yamlGET /stats
POST /podsPOST /pods/{namespace}/{name}/restartDELETE /pods/{namespace}/{name}POST /nodes/{name}/cordonPOST /nodes/{name}/uncordonGET /nodes/{name}/drain/previewPOST /nodes/{name}/drainPUT /resources/{kind}/{namespace}/{name}/yamlPOST /resources/{kind}/{namespace}/{name}/scalePOST /resources/{kind}/{namespace}/{name}/restartPOST /resources/{kind}/{namespace}/{name}/rollback
GET /diagnosticsGET /predictionsGET /predictive-incidents(backward-compatible alias)POST /assistantPOST /assistant/references/feedbackGET /rag/telemetry
POST /incidentsGET /incidentsGET /incidents/{id}GET /incidents/{id}/replayGET /incidents/{id}/evidencePATCH /incidents/{id}/steps/{step}POST /incidents/{id}/resolvePOST /incidents/{id}/postmortemGET /postmortemsGET /postmortems/{id}POST /remediation/proposeGET /remediationGET /remediation/{id}/gitopsPOST /remediation/{id}/gitopsPOST /remediation/{id}/approvePOST /remediation/{id}/executePOST /remediation/{id}/rejectGET /memory/runbooksPOST /memory/runbooksPUT /memory/runbooks/{id}GET /memory/fixesPOST /memory/fixesPOST /risk-guard/analyze
curl -X POST http://localhost:3000/api/auth/login \
-H "Content-Type: application/json" \
-d '{"token":"viewer-token"}'curl -s http://localhost:3000/api/diagnostics \
-H "Authorization: Bearer viewer-token"curl -X POST http://localhost:3000/api/remediation/propose \
-H "Authorization: Bearer viewer-token"curl -X POST http://localhost:3000/api/remediation/<proposal-id>/execute \
-H "Authorization: Bearer operator-token"curl -X POST http://localhost:3000/api/risk-guard/analyze \
-H "Authorization: Bearer viewer-token" \
-H "Content-Type: application/json" \
-d '{"manifest":"apiVersion: apps/v1\nkind: Deployment\n..."}'curl -s http://localhost:3000/api/slo \
-H "Authorization: Bearer viewer-token"curl -s http://localhost:3000/api/incidents/<incident-id>/evidence \
-H "Authorization: Bearer viewer-token"curl -X POST http://localhost:3000/api/remediation/<proposal-id>/gitops \
-H "Authorization: Bearer viewer-token" \
-H "Content-Type: application/json" \
-d '{}'curl -s http://localhost:3000/api/rightsizing \
-H "Authorization: Bearer viewer-token"- Runtime/security:
APP_MODE,DEV_MODE,WRITE_ACTIONS_ENABLED - Auth:
AUTH_ENABLED,AUTH_TOKENS,AUTH_PROVIDER,AUTH_OIDC_*,AUTH_TRUSTED_PROXY_CIDRS - Rate limits:
RATE_LIMIT_ENABLED,RATE_LIMIT_REQUESTS,RATE_LIMIT_WINDOW_SECONDS - Predictor:
PREDICTOR_BASE_URL,PREDICTOR_SHARED_SECRET - Assistant/RAG:
ASSISTANT_*,OLLAMA_* - Alerts:
ALERTMANAGER_WEBHOOK_URL,SLACK_WEBHOOK_URL,PAGERDUTY_* - ChatOps:
CHATOPS_*
For exact schemas/status codes, use:
backend/internal/httpapi/openapi.yamlsrc/lib/api/generated/openapi-contract.ts(generated frontend route contract; runnpm run generate:api-contract)