Benefit Calculator BLoC
API Contract
REST
/api/v1/benefit-calculator-sessions
5 endpoints
GET
/api/v1/benefit-calculator-sessions/api/v1/benefit-calculator-sessions
List all calculator sessions (state snapshots per user/mentor)
Public
Response Example
{
"data": [
{
"session_id": "session_c4b7e2d1",
"mentor_id": "mentor_001",
"state": "loaded",
"last_event": "CalculateRequested",
"result_id": "calc_7f3a2b1c",
"created_at": "2026-03-26T09:00:00Z",
"updated_at": "2026-03-26T09:15:00Z"
}
],
"pagination": {
"page": 1,
"limit": 20,
"total": 1
}
}
GET
/api/v1/benefit-calculator-sessions/api/v1/benefit-calculator-sessions/:session_id
Get a specific calculator session state snapshot
Public
Response Example
{
"session_id": "session_c4b7e2d1",
"mentor_id": "mentor_001",
"state": "loaded",
"last_event": "CalculateRequested",
"result_id": "calc_7f3a2b1c",
"created_at": "2026-03-26T09:00:00Z",
"updated_at": "2026-03-26T09:15:00Z"
}
POST
/api/v1/benefit-calculator-sessions/api/v1/benefit-calculator-sessions
Initialise a new calculator session for a mentor
Public
Request Example
{
"mentor_id": "mentor_001",
"organisation_id": "org_42"
}
Response Example
{
"session_id": "session_e9a3f1c8",
"mentor_id": "mentor_001",
"state": "initial",
"last_event": null,
"result_id": null,
"created_at": "2026-03-26T09:00:00Z",
"updated_at": "2026-03-26T09:00:00Z"
}
PUT
/api/v1/benefit-calculator-sessions/api/v1/benefit-calculator-sessions/:session_id
Dispatch an event to the BLoC session (e.g. CalculateRequested, ShareRequested)
Public
Request Example
{
"event": "CalculateRequested",
"payload": {
"sessions": 25,
"avg_minutes": 30,
"cost_per_session": 3.5,
"cost_per_hour": 30
}
}
Response Example
{
"session_id": "session_e9a3f1c8",
"mentor_id": "mentor_001",
"state": "loaded",
"last_event": "CalculateRequested",
"result_id": "calc_9d1e4f2a",
"created_at": "2026-03-26T09:00:00Z",
"updated_at": "2026-03-26T09:15:00Z"
}
DELETE
/api/v1/benefit-calculator-sessions/api/v1/benefit-calculator-sessions/:session_id
Close and discard a calculator session
Public
Response Example
{
"deleted": true,
"session_id": "session_c4b7e2d1"
}