Skip to main content

Session Bootstrap API

Overview

The widget uses ingestion-side sessions to bind the browser tab to a district and preload the latest available report context.

Direct ingestion paths:

  • POST /sdac/sessions
  • GET /sdac/sessions/{session_id}

Widget same-origin paths:

  • POST /api/ingestion/sdac/sessions
  • GET /api/ingestion/sdac/sessions/{session_id}

Authentication and Access Model

These ingestion routes do not perform APIM bearer-token or subscription-key validation themselves.

  • Browser clients should call the widget same-origin proxy at /api/ingestion/sdac/sessions....
  • Direct /sdac/sessions... access should stay behind private networking, host-application controls, or reverse-proxy authentication.
  • Do not expose these routes directly to untrusted browser clients.

Create or Resume Session

AttributeValue
EndpointPOST /sdac/sessions
Content-Typeapplication/json
ResponseJSON

Request

{
"district_id": "12345",
"user_id": "auditor-001",
"user_email": "auditor@state.gov",
"user_name": "Alex Auditor",
"user_role": "State Auditor"
}
FieldTypeRequiredDescription
district_idstringYesHost application district identifier
user_idstringNoUser identifier
user_emailstringNoUser email
user_namestringNoDisplay name
user_rolestringNoRole label

Response

{
"session_id": "4ad3e575-5d75-48ea-b010-6d09136f8177",
"district_id": "12345",
"expires_at": "2026-03-30T22:12:00.000Z",
"is_new": true,
"report_id": "8201EDC2-2EDE-4CA1-AF44-D0F5AA185CDB",
"district_name": "Maplewood Richmond Heights",
"quarter": "Q1",
"year": 2026
}
FieldDescription
session_idSession identifier persisted by the client
expires_atSession expiry timestamp
is_newWhether the request created a new session
report_idLatest resolved report for the district when available
district_nameResolved district display name when available
quarterLatest resolved quarter when available
yearLatest resolved year when available

Notes

  • The service may resume an active district-scoped session instead of creating a new one.
  • Session creation also attempts to resolve or ingest the latest report for the district by using the District Sync API.
  • Session TTL is currently eight hours by default and is extended on access.

Side Effects

  • If an active session already exists for the same district_id and user_id pair, the service reuses it and extends its expiry.
  • If no active session exists, the service inserts a new session row in the ingestion database.
  • After creating or resuming the session, the service attempts a district sync to resolve report_id, district_name, quarter, and year. A sync failure does not fail the session response; it leaves those fields null or omitted.

Error Cases

StatusDescription
200Session created or resumed successfully
500Session persistence failed before a session response could be returned

Validate Session

AttributeValue
EndpointGET /sdac/sessions/{session_id}
ResponseJSON

Path Parameters

ParameterTypeRequiredDescription
session_idstringYesSession identifier returned by the create route

Success Response

{
"session_id": "4ad3e575-5d75-48ea-b010-6d09136f8177",
"district_id": "12345",
"user_id": "auditor-001",
"user_email": "auditor@state.gov",
"user_name": "Alex Auditor",
"user_role": "State Auditor",
"expires_at": "2026-03-30T22:12:00.000Z"
}

Expired or Missing Session

{
"error": "Session not found or expired"
}

This returns 404.

Side Effects

  • Successful validation touches LastAccessedUtc and extends the session expiry window.

Error Cases

StatusDescription
200Session exists, is active, and its expiry was extended
404Session was missing, inactive, or expired
500Session lookup failed unexpectedly