Architecture & API8 min read
Complete REST & SSE API Reference
Interactive reference for all /api/v1 endpoints: Auth, Users, Charts, Batch Jobs SSE, Regression Datasets, Skills, Knowledge Space, Settings & System.
Authentication & Quick Integration
REST v1 + SSE- All endpoints are mounted under
/api/v1. - Authenticate using
Authorization: Bearer <jwt>or staticX-API-Key: sk_amd_...header. - SSE streams and export downloads (
/events,/download) also accept?token=<jwt>. readonlytokens receive HTTP403 Forbiddenon any mutating route.
Code a Clinical Chart via Static API Key
bash
curl -X POST https://atreyamd.hospital.internal/api/v1/charts/code \
-H "Content-Type: application/json" \
-H "X-API-Key: sk_amd_your_static_key_here" \
-d '{
"chart_id": "ENC-2026-00419",
"chart_text": "DISCHARGE SUMMARY: Acute on chronic systolic heart failure exacerbation with essential hypertension and stage 3b CKD.",
"department": "inpatient_medicine",
"client_id": "acme_health",
"insurer_id": "medicare_cms",
"encounter_type": "inpatient"
}'Interactive Endpoint Directory
- Filter across all 9 endpoint groups or by required RBAC role (
Public,readonly,admin).
| Method & Path | Group | Min Role | Description |
|---|---|---|---|
POST/api/v1/auth/login | Auth | Public | Authenticate username/password → signed HS256 Bearer token + profile (incl. own api_key). |
GET/api/v1/auth/me | Auth | readonly | Return current authenticated user & own static API key. |
POST/api/v1/auth/change-password | Auth | readonly | Rotate own password & clear must_change_password flag. |
POST/api/v1/auth/api-key | Auth | readonly | Generate single immutable static API key (sk_amd_...; 409 if already exists). |
GET/api/v1/users | Users | admin | List all users (masked API key prefixes only). |
POST/api/v1/users | Users | admin | Create admin or readonly account. |
PUT/api/v1/users/{user_id} | Users | admin | Update display name, role, active flag, or reset password. |
DELETE/api/v1/users/{user_id} | Users | admin | Delete user (blocks self-delete or removing last active admin). |
POST/api/v1/charts/code | Charts | admin | Code single clinical chart → billable codes, verbatim spans & 6-stage Explainability DAG. |
GET/api/v1/charts/explain/{run_id} | Charts | readonly | Fetch persisted Explainability DAG trace by run_id. |
POST/api/v1/jobs/preview | Batch Jobs | admin | Stream-preview CSV/TSV/Parquet/JSONL schema & auto column mapping. |
POST/api/v1/jobs | Batch Jobs | admin | Create & enqueue durable checkpointed batch job from staged upload. |
GET/api/v1/jobs | Batch Jobs | readonly | List all batch jobs with progress counters & dataset F1 metrics. |
GET/api/v1/jobs/{job_id}/events | Batch Jobs | readonly | Live Server-Sent Events (SSE) progress stream. |
GET/api/v1/jobs/{job_id}/results | Batch Jobs | readonly | Paginated coded chart rows + Explainability DAGs + chart metrics. |
GET/api/v1/jobs/{job_id}/download | Batch Jobs | readonly | Export coded job output as parquet, csv, or jsonl. |
POST/api/v1/jobs/{job_id}/retry-failed | Batch Jobs | admin | Resume only failed checkpoints without re-billing succeeded charts. |
POST/api/v1/jobs/{job_id}/cancel | Batch Jobs | admin | Cancel active batch job cleanly. |
DELETE/api/v1/jobs/{job_id} | Batch Jobs | admin | Delete batch job and cascade checkpoints. |
GET/api/v1/datasets | Regression Datasets | readonly | List editable ground-truth regression datasets. |
POST/api/v1/datasets/upload | Regression Datasets | admin | Upload CSV/TSV/Parquet/JSONL containing expected_codes ground truth. |
PUT/api/v1/datasets/{dataset_id}/rows/{row_id} | Regression Datasets | admin | Inline-edit chart text or expected ICD-10-CM codes. |
POST/api/v1/datasets/{dataset_id}/run | Regression Datasets | admin | Run dataset as scored evaluation batch computing Micro/Macro F1. |
GET/api/v1/skills | Skills (.md) | readonly | List .md skills grouped by scope (global, client, department, insurer). |
POST/api/v1/skills/validate | Skills (.md) | readonly | Validate YAML frontmatter & hard_rules schema live. |
POST/api/v1/skills/eval | Skills (.md) | admin | Run 'CI for .md' draft vs production regression benchmark. |
PUT/api/v1/skills/{scope}/{name} | Skills (.md) | admin | Publish new SHA-256 versioned skill & invalidate exact chart cache. |
GET/api/v1/skills/{scope}/{name}/diff | Skills (.md) | readonly | Return unified diff between any two SHA-256 skill versions. |
POST/api/v1/skills/{scope}/{name}/rollback | Skills (.md) | admin | 1-click rollback to any prior skill version. |
GET/api/v1/vector/stats | Knowledge Space | readonly | Catalog stats, embedding model/dim alignment, chapters & KG counts. |
POST/api/v1/vector/search | Knowledge Space | readonly | Hybrid RRF, BM25 lexical, or Dense Vector top-K ICD-10-CM search. |
POST/api/v1/vector/embeddings-3d | Knowledge Space | readonly | 3D SVD PCA cluster projection + multi-query directional vectors & cosine angles. |
GET/api/v1/vector/kg/subgraph | Knowledge Space | readonly | 1-hop / 2-hop ICD Knowledge Graph subgraph around any code. |
PUT/api/v1/vector/nodes/{code} | Knowledge Space | admin | Create/edit live Knowledge overlay & update index. |
POST/api/v1/vector/ingest-bundle | Knowledge Space | admin | Stream SHA-256 verified pre-embedded .csv.gz bundle into PostgreSQL. |
POST/api/v1/vector/reload | Knowledge Space | admin | Hot-reload DB catalog + overlays + rebuild BM25 & KG indexes. |
GET/api/v1/icd/code/{code} | ICD & Memory | readonly | Tabular node details + recursive billable children lookup. |
POST/api/v1/icd/validate | ICD & Memory | readonly | Execute Zero-LLM CMS Compliance Validator directly on any code list. |
GET/api/v1/memory | ICD & Memory | readonly | List tenant-isolated (client_id, insurer_id) episodic coder overrides. |
POST/api/v1/memory | ICD & Memory | admin | Add tenant-scoped episodic lesson. |
GET/api/v1/settings | Settings & System | readonly | Fetch LLM profiles, object storage, privacy/tools & MCP configs. |
POST/api/v1/settings/mcp/{id}/discover | Settings & System | admin | Run JSON-RPC tools/list discovery on a connected company MCP server. |
GET/api/v1/system/health | Settings & System | Public | Liveness probe (status, version, environment, auth_enabled). |
GET/api/v1/system/status | Settings & System | readonly | Runtime telemetry, DB/Redis/storage backends, ICD counts & license status. |
POST/api/v1/system/license | Settings & System | admin | Hot-install a renewed signed Ed25519 .lic file with zero downtime. |
GET/api/v1/system/audit-logs | Settings & System | readonly | Inspect tamper-evident SHA-256 hash-chained HIPAA audit trail. |