Skip to content

Session and user risk

Get a session's risk

GET/v1/collect/sessions/{session_id}/risksecret key

The latest risk state of one of your sessions. Updated each time a typing or mouse window completes.

Request
curl "https://api.behavlabs.com/v1/collect/sessions/8649741cdcf3427eba8259d8b63e2bbb/risk" \
  -H "Authorization: Bearer $BEHAVLABS_SECRET_KEY"
Response
{
  "session_id": "8649741cdcf3427eba8259d8b63e2bbb",
  "user_id": "u_8f3a91",
  "started_at": "2026-11-17T20:52:04+00:00",
  "model": "kvc_c + mouse ft_full_all_s1",
  "status": "alarm",                    // pending | enrolling | monitoring | alarm | unsupported_*
  "risk_level": "high",                 // unknown | normal | elevated | high
  "template": "history",                // session | history
  "windows": 41,                        // 50-key typing windows scored so far
  "keys": 2310,
  "typing_seconds_scored": 512.6,       // active typing after the anchor
  "anchor_complete_at_ms": 61842.0,     // session time when monitoring started
  "last_llr": -4.912,                   // evidence of the latest window, nats (+ same person, - different)
  "mean_llr_last_5": -3.871,
  "detector": "fused",                  // fused (typing + mouse) | mouse (no typing template yet)
  "modalities": {
    "keystroke": { "windows": 41, "keys": 2310, "template": "history", "last_llr": -4.912 },
    "mouse":     { "windows": 18, "strokes": 590, "template": "session", "last_llr": -2.204 }
  },
  "operating_points": {                 // of the detector above
    "strict":    { "alarm": true,  "first_alarm_at_ms": 498210.0, "alarms": 1,
                   "cusum": 0.0,   "threshold": 12.0, "fa_target_per_100h": 1.0 },
    "sensitive": { "alarm": true,  "first_alarm_at_ms": 431977.0, "alarms": 3,
                   "cusum": 2.381, "threshold": 8.0,  "fa_target_per_100h": 10.0 }
  },
  "keystroke_only": { "strict": { "alarm": true }, "sensitive": { } },
  "updated_at": "2026-11-17T21:01:33+00:00",
  "device": {
    "status": "new",                    // first_device | known | known_changed | new | no_fingerprint
    "device_id": "9c1e04b7a2f35d18",
    "match_score": 0.412,               // closest earlier device of this user, 0 to 1
    "closest_device_id": "3f7a90c2e1b84d65",
    "changed": ["canvas", "gl_renderer", "audio", "fonts", "screen", "os"],
    "flags": [],                        // automation | canvas_randomized | few_components
    "components": 27, "user_devices": 2
  },
  "network": {
    "ip": "198.51.100.23",
    "known_ip": false, "known_subnet": false,
    "previous_ip": "203.0.113.7", "user_ips": 3, "first_session": false,
    "asn": 7018, "as_org": "ATT-INTERNET4 - AT&T Enterprises, LLC", "as_country": "US",
    "known_asn": true, "user_asns": 2, "hosting": false
  }
}

first_alarm_at_ms and anchor_complete_at_ms are session time (milliseconds since the SDK started on the page). cusum resets to 0 after each alarm; alarms counts them. See How scoring works for the fields and Device and network for device and network.

Get a user's recent risk

GET/v1/collect/users/{user_id}/risk?limit=20secret key

The risk objects of the user's most recent sessions, newest first (limit 1 to 100, default 20).