Sessions
A session is one verification attempt by one person. You start it, run the
steps of the attempt with its session_id, and end it. Ending the session
scores the session’s liveness, face-verify and voice-verify results together,
and its face match when one ran, and returns the session’s decision: that
decision is the verification result.
This page explains the flow and its rules. The endpoints themselves are on Sessions and Verification.
The flow
- Start a session:
POST /v2/sessionsreturnsdata.session_id. - Liveness:
POST /v2/livenesswith the video andsession_id. This video becomes the session’s media. - Face and voice verification on the same media:
POST /v2/face-verifyandPOST /v2/voice-verifywithsession_idand either the same file again oruse_session_video: true(no upload). For onboarding against an identity document, run face match here too, on the same media. - Enroll from the session video if this is onboarding
(face enrollment
with
use_session_video). Do it before ending the session. - End the session:
POST /v2/sessions/{id}/end. The response carries the session’s decision. Act on it.
# 1. startcurl -X POST 'https://api.biometrysolutions.com/api-gateway/v2/sessions' \ -H 'Authorization: Bearer YOUR_API_TOKEN'# → { "data": { "session_id": "sess_fe402c29-…" }, … }
# 2. liveness on the captured videocurl 'https://api.biometrysolutions.com/api-gateway/v2/liveness' \ -H 'Authorization: Bearer YOUR_API_TOKEN' \ --form 'request={"user_id":"user-123","session_id":"sess_fe402c29-…","phrase":"48719352"}' \ --form 'video=@"video.mp4"'
# 3. face and voice on the same video, without uploading it againcurl 'https://api.biometrysolutions.com/api-gateway/v2/face-verify' \ -H 'Authorization: Bearer YOUR_API_TOKEN' \ --form 'request={"user_id":"user-123","session_id":"sess_fe402c29-…","use_session_video":true}'curl 'https://api.biometrysolutions.com/api-gateway/v2/voice-verify' \ -H 'Authorization: Bearer YOUR_API_TOKEN' \ --form 'request={"user_id":"user-123","session_id":"sess_fe402c29-…","phrase":"48719352","use_session_video":true}'
# 5. end: the decision here is the verification resultcurl -X POST 'https://api.biometrysolutions.com/api-gateway/v2/sessions/sess_fe402c29-…/end' \ -H 'Authorization: Bearer YOUR_API_TOKEN'{ "decision": { "status": "accept", "score": 0.93 }, "meta": { "request_id": "fc5605c5-…", "message": "session ended successfully" }}Step decisions and the session decision
Each step returns its own decision with pass, fail or refer. It covers
only that step: a face-verify pass says the face matched, not that the
person was live. The decision from end uses a different vocabulary,
accept, refer or reject, and covers the session’s liveness, face-verify
and voice-verify results together, scored against the session’s
scoring system. A face match that ran in the
session counts too: a failed match makes the session reject. A session
without a face match is decided on the other results alone.
Grant access only on the session’s accept. Treat refer as “not proven”
(manual review or a step-up check) and reject as a failure.
Rule 1: a session is single-use and lasts 24 hours
- Once
endhas been called, every call that names the session is refused with409and the codesession_ended. This covers the steps, consent records, deepfake checks and enrollments. - A session more than 24 hours old is refused the same way with
session_expired. Sessions left open are closed by a cleanup job. - Calling
endagain returns the decision stored by the first call. It does not rescore, so a later call cannot turn arejectinto anaccept. - Enrolling from the session video needs an open session: enroll before you
call
end.
{ "error": { "code": "session_ended", "message": "session has ended; start a new session" }, "meta": { "request_id": "…" } }Rule 2: face and voice must use the liveness media
Liveness proves a live person is in this video. Face and voice verification only prove something about that person if they run on the same video. Otherwise someone could pass liveness with their own face and face-verify with a photo of the victim.
The same applies to face match and to enrolling from the session video.
- Other media is refused. A face-verify, voice-verify or face match call in
the session whose file differs from the liveness file gets
400with the codemedia_mismatch. Send the same file again, or setuse_session_video. - A step without a passing liveness says
refer. A face-verify, voice-verify or face match that is not bound to a passing liveness check on the same media in this session returnsreferinstead ofpass, with the reasonnot bound to a passing liveness check on the same media in this session. - A new liveness check replaces the media. It discards the session’s earlier
face, voice and face match results. The liveness response names each one in
meta.warnings; run face-verify, voice-verify and face match again after the last liveness check. - Only a passing liveness video can be enrolled. Enrolling from the session
video is refused with
409and the codeliveness_not_passedwhen the last liveness check did not pass, andface_match_failedwhen a face match on that video failed. - Mixed media at the end is rejected. If any result in the session comes
from media other than the liveness check’s,
endreturnsreject.
{ "data": { "…": "…" }, "decision": { "status": "pass" }, "meta": { "request_id": "…", "warnings": [ "this liveness check replaced the session's media, so the earlier Face Recognition result was discarded; run face-verify again on this media" ] }}Reading the session decision
end decides in this order, and the first case that applies wins:
| Case | decision.status | decision.reasons |
|---|---|---|
| A result comes from media other than the liveness check’s | reject | media mismatch: results come from different media than the liveness check, then <service> was not produced from the liveness media per result |
| A critical check failed | reject | The failed check, then one line per step that did not run (below). A missing step cannot change a failure, so this is reject even when a step is missing |
| A critical step has no result | refer | session incomplete: a required verification step did not run, then per service: <service> produced no result (the step never ran) or <service> result was discarded by a later liveness check; run face-verify after the last liveness check (voice-verify for Voice Recognition) |
| Every required step ran | from the score: accept, refer or reject | What the scoring system reports |
Then a face match that ran in the session is counted, after the cases above:
| Face match | Effect on decision.status | Added to decision.reasons |
|---|---|---|
pass | none | nothing |
fail | reject | Face Match failed, then the failed conditions as Face Match: … |
refer, or no result because the face match failed to run | accept becomes refer; refer and reject stay | Face Match was referred and its reasons, or Face Match produced no result |
The session keeps only its latest face match. A face match on media other
than the liveness check’s is a mixed-media reject (first row of the table
above).
<service> is the service’s name, for example Face Recognition or
Voice Recognition. Which checks are critical, and which run at all, comes from
the session’s scoring system: a service that is not active in it is not
required.
A single step lists reasons only for the services that endpoint runs:
face-verify does not report on Active Speaker Detection. A service the
endpoint runs but your API key doesn’t have enabled still appears, as
… not enabled on this API key.
Retries
- Within a session, you can repeat liveness if the capture was poor. Then run face-verify, voice-verify and face match again on the new media before ending.
- After
end, or after areject, start a new session for the next attempt. Never reuse an ended session; it answers409 session_ended.
Example: the wrong order and the right one
The wrong order. The second liveness check discards the face result, and face verification never runs on the new video:
liveness (video A) → passface-verify (A) → passliveness (video B) → pass meta.warnings: "… Face Recognition result was discarded …"voice-verify (B) → passend → refer session incomplete: a required verification step did not run Face Recognition result was discarded by a later liveness check; run face-verify after the last liveness checkThe right order. Every identity step runs after the last liveness check, on its media:
liveness (video A) → fail (poor capture)liveness (video B) → passface-verify (B) → pass (or use_session_video)voice-verify (B) → pass (or use_session_video)end → accept