Get Active Session
GET/api/v1/devices/:device_uuid/active-session
Get the open DeviceSession for the device's current shift.
Returns 200 + DeviceSessionOut when the device has an open session (ended_at IS NULL). Returns 404 when the device is not currently on shift (shift_status='off').
Lazy-creates a session row for legacy in-flight v1.19 shifts (device.shift_status='active' but no open DeviceSession row), using device.shift_started_at as the started_at value. This reconciliation is idempotent: a second call returns the same session row.
Role scoping (via get_device_with_permission):
- field_worker: only own device (other device → 404)
- manager/owner: any workspace device
Request
Responses
- 200
- 401
- 403
- 404
- 422
OK
Unauthorized
Forbidden
Not Found
Validation Error