API Specification: MLambda.Data

Authentication

JWT Bearer tokens with BEAM-derived role claims.

Token Structure

{
  "sub": "user-id",
  "app": "application-identifier",
  "roles": ["cluster-operator", "platform-engineer", "database-developer", "application-client"],
  "zone": "command-center|work-surface|observatory",
  "jti": "unique-token-id",
  "iat": 1234567890,
  "exp": 1234567890
}

Authentication Flow

  1. POST /api/auth/login with { userId, appId, roles[] } (anonymous)
  2. Server validates roles against BEAM Human Roles table
  3. Server issues JWT with roles and derived zone claims
  4. Client sends JWT in Authorization: Bearer {token} header
  5. Gateway validates JWT and checks roles claim against endpoint authorization

Roles (from BEAM Human Boundary Map)

| Role | Zone | Screens | |——|——|———| | cluster-operator | command-center | NodeTopologyGate, TokenRebalanceApproval, CompactionStrategyApproval | | database-developer | work-surface | SchemaConflictResolver, SchemaVersionHistory | | platform-engineer | command-center | StorageExceptionQueue, SnapshotWorkflow, ClusterStrategyReview | | application-client | observatory | Data API only |

REST Endpoints

Authentication

| Method | Path | Auth | Purpose | |——–|——|——|———| | POST | /api/auth/login | Anonymous | Issue JWT token |

Table Management (Actor: P2 SchemaRegistry, A1 ClientGateway)

| Method | Path | Auth Roles | Actor | Purpose | |——–|——|————|——-|———| | POST | /api/tables | cluster-operator, database-developer | P2 SchemaRegistry | Create table | | DELETE | /api/tables/{name} | cluster-operator, database-developer | P2 SchemaRegistry | Drop table | | GET | /api/tables | cluster-operator, database-developer, application-client | P2 SchemaRegistry | List tables | | POST | /api/tables/{name}/write | application-client, database-developer | A1 ClientGateway | Write record | | POST | /api/tables/{name}/read | application-client, database-developer | A1 ClientGateway | Read record | | POST | /api/tables/{name}/delete | application-client, database-developer | A1 ClientGateway | Delete record | | POST | /api/tables/{name}/rows | application-client, database-developer | A1 ClientGateway | The table’s rows in key order, a page at a time: {pageToken?, pageSize? (100, at most 1000)} answers {rows, nextPageToken} (null on the last page) | | POST | /api/tables/{name}/writeIf | application-client, database-developer | A1 ClientGateway | Write only if the record is as it was read (expectedTimestamp, 0: absent); answers {"written": bool} | | POST | /api/tables/{name}/deleteIf | application-client, database-developer | A1 ClientGateway | Delete only if the record is as it was read; answers {"written": bool} |

SQL

| Method | Path | Auth Roles | Actor | Purpose | |——–|——|————|——-|———| | POST | /api/sql | cluster-operator, database-developer, platform-engineer | Sql.Session | A statement: {sql, database, explain?, dryRun?, confirm?, maxRows? (1000, at most 10000), pageToken?}; a SELECT past maxRows answers its first rows with nextPageToken, sent back with the same statement for the rows after them (offset says where a page starts) |

Cluster Management (Actor: A5 RingManager, A4 ClusterAdapter)

| Method | Path | Auth Roles | Actor | Purpose | |——–|——|————|——-|———| | GET | /api/cluster/ring | cluster-operator, platform-engineer | A5 RingManager | Ring status | | GET | /api/cluster/members | cluster-operator, platform-engineer | A4 ClusterAdapter | List members | | POST | /api/cluster/repair | cluster-operator, platform-engineer | Distributed.Repair | Repair every table now; answers what was done (said) | | POST | /api/cluster/ring | cluster-operator, platform-engineer | Distributed.Coordinator | Move the ring to {"nodes": "a;b;c"} (one node joins, leaves or is replaced; 409 OneAtATime otherwise); the ring it is on calls off a move that stopped halfway | | POST | /api/cluster/reseal | cluster-operator, platform-engineer | Distributed.Coordinator | Every node’s files written again under its current data key (409 NoDataKey when it has none) | | GET | /api/cluster/keys | cluster-operator, platform-engineer | Distributed.Coordinator | Each node’s files counted by data key; older: those under another key or plain (0: an older key may be dropped) |

Metrics (Actor: C1 MetricsCollector)

| Method | Path | Auth Roles | Actor | Purpose | |——–|——|————|——-|———| | GET | /api/metrics | cluster-operator, platform-engineer, database-developer | C1 MetricsCollector | Query metrics |

Approvals (Boundary Actors: M1, P1, P2, P3, C2, M2)

