CredflareDevelopersOpen dashboard

Liveness and location

A facial requirement asks the applicant to follow a gesture sequence the server chooses. A location requirement checks the fix the device reports against your profile's rules. Both give your reviewers evidence. Neither proves who the applicant is.

The hosted verification page and all five applicant SDKs run these steps the same way. The numbers, gestures, error codes and applicant copy on this page come from the public SDK spec that every client is generated from.

What the checks show

The checks do not prove that a live person was in front of the camera. They do not detect deepfakes, replayed video, virtual cameras or spoofed locations. The camera source and the mock location flag are reported by the device. Treat them as signals for a reviewer, not as decisions. The session response says so in capabilities: trusted_camera is false, liveness is "challenge" and deepfake_detection is false.

Configure the profile

Add facial_verification or location_verification to a profile's verification_requirements, in the profile editor or through the management API. An entry can be the type name alone, or an object with verification_type and settings. Unknown settings are rejected. Settings you leave out get the defaults below, so clients always receive complete settings in profile.verification_requirements[].settings.

[
  {
    "verification_type": "facial_verification",
    "settings": {
      "gesture_count": 2,
      "record_video": true
    }
  },
  {
    "verification_type": "location_verification",
    "settings": {
      "max_accuracy_m": 50,
      "ip_country": "reject"
    }
  }
]

A case keeps the settings it was created with. Editing a profile changes new cases only.

Facial settings

SettingAllowedDefaultMeaning
gesturesAny of blink, smile, turn_left, turn_right, nod (at least 1)blink, smile, turn_left, turn_right, nodGestures the server may pick from.
gesture_count1 to 53How many gestures one challenge asks for. It cannot be larger than the number of allowed gestures.
record_videotrue or falsetrueRecord a short video, without sound, while the applicant follows the challenge.

Location settings

SettingAllowedDefaultMeaning
max_accuracy_m5 to 5000100Largest accepted accuracy radius of the fix, in meters.
max_age_s5 to 360060Oldest accepted fix, in seconds, measured against the server clock.
mock_locationreject, flag, allowrejectWhat to do when the device reports a mock location.
ip_countryreject, flag, offflagWhat to do when the country of the network address differs from the country of the coordinates.
referenceObject, or nullnullOptional places the applicant must be at or away from.
places1 to 50 placesNoneThe places to check.
idText, up to 64 charactersNoneYour identifier for the place.
labelText, up to 120 charactersNoneName the applicant sees, such as Head office.
latitude-90 to 90NoneLatitude of the place. Never sent to the applicant.
longitude-180 to 180NoneLongitude of the place. Never sent to the applicant.
radius_m0 to 100000NoneRadius of the circle around the place, in meters. 0 means the place must fall inside the accuracy circle of the fix.
rulewithin, outsidewithinwithin: be inside a place circle. outside: be outside it.
matchany, allanyany: one place is enough. all: every place must pass the rule.
confidencestrict, lenientstrictstrict: the whole accuracy circle must pass. lenient: overlapping circles are enough.
on_mismatchreject, flagrejectreject: refuse the location. flag: accept it and flag it for review.

The liveness challenge

The applicant cannot choose the gestures. The client asks for a challenge right before the camera step starts.

  1. Request a challenge: POST /sdk/sessions/{session}/liveness-challenges with the session token, or POST /client/verifications/{id}/liveness-challenges on the hosted page. The server picks gesture_count gestures from the allowed list at random, without repeats.
  2. Run the gestures in the order given. The client shows a mirrored front camera preview and position hints until one face is centered and the right size.
  3. When each gesture completes, keep that camera frame and upload it as a gesture.
  4. Take the selfie and upload it as a selfie. Every upload carries the challenge_id and capture_source=camera.
  5. When record_video is true, record the challenge without sound and upload it as a liveness_video, at most max_video_seconds long.
  6. Submit a facial_verification with the challenge_id, the selfie file, the gesture files in the issued order and the video file.

A 201 response from the challenge request:

{
    "success": true,
    "message": "Liveness challenge issued",
    "data": {
        "challenge_id": "01a1fb8d-6c01-7160-a4fe-31853bb8dbdd",
        "gestures": [
            "nod",
            "turn_right",
            "turn_left"
        ],
        "expires_at": "2026-11-21T00:43:51.000000Z",
        "record_video": true,
        "max_video_seconds": 8
    }
}

Gestures

Every client runs the same gesture engine on normalized face signals. eye_open and smile run from 0 to 1. yaw is positive when the applicant turns to their own left, and pitch is positive when they tilt their head up. Each gesture must finish within 10 seconds, and losing the face for 1 second or more restarts it.

