تخطَّ إلى المحتوى
kazma.
EN نجمة 7 ابدأ الآن

API & Route Matrix

Primary surfaces of the FastAPI app (kazma_ui). Auth is default-deny for /api/* unless listed open. HITL danger applies to tool execution, not every HTTP route.

MethodPathAuthDescription
GET/healthOpenLiveness
GET/health/liveOpenProcess live
GET/health/readyOpenReadiness (DB ping when configured)
MethodPathAuth scopeDescription
GET/POST/loginPublic pageMulti-mode login (user / secret / OIDC)
POST/api/auth/*VariesLogin, logout, session (see auth.py, saas_api.py)
GET/api/saas/*Admin / operatorTenants, platform users (RBAC)
MethodPathAuthHITLDescription
POST/api/chat/streamSession/secretGraph interrupt on danger toolsSSE chat stream
POST/api/approve/{thread_id}SessionResumes graph HITLApprove danger tool
*Session CRUD under /api/sessions*SessionThread list / history (session_manager)
MethodPathAuthHITLDescription
*/api/ide/*SessionVia tool registryFiles, apply_patch, codebase search, LSP (GET/POST /lsp), run, git, swarm send (ide_api.py)
GET/ideSessionIDE page
MethodPathAuthDescription
*/api/swarm/*Session / RBACWorkers, dispatch, tasks, metrics
GETSSE swarm eventsSessionLive task stream (swarm_sse)
GET/swarmSessionSwarm panel page
*/api/replay/*SessionTime travel: threads, snapshots, restore, fork, compare, clear (replay_routes.py)
GET/replaySessionTime Travel panel page
*/api/research/*SessionResearch: list, detail, compare, export, archive, unarchive (research_panel/routes.py)
POST/api/research/sessionsSessionStart deep research session (background pipeline)
GET/api/research/sessionsSessionList durable research sessions
GET/api/research/sessions/{id}SessionSession status / log / report path
GET/api/research/sessions/{id}/streamSessionSSE progress (snapshot / progress / done)
GET/api/research/evalSessionStructural rubric for ?path= or ?session_id=
POST/api/memory/v2/eval/goldenSessionRun golden memory recall cases (pass rate)
GET/researchSessionResearch panel page (start form + live progress)
MethodPathAuthDescription
GET/api/system/statusSessionMemory health board + embedder/layer probes (build_memory_health)
GET/api/memory/graphSessionProperty graph JSON (nodes/edges); optional ?q= filter
GET/api/memory/graph/statsSessionNode/edge counts + backend path
GET/api/memory/graph/searchSessionFTS search over graph nodes (?q=&limit=)
POST/api/memory/graph/clearSessionBi-temporal invalidate of active V2 beliefs for one tenant (?tenant= defaults to default; no all-tenants mode). Tombstones the PG mirror, deletes Neo4j edges, writes a graph_clear audit row. UI confirms.
*/api/system/memory/*SessionBackup / restore / maintenance of memory stores

Active when memory.v2.use_new_stack is true. All routes return shaped JSON on error (never a bare 500); non-numeric params yield a FastAPI 422.

MethodPathAuthDescription
GET/api/memory/v2/healthSessionV2 health snapshot — active/superseded/archived belief counts, episode/entity/procedural stats, queue depth. Drives the dashboard KPI grid (pollV2Health, 5s cadence).
GET/api/memory/v2/beliefsSessionActive beliefs list. ?q= FTS filter, ?limit= (default 50, clamped 1–200).
GET/api/memory/v2/beliefs/{id}SessionBelief detail + supersede chain.
POST/api/memory/v2/beliefs/{id}/invalidateSessionSoft-invalidate one belief (+ best-effort Neo4j edge delete).
POST/api/memory/v2/beliefs/invalidate-batchSessionSoft-invalidate many ({ "ids": [...] }).
PATCH/api/memory/v2/beliefs/{id}SessionOperator edit of active triple: optional subject, predicate, object, predicate_type. Sets extraction_method=user_explicit; clears embedding if object changes.
GET/api/memory/v2/graphSessionBelief graph {nodes, links, stats, groups} for the canvas. Bi-temporal + filter params: ?at=<unix_ts> (point-in-time scrub; superseded beliefs marked superseded=true), ?type= (functional/set/state predicate_type), ?entity_type= (person/tool/concept/…), ?limit= (default 200), ?source=neo4j (optional probe). stats.total_links vs stats.links is the slicing delta shown on the truncation banner. Invariants: unique node ids; no virtual fact node when object text equals an entity id; no dangling links; hub node id=user with display name from entities.user (self person shells collapsed onto hub); payload-object subjects carry a hub related_to anchor.
GET/api/memory/v2/entitiesSessionEntity list for /memory ops. Flags: empty, isolated, protected, is_self, graph_id (self shells → "user"). Query: ?q=, ?empty_only=, ?isolated_only=, ?limit=.
POST/api/memory/v2/entities/{id}/renameSessionDisplay rename only ({ "name": "…" }). Id stable; aliases preserved. Self/person User shells also upsert hub entities.user. Returns hub_synced, graph_id.
POST/api/memory/v2/entities/mergeSessionMerge source into target (beliefs rewired, aliases union).
POST/api/memory/v2/entities/linkSessionCreate belief edge (subject, predicate, object).
DELETE/api/memory/v2/entities/{id}SessionDelete entity shell (blocked for protected ids: user, assistant, …). Copies matching entity_merges rows to entity_merges_archive before dropping live ledger rows (FK).
GET/api/memory/v2/admin/summarySessionCounts for ops chips (live/invalidated beliefs, empty/isolated entities).
GET/POST/api/memory/v2/hygiene/*SessionPreview + run empty purge / near-dup invalidate / archive.
GET/POST/api/memory/v2/entity-merges*SessionQuarantine merge list + approve/reject.
GET/POST/DELETE/api/memory/v2/graph/groups*SessionView-only groupings (list/create/delete/move/tier). Never mutates beliefs. Canvas poll uses groups on GET /graph; Ungroup is DELETE …/groups/{id}.
GET/api/memory/v2/graph/exportSessionOn-demand JSON or GraphML (?format=json|graphml).
POST/api/memory/v2/probeSessionRecall dry-run (explain chips).
POST/api/memory/v2/federated-searchSessionMemory + KB labeled search.
POST/api/memory/v2/eval/goldenSessionGolden recall suite.

Page: GET /memory (HTML admin). Guide: Memory & RAG · Memory best path.

MethodPathAuthDescription
*/api/settings*, config exportAdmin/operatorConfigStore-backed settings UI
GET/PUT/api/settings/agent/nonstopSession / AdminNon-Stop & Self-Healing watchdog/failover/ledger settings
*Workspace routes /api/workspaces*SessionWorkspaceStore CRUD