| Method | Path | Auth Roles | Actor | Purpose | |——–|——|————|——-|———| | GET | /api/approvals | cluster-operator, platform-engineer, database-developer | Multiple | Pending approvals | | POST | /api/approvals/{id}/respond | cluster-operator, platform-engineer | M1 ClusterGuardian | Submit response | | GET | /api/rebalance/{id} | cluster-operator | P1 TokenAssignment | Rebalance proposal | | POST | /api/rebalance/{id}/respond | cluster-operator | P1 TokenAssignment | Approve/reject | | GET | /api/schema/conflicts | database-developer, cluster-operator | P2 SchemaRegistry | List conflicts | | POST | /api/schema/conflicts/{id}/resolve | database-developer | P2 SchemaRegistry | Resolve conflict | | GET | /api/ring/alerts | cluster-operator, platform-engineer | C2 RingMonitor | Ring alerts | | POST | /api/ring/alerts/{id}/respond | cluster-operator, platform-engineer | C2 RingMonitor | Respond | | GET | /api/storage/escalations | platform-engineer | M2 StorageGuardian | Storage issues | | POST | /api/storage/escalations/{id}/resolve | platform-engineer | M2 StorageGuardian | Resolve |

Snapshots (Actor: A22 SnapshotActor)

| Method | Path | Auth Roles | Actor | Purpose | |——–|——|————|——-|———| | POST | /api/snapshots | platform-engineer | A22 Snapshot | Create snapshot |

| Method | Path | Auth Roles | Purpose | |——–|——|————|———| | GET | /api/navigation/layout | Any authenticated | Three-zone layout per role |

Health

| Method | Path | Auth | Purpose | |——–|——|——|———| | GET | /health | Anonymous | Service health check |

WebSocket Channels (SignalR Hubs)

All WebSocket endpoints require JWT authentication via access_token query parameter.

Path Data Source Actor Target Screens Protocol
/ws/metrics Real-time MetricReport stream C1 MetricsCollector ClusterOverview, PartitionHeatmap SignalR
/ws/ring Ring topology + node status updates A5 RingManager RingHealthDashboard SignalR
/ws/cluster Cluster member status updates A4 ClusterAdapter ClusterOverview SignalR
/ws/alerts Approval requests, escalations M1, P1, P2, P3, C2, M2 All Command Center screens SignalR
/ws/compaction CompactionProgress updates A12 CompactionExecutor CompactionProgress SignalR

Boundary Timeout Configuration (BEAM Step 4.6)

Boundary Timeout Default Action HTTP Header
M1 Node Topology Gate 60 min Reject X-Boundary-Timeout-Seconds: 3600
P1 Token Rebalance Override 30 min Conservative auto-execute X-Boundary-Timeout-Seconds: 1800
P2 Schema Conflict Escalation 60 min Latest-timestamp-wins X-Boundary-Timeout-Seconds: 3600
P3 Compaction Strategy Override 15 min Apply recommendation X-Boundary-Timeout-Seconds: 900
C2 Ring Monitor Gate 4 hr Alert only X-Boundary-Timeout-Seconds: 14400
M2 Storage Escalation 30 min Isolate partition X-Boundary-Timeout-Seconds: 1800

Error Responses

All error responses use the standard format:

{
  "error": "ErrorType",
  "message": "Human-readable description",
  "requestId": "correlation-id"
}
HTTP Status Error Type Description
400 InvalidRequest Malformed request body or invalid parameters
401 Unauthorized Missing or invalid JWT token
403 Forbidden Valid token but insufficient role
404 NotFound Resource not found
408 Timeout Actor did not respond within timeout
500 InternalError Unexpected server error
503 ServiceUnavailable Actor system not ready

Traceability Matrix (BEAM Step 4.7)

Screen Boundary API Endpoint Actor Modal Rules
NodeTopologyGate M1 Gate POST /api/approvals/{id}/respond ClusterGuardian R_M1.1, R_M1.2, R_M1.3
TokenRebalanceApproval P1 Override POST /api/rebalance/{id}/respond TokenAssignment R_P1.2, R_P1.3, R_P1.4
CompactionStrategyApproval P3 Override POST /api/approvals/{id}/respond CompactionPlanner R_P3.2
SchemaConflictResolver P2 Escalation POST /api/schema/conflicts/{id}/resolve SchemaRegistry –
SnapshotWorkflow A22 Delegation POST /api/snapshots Snapshot –
RingHealthDashboard C2 Gate POST /api/ring/alerts/{id}/respond + /ws/ring RingMonitor –
StorageExceptionQueue M2 Escalation POST /api/storage/escalations/{id}/resolve StorageGuardian –
ClusterOverview Observation GET /api/cluster/members + /ws/metrics MetricsCollector + ClusterAdapter R4.1, R4.2, R4.3
PartitionHeatmap Observation GET /api/metrics + /ws/metrics MetricsCollector –
CompactionProgress Observation /ws/compaction CompactionExecutor –

Three-Zone UI Layout

Zone Architecture

  • Command Center (real-time): Gate decision forms, exception queues, WebSocket live updates
  • Work Surface (periodic): Review dashboards, delegation wizards, data entry forms
  • Observatory (passive): Live dashboards, override monitors, system health views

Cluster Operator: [Cluster] > Topology* | Ring | Members; [Tables] > Heatmap | Schemas; [Storage] > Compaction* | Disk

Database Developer: [Schema] > Conflicts* | Versions | Definitions; [Performance] > Heatmap | Latency

Platform Engineer / SRE: [Dashboard] > Overview | Ring | Compaction; [Alerts] > Storage* | Ring*; [Operations] > Snapshots | Config Review | Repairs

* = pending count badge from /ws/alerts WebSocket channel