GestureThe applicant seesThe engine looks for, in order
blinkBlinkeye_open above 0.6, then eye_open below 0.3, then eye_open above 0.5
smileSmilesmile above 0.6 for 5 samples in a row
turn_leftSlowly turn your head to your left, then backyaw above 20°, then yaw back within 10° of 0
turn_rightSlowly turn your head to your right, then backyaw below -20°, then yaw back within 10° of 0
nodNod: look down, then back uppitch below -15°, then pitch back within 10° of 0

Smile thresholds differ by face provider: mediapipe uses smile 0.4; mlkit uses smile 0.7. The web uses MediaPipe Face Landmarker. Swift, and React Native and Flutter on iOS, use Apple Vision. Kotlin, and React Native and Flutter on Android, use ML Kit.

Uploads

Send each file to POST .../uploads/biometrics as multipart form data.

typeExtra fieldsFile
gesturechallenge_id, gesture, capture_source=cameraOne JPEG frame, taken when the gesture completed.
liveness_videochallenge_id, capture_source=cameramp4, mov or webm, at most max_video_seconds long (8 seconds).
selfiechallenge_id, capture_source=cameraA JPEG, PNG or WebP still.

Then submit to POST .../submit, with the gesture files in the order the challenge listed them:

{
  "type": "facial_verification",
  "challenge_id": "01a1fb8d-6c01-7160-a4fe-31853bb8dbdd",
  "image_file_id": 14,
  "gesture_file_ids": [10, 11, 12],
  "video_file_id": 13,
  "metadata": {
    "provider": "mediapipe",
    "liveness_results": [
      {"challenge": "nod", "completed": true, "timestamp": "2026-11-21T00:42:01.000Z"},
      {"challenge": "turn_right", "completed": true, "timestamp": "2026-11-21T00:42:04.000Z"},
      {"challenge": "turn_left", "completed": true, "timestamp": "2026-11-21T00:42:07.000Z"}
    ],
    "face_detection": {
      "detected": true,
      "face_count": 1,
      "is_centered": true,
      "is_correct_size": true
    },
    "captured_at": "2026-11-21T00:42:09.000Z"
  }
}

provider is mediapipe, mlkit or vision.

Expiry and single use

When a timeout, an expiry or one of the challenge codes below stops the step, the clients offer a retry that requests a new challenge. Never reuse the old one.

Location checks

The client asks for permission, takes a high accuracy fix and makes up to 3 attempts, waiting up to 30 seconds for each, until the fix meets max_accuracy_m and max_age_s. Then it submits:

{
  "type": "location_verification",
  "latitude": 4.0511,
  "longitude": 9.7679,
  "metadata": {
    "accuracy": 12.5,
    "altitude": null,
    "fix_time": "2026-11-21T10:00:00.000Z",
    "is_mock": null,
    "provider": "browser",
    "captured_at": "2026-11-21T10:00:02.000Z"
  }
}

The server then checks, in this order:

CheckServer action
AccuracyRejects when accuracy is missing or larger than max_accuracy_m.
Fix ageRejects when fix_time is missing, older than max_age_s, or in the future. 30 seconds of clock difference are allowed both ways.
Mock locationreject refuses a fix with is_mock: true. flag accepts it and flags it for review. allow ignores it. is_mock: null means the client cannot tell, and is never treated as a mock.
Network countryCompares the country of the request's IP address with the country of the coordinates. reject refuses a mismatch, flag flags it, off skips the check.
Reference placesChecks the fix against your places when the profile or case has them.

Where the mock flag comes from

Clientis_mock
Hosted page and JavaScript SDKAlways null. Browsers do not expose it.
React NativeThe Android mock flag. null on iOS.
FlutterThe Android mock flag, and on iOS whether the system marks the fix as simulated by software.
SwiftWhether iOS marks the fix as simulated by software.
KotlinThe Android mock flag (isMock on Android 12 and newer, isFromMockProvider before).

Network country

The server looks up the IP country in a local copy of the DB-IP IP to Country Lite database, and the coordinates in a local copy of the Natural Earth country boundaries. No request leaves the server for either lookup. The result is stored as matched, mismatch or not_checked. Only a mismatch can reject.

not_checked reasonWhen
disabledip_country is off.
private_ipThe request came from a private, reserved or carrier grade NAT address.
ip_country_unknownThe database has no country for the address.
country_lookup_unavailableThe datasets are not installed on the server.
no_countryThe point is not in any country, for example at sea.
disputed_territoryThe point is in an area with no assigned country code.
near_borderThe point is within 10 km of another country, and the IP country is one of those countries.