Mounted from documents_api.py at /api/documents/*. Thin transport over the shared DocumentIngestionService (no parallel parser path). Tenant/actor come from request context — clients never supply trusted paths for remote intake.

Guide: Document Intelligence · Ops: Document processing · Security: Document security.

MethodPathAuthDescription
POST/api/documentsSessionStreamed upload intake (bounded; 413 on overflow)
POST/api/documents/importSessionWorkspace-safe local file intake
POST/api/documents/generateSessionGenerate + durably ingest (payload ≤ 1 MiB)
GET/api/documentsSessionList documents (tenant/actor scoped)
GET/api/documents/healthSessionParser/OCR/renderer readiness + worker status
POST/api/documents/mergeSessionMerge several documents’ PDFs by opaque IDs
GET/api/documents/{document_id}SessionDetail (versions + jobs + artifacts)
GET/api/documents/{document_id}/versionsSessionVersion list
GET/api/documents/{document_id}/contentSessionPaged normalized/fenced content
GET/api/documents/{document_id}/artifactsSessionDerived artifacts for a document
GET/api/documents/artifacts/{artifact_id}/downloadSessionDownload artifact by opaque ID
POST/api/documents/{document_id}/convertSessionConvert current version to target format
GET/api/documents/{document_id}/pdf-infoSessionStructural PDF report
POST/api/documents/{document_id}/splitSessionSplit page range from PDF version
POST/api/documents/{document_id}/fill-formSessionFill AcroForm fields
POST/api/documents/{document_id}/redactSessionPhysical redact terms → new artifact (no UI confirm on API)
POST/api/documents/{document_id}/indexSessionPublish current version to a Knowledge library
POST/api/documents/{document_id}/unindexSessionRemove from a library
POST/api/documents/searchSessionLibrary search (fenced hits)
GET/api/documents/jobs/{job_id}SessionJob status
GET/api/documents/jobs/{job_id}/eventsSessionAppend-only job event history
POST/api/documents/jobs/{job_id}/cancelSessionCooperative cancel
POST/api/documents/jobs/{job_id}/retrySessionRe-enqueue dead-letter/rejected job
POST/api/documents/{document_id}/deleteSessionTombstone / delete document
MethodPathAuthDescription
GET/api/documents/ops/metricsSessionContent-free metrics snapshot
GET/api/documents/ops/capacitySessionBackpressure snapshot + degraded_reasons
GET/api/documents/ops/readinessSessionMulti-replica honesty (metadata_single_replica, jobs backend)
GET/api/documents/ops/retentionSessionLive retention/GC policy view
GET/api/documents/ops/auditSessionKeyset-paged operational audit (?limit=&before_id=)
POST/api/documents/ops/maintenance/dry-runAdminGC dry-run report
POST/api/documents/ops/maintenance/runAdminGC run after dry-run/confirm in UI

HTML page: GET /documents (session). TUI Documents tab uses the same coordinator.

MethodPathAuthDescription
GET/api/email/statusSessionActive provider, auth modes, presets summary
GET/api/email/accountsSessionMulti-account aliases (env)
GET/api/email/presetsSessionGmail/Microsoft IMAP/POP host presets
POST/api/email/protocol/connectSessionSave IMAP/POP for gmail|microsoft|generic
POST/api/email/protocol/disconnectSessionClear protocol + OAuth tokens for provider
POST/api/email/gmail/connectSessionGmail app-password → IMAP
POST/api/email/gmail/disconnectSessionClear Gmail creds
POST/api/email/oauth/gmail/clientSessionSave Google OAuth client id/secret
GET/api/email/oauth/gmail/start · start.jsonSessionBrowser OAuth redirect / JSON
GET/api/email/oauth/gmail/callbackOpen (OAuth)Token exchange; redirects to Settings
POST/api/email/oauth/microsoft/clientSessionSave Azure app id/secret
GET/api/email/oauth/microsoft/start · start.jsonSessionBrowser OAuth
GET/api/email/oauth/microsoft/callbackOpen (OAuth)Token exchange
POST/api/email/oauth/microsoft/device/start · …/pollSessionDevice-code fallback
POST/api/email/oauth/microsoft/disconnectSessionClear Microsoft tokens

Agent mail ops use tools (email_list, …), not these HTTP routes. Guide: Email integration.

MethodPathAuthDescription
GET/api/x/statusSessionConfigured?, handle, caps. Never returns secrets.
POST/api/x/credentialsSession + CSRFSave four OAuth 1.0a keys (vaulted) + handle + caps.
POST/api/x/testSession + CSRFGET /2/users/me with stored keys.
POST/api/x/disconnectSession + CSRFDelete keys, disable posting.

Tweets themselves go through x_post (always HITL). Guide: X publisher.

MethodPathAuthDescription
WebhooksTelegram/Discord/Slack callbacksAdapter secretsInbound messages + HITL buttons
*/api/gateway/*SessionGateway status/control from CLI
MethodPathAuthDescription
WSVoice routesSessionroutes_voice_ws.py
*Chaos routesKAZMA_CHAOS_ENABLEDDev only
Static/, /chat, /settings, …Cookie/sessionHTML pages

Exact route lists evolve with routers mounted in app.py. For extension points see API & Extension Points.

ModeWhen
Shared secret cookie / headerSingle-operator
Opaque web sessionMulti-user default
Platform RBAC (viewer/operator/admin)SaaS APIs
OIDC PKCESSO login
API token / JWTProgrammatic (where enabled)

See Multi-user SaaS and Environment variables.