Check a selfie for liveness
Checks one selfie for liveness: whether the face in it is a real person in front of the camera, or a printed photo or a screen held up to it. Upload the photo first with POST /api/kyc/upload (multipart, type selfie, JPEG, PNG or WebP), then send the mediaId it returns as selfieMediaId within 30 minutes. The upload must be your own, in the same environment, and not already used by a verification.
Toden’s passive liveness model reads the face, as it reads a verification’s selfie. The phone detector looks for a phone touching the face, and the photo is measured for glare, a screen-like pattern, straight edges framing the face, focus, light and how the face is turned.
A single still is weaker evidence than a live capture. A verification also scores a short clip and can ask for head movements, which a photo cannot show, so a good print or a high-quality screen can pass a photo check that a live capture would catch. Use this check to screen a photo you already hold, not in place of liveness on a live capture.
The outcome is pass when the model reads a live face, fail when it reads an attack below the confident-attack line, and review for an attack above that line or a phone seen touching the face. A photo with no face, or a deployment that cannot run the model, is unavailable (failureCode no_face or model_unavailable) and is not charged.
Outside production the model runs for real on your photo, at no charge. There are no test photos with fixed answers.
Rules: send rules to set what each finding does (decline fails the check, review sends it to review, approve keeps it as a note and passes) and to change the check’s settings. Anything left out takes your organisation’s saved default rules (set in Spot Checks), else Toden’s, which judge the check as it was judged before rules existed. result.rules says which rules the check ran under, where each came from and what each finding did.
Charged per check at your price (production only); a check that could not be completed is not charged. Send a requestId: a retry with the same value returns the same check with replayed: true, without running or charging again.
Error codes
A missing or unknown key answers 401, where error is a short sentence rather than a code.
Requires a secret (sk_) key. A publishable key receives 403 secret_key_required.
Authentication
Send the API key as a Bearer token. Each operation states whether a publishable key is enough or a secret key is required. A scoped publishable key has Verification flow access, the fixed set flow.run, flow.config.read and verifications.status.read; a scoped secret key reaches what its scopes allow.
Request
The mediaId returned by POST /api/kyc/upload with type selfie. Uploads last 30 minutes.
Your own reference for the check (a customer or case id), kept with it and searchable in your history.
What each finding does, and where the lines sit on the 1 to 100 score. Defaults: confident_attack decline, attack and phone_in_view review, lines at 20 and 50. Our scale is not another provider’s: read result.modelScore to set a line.
Your idempotency key, 8 to 120 characters: a retry with the same value returns the same check.
Response
A retry: the check already run under this requestId.
The check id (chk_…).
pass: nothing of concern. review: something a person should look at. fail: a clear problem. unavailable: the check could not be completed, was not charged, and is never a pass.
What was sent, minimised: never image bytes, only media ids.
Why the check could not be completed, when outcome is unavailable.
On a run only: true when this is a check already run under the same requestId.