Near a border, an IP country that is none of the nearby countries still counts as a mismatch. VPNs, mobile roaming and corporate networks often place an applicant in another country, so flag is the default.

Reference places

A location requirement can check that the applicant is at, near or away from known places, such as an office or a declared address.

"reference": {
  "places": [
    {"id": "hq", "label": "Head office", "latitude": 4.0511, "longitude": 9.7679, "radius_m": 50}
  ],
  "rule": "within",
  "match": "any",
  "confidence": "strict",
  "on_mismatch": "reject"
}

Places for one case. Pass location_places, in the same shape as places, when you create a case with POST /client/verifications or in the dashboard. They replace the profile's places for that case only and need a profile with a location requirement. Give coordinates; the server does not geocode addresses.

What the applicant sees. Clients receive only rule, match and the place labels, never coordinates or radii, so the app can say "Share your location at Head office". Only the server decides whether the fix matched. The stored result has the outcome (matched, not_matched or not_configured), the nearest place with its distance, and the accuracy used.

Request keys and retries

Send an X-Idempotency-Key header with a UUID on every SDK session upload and submission, and on every biometrics upload from the hosted page. Hosted submissions accept a key too.

Rejection codes

Every 422 from a capture rule has a stable code next to message and errors. Match on code. message is written for people and can change. Other validation errors have no code.

{
    "success": false,
    "message": "The location fix is too old. Share your current location again.",
    "errors": [],
    "code": "location.stale"
}
CodeWhenThe applicant sees in the SDKsButton
location.accuracyAccuracy is missing or larger than max_accuracy_mLocation not precise enough
Your location is not accurate enough yet. Move near a window or outside, then try again.
or Your location is not precise enough to check this place. Move near a window or outside, then try again.
Try again
location.stalefix_time is missing, older than max_age_s plus clock_skew_s, or in the futureLocation out of date
Your location reading is out of date. Try again to take a new one.
Try again
location.mockis_mock is true and mock_location is rejectLocation is being changed
An app or setting is changing your device location. Turn it off, then try again.
Try again
location.ip_countryThe IP country does not match and ip_country is rejectConnection in another country
Your internet connection seems to be in a different country from your location. Turn off any VPN or proxy, then try again.
Try again
location.reference_not_matchedThe place rule failed and on_mismatch is rejectLocation does not match
Your location does not match the place requested by {verifier}. Try again from the right place.
or You do not seem to be at {place} yet. Move closer, then try again.
or You seem to be too close to {place}. Move away, then try again.
Try again
liveness.challenge_invalidThe challenge is unknown, belongs to another case or was replacedStart this step again
This attempt can no longer be used. Start this step again.
Start again
liveness.challenge_expiredThe challenge expiredTime ran out
This step timed out. Start it again.
Start again
liveness.challenge_usedThe challenge was already usedStart this step again
This attempt can no longer be used. Start this step again.
Start again
liveness.gesture_mismatchA gesture frame is missing, extra, out of order or for a gesture the challenge does not includeMovements did not match
Some movements were missing or out of order. Start this step again and follow each prompt.
Start again
liveness.frame_out_of_windowA file was uploaded before the challenge was issued or after it expiredTime ran out
This step timed out. Start it again.
Start again
liveness.not_cameraEvidence was not uploaded with capture_source=camera for this challengeCamera needed
This step needs photos taken with the camera during the step. Start it again and use the camera.
Start again
liveness.video_missingrecord_video is on and no video for this challenge was sentRecording missing
The recording of this step did not arrive. Start the step again.
Start again
liveness.video_too_longThe video is longer than max_video_seconds plus one secondRecording too long
The recording was longer than allowed. Start the step again and follow the prompts without pausing.
Start again
liveness.video_unreadableThe server cannot read the video durationRecording could not be read
We could not read the recording. Start the step again.
Start again

The copy and the button come from the rejection screen map in the SDK spec. For location.accuracy and location.reference_not_matched, the later lines replace the first when the requirement has reference places; for a place mismatch the line depends on rule, and {place} is the place labels. Start again requests a new challenge.

What reviewers get

What the applicant sees

Before the challenge. The applicant is told a short video is recorded.
Before the challenge. The applicant is told a short video is recorded.
One gesture at a time, in the order the server chose.
One gesture at a time, in the order the server chose.
Location consent names the place by its label only.
Location consent names the place by its label only.
A rejected fix shows the copy for its code and a retry.
A rejected fix shows the copy for its code and a retry.

Rendered by the JavaScript SDK in headless Chrome against recorded API responses. Chrome's test camera has no face, so the gesture signals were replayed from the spec's test traces.

Data credits

IP Geolocation by DB-IP, licensed under CC BY 4.0. Country boundaries from Natural Earth.