Skip to main content

Simulation Mode

When developing and testing your Face Match integration, you can use simulation mode to test different scenarios without performing actual liveness checks. This makes development and testing much faster and more efficient.
Simulation mode is only available in the sandbox environment

How to Use Simulation Mode

To use simulation mode, simply add the simulate query parameter when getting a Face Match session_id. When you navigate to the user with that session, the page will wait for 3 seconds before redirecting with the simulated response, mimicking the real-world flow. The session will redirect with the same error or success case that you specified in the simulate parameter.

Available Simulation Cases

The following simulation cases are available for testing:
  • invalid_session_id - Simulates an invalid session ID error
  • session_id_not_found - Simulates a case where the session ID cannot be found
  • failed_to_get_camera_permission - Simulates a camera permission failure
  • failed_to_complete_face_scan - Simulates a face scan failure
  • failed_to_collect_device_data - Simulates a device data collection failure
  • liveness_check_failed - Simulates a failed liveness check
  • success - Simulates a successful verification

Example Testing Flow

  1. Add the simulate parameter to GET /liveness/session with the case you want to test
  1. Navigate to the Face Match URL like normal and wait 3 seconds
  1. The page will redirect you with the correct error or success message, bypassing any liveness or document checks

Choose the Decision and Score

With simulate=success, you can set the outcome that comes back by adding these optional parameters to GET /liveness/session: When you pass only simulate_decision, risk_score is filled with a typical value: 0.1 for Real, 0.5 for Suspicious and 0.9 for Fake. Values are returned as you send them. Verisoul does not compare the decision to the score or to your project thresholds. If you pass simulate_decision or simulate_risk_score without simulate_risk_flags, risk_flags is an empty list. If you pass none of the three, you receive the default stubbed response (decision Fake). These parameters require simulate=success. A request that sends them with any other simulate value, or an invalid value, returns a 400 with invalid_simulated_session.

Examples

Session Data in Responses

Responses for simulated sessions carry the data of the session you created. The metadata object in /verify-face and in the webhook contains the real project_id, session_id, request_id and timestamp. account_id is the account_id you passed when creating the session, or null. referring_session_id is the referring_session_id you passed, or null. You can match a simulated webhook to your own records the same way you match a real one.

Webhooks

Simulated sessions send the same webhooks as real sessions, to the endpoints subscribed in your project: The webhook is sent when the simulated session finishes, about 3 seconds after the user opens the session URL.

API Responses

When calling the API with sessions that have been simulated you can expect:
  • For success case: You receive a stubbed response that uses the decision, score and flags you set, or the default stub values when you set none. metadata comes from the real session.
  • For all other cases: You receive a 400 response
The error responses in simulation mode may not exactly match the production error responses. They are intended for testing the basic flow of your integration.
This allows you to test your integration’s error handling and success flows without needing to perform actual verifications.