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 thesimulate 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 errorsession_id_not_found- Simulates a case where the session ID cannot be foundfailed_to_get_camera_permission- Simulates a camera permission failurefailed_to_complete_face_scan- Simulates a face scan failurefailed_to_collect_device_data- Simulates a device data collection failureliveness_check_failed- Simulates a failed liveness checksuccess- Simulates a successful verification
Example Testing Flow
- Add the
simulateparameter to GET /liveness/session with the case you want to test
- Navigate to the Face Match URL like normal and wait 3 seconds
- The page will redirect you with the correct error or success message, bypassing any liveness or document checks
Choose the Decision and Score
Withsimulate=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. Themetadata 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
successcase: You receive a stubbed response that uses the decision, score and flags you set, or the default stub values when you set none.metadatacomes 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.
