Skip to content

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

  1. Start a session: POST /v2/sessions returns data.session_id.
  2. Liveness: POST /v2/liveness with the video and session_id. This video becomes the session’s media.
  3. Face and voice verification on the same media: POST /v2/face-verify and POST /v2/voice-verify with session_id and either the same file again or use_session_video: true (no upload). For onboarding against an identity document, run face match here too, on the same media.
  4. Enroll from the session video if this is onboarding (face enrollment with use_session_video). Do it before ending the session.
  5. End the session: POST /v2/sessions/{id}/end. The response carries the session’s decision. Act on it.
# 1. start
curl -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 video
curl '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 again
curl '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 result
curl -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 end has been called, every call that names the session is refused with 409 and the code session_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 end again returns the decision stored by the first call. It does not rescore, so a later call cannot turn a reject into an accept.
  • 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 400 with the code media_mismatch. Send the same file again, or set use_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 returns refer instead of pass, with the reason not 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 409 and the code liveness_not_passed when the last liveness check did not pass, and face_match_failed when 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, end returns reject.
{
"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:

Casedecision.statusdecision.reasons
A result comes from media other than the liveness check’srejectmedia mismatch: results come from different media than the liveness check, then <service> was not produced from the liveness media per result
A critical check failedrejectThe 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 resultrefersession 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 ranfrom the score: accept, refer or rejectWhat the scoring system reports

Then a face match that ran in the session is counted, after the cases above:

Face matchEffect on decision.statusAdded to decision.reasons
passnonenothing
failrejectFace Match failed, then the failed conditions as Face Match: …
refer, or no result because the face match failed to runaccept becomes refer; refer and reject stayFace 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 a reject, start a new session for the next attempt. Never reuse an ended session; it answers 409 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) → pass
face-verify (A) → pass
liveness (video B) → pass meta.warnings: "… Face Recognition result was discarded …"
voice-verify (B) → pass
end → 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 check

The right order. Every identity step runs after the last liveness check, on its media:

liveness (video A) → fail (poor capture)
liveness (video B) → pass
face-verify (B) → pass (or use_session_video)
voice-verify (B) → pass (or use_session_video)
end → accept