Integration Flow

The complete behavioral scoring flow involves both server-side and SDK calls:

Your Backend                   SDK (on device)               TrustVision API
     |                              |                              |
     |--- POST /v1/register_device -------------------------------->|
     |<--------------- customer_user_device_id --------------------|
     |                              |                              |
     |--- (pass device credentials to SDK) ----------------------->|
     |                              |                              |
     |                              |-- POST /v1/behavior/         |
     |                              |   create_challenge --------->|
     |                              |<---- challenge_id, nonce,    |
     |                              |       server_public_key -----|
     |                              |                              |
     |                              |-- (collect behavioral data)  |
     |                              |                              |
     |                              |-- POST /v1/behavior/         |
     |                              |   push_event_batch --------->|
     |                              |<---- status: success --------|
     |                              |                              |
     |                              |-- (repeat for more batches)  |
     |                              |                              |
     |--- POST /v1/behavior/score --------------------------------->|
     |<------ behavior_score, risk_level, decision -----------------|
  1. Your backend calls POST /v1/register_device to register the user's device and receives a customer_user_device_id.
  2. The SDK uses the device credentials to call POST /v1/behavior/create_challenge, which returns a challenge ID, nonce, and server public key.
  3. The SDK collects behavioral data (touch, typing, sensors) and pushes batches via POST /v1/behavior/push_event_batch.
  4. When the session is complete, your backend calls POST /v1/behavior/score with the challenge ID (and optional transaction_data) to get the behavior score, risk level, and — when the policy check is enabled — the recommended decision.final_action.
  5. On the user's first session, step 4 enrolls the behavioral baseline instead of scoring (more_details.is_first_session: true); real scoring starts from the second session.