Start Session
A user begins a new capture session from the wearable or mobile app; the server allocates a session record and returns a session ID that is used for all subsequent frame and audio uploads.
Flow
-
User presses record — The mobile app (or wearable SDK) sends a
POSTrequest to/sessions/startwith an optional JSON body{ "captureMode": "audio_video" | "audio_only" }. The request is authenticated via a Cognito JWT. -
Authentication — The Lambda extracts
user_idfrom the Cognito JWT claims (sub). Missing or emptyuser_idreturns HTTP 401. -
Capture mode resolution — The
captureModefield from the request body is validated. Any unrecognized value falls back to"audio_video". -
Session record creation — A new UUID is generated and a DynamoDB item is written to the sessions table with:
sessionId,userId,captureModeframeCount: 0,currentFrameWindow: 0status: "active"-
createdAt(ISO 8601 UTC) -
Response — Returns HTTP 200 with
{ "sessionId": "<uuid>" }. The client stores this ID and attaches it to every subsequent frame/audio upload request.
Entry Point
- Lambda:
main/server/api/sessions/start/app.py→lambda_handler - HTTP method:
POST /sessions/start(API Gateway, Cognito-authenticated)
Dependencies
- DynamoDB table:
SESSIONS_TABLE_NAME(defaultencache-sessions) - AWS Cognito JWT authorizer (via API Gateway)
Error Cases
| Condition | Response |
|---|---|
| Missing Cognito claims / user_id | 401 Unauthorized |