Skip to content

Verify Face Authen ​

Authenticates a user against their registered face profile and returns matched, unmatched or unsure with a score. When a transaction ref_id is supplied it also mints the authentication_key your backend redeems to close the transaction.

Endpoint ​

http
POST /v1/face_auth
Content-Type: application/json
json
{
  "user_id": "user_00000001",
  "ref_id": "ref_00000001",
  "faces": [
    { "id": "a4facba3-334b-41fb-97e3-4766cb70ae29" }
  ],
  "device_id": "device_00000001",
  "app_id": "app_00000001",
  "lat": "10.7769",
  "lng": "106.7009",
  "face_type": "selfie",
  "metadata": { "key2": "value2" }
}

Parameters:

ParamTypeRequiredDefaultDescription
user_idstringYes—User ID of the customer.
ref_idstringNo—Reference ID of a transaction created before verification. Supply it so the transaction can be looked up afterwards for its status.
facesImageData[]Yes—Images of the user's selfie. At least one is required.
device_idstringNo—The user's device ID, shown in face auth history on the admin portal.
app_idstringNo—The app the customer used, shown in face auth history.
latstringNo—Latitude of the device used.
lngstringNo—Longitude of the device used.
face_typestringNoselfieType of face input: selfie or id_card.
metadatajson_objectNo—Any key-value metadata to store with this login.

ImageData ​

ParamTypeRequiredDefaultDescription
idstringNo—ID of the image returned by Upload Image.
base64stringNo—Base64-encoded text of the image data.
labelstringNo—Label of the image, as described in Usage Recommendations.
metadatastring_jsonNo—Key/value JSON string. Example: {"gesture":"left","type":1}

Returns: VerifyFaceAuthResponse

Sample Request ​

bash
curl -X POST \
  '<BASE_URL>/v1/face_auth' \
  -H 'Authorization: ATV <ACCESS_ID>:<SIGNATURE>' \
  -H 'X-TV-Timestamp: <TIMESTAMP>' \
  -H 'Content-Type: application/json' \
  -d '{
    "user_id": "user_00000001",
    "faces": [
      { "id": "a4facba3-334b-41fb-97e3-4766cb70ae29" },
      { "id": "c5a2a405-f152-4248-b746-3af76b241ef7" },
      { "id": "5d0345f7-da7c-44e8-bd6c-a8c08c806227" }
    ]
  }'

Device Signature (SDK Requests) ​

When the Mobile SDK calls this endpoint with the transaction token (Authorization: Bearer …), it also sends Device-Id, X-Device-Key-Id and X-Device-Signature on a tenant with the device signature check enabled. The credential named by X-Device-Key-Id must be ACTIVE and registered for the same Device-Id; otherwise the request is rejected with access_denied_exception. See Request Signing for when the headers are required.

Response ​

json
{
  "data": {
    "status": "success",
    "auth_check": {
      "score": 0.98,
      "result": "matched"
    },
    "request_id": "cfc7b8d5-f2e2-437b-80e5-d600dfad26e2",
    "authentication_key": "<AUTHENTICATION_KEY>"
  },
  "errors": [],
  "success": true,
  "code": 0,
  "message": "Success"
}
FieldTypeDescription
data.statusstringsuccess or failure.
data.auth_checkobjectThe authentication verdict. Present when success is true.
data.auth_check.resultstringmatched, unmatched or unsure.
data.auth_check.scorefloatHow likely the presented face matches the profile, range 0–1.
data.request_idstringRequest ID; quote it to CAKE Support when checking logs.
data.authentication_keystringThe key your backend redeems at Verify Transaction Authentication Key.

WARNING

Do not approve the action on auth_check.result as reported by the app. Redeem the authentication_key from your backend and decide on that result — a client can claim any verdict it likes. Treat unsure as a distinct outcome for manual review, not a soft matched.

Errors ​

CodeMessage
2001003Image sent to the server has no faces.
2001006Faces detected from images sent to the server are not matched.
2001008Face has been registered on the system.
2001009Image sent to the server has multiple faces.
2001010Access ID not found.
2001011Verify selfie / id_card liveness failed.
2001012Verify selfie / id_card sanity failed.
2001016Face auth rate limit exceeded.
2001017Face auth brute force limit exceeded.
2001025Selfie image sent to the server has length not equal to configuration.
2001026Images sent to server are duplicated.
2002201Face authentication did not match (verdict unsure).
2002205Face authentication did not match (verdict unmatched).
2002206User profile is locked.
2009005SDK version is no longer supported. Please update the app.
401100You are not authorized to perform the action.
4001000Input parameter violates a constraint.
4001001The X-TV-Timestamp header is expired, need a newer one.
4001002Selfie or original image have more than 1 faces.
4041000The image ID is not found in DB.
4041001User not found.
4091000The user_id has been registered.
4131000The input image size exceeds the allowed limit (15MB).
4151000The provided image format is not supported (JPG/PNG).
4291000The number of requests exceeded your throughput limit.
5001000Some unexpected error occurs while processing the request.
CodeDescription
access_denied_exceptionYou are not authorized to perform the action.
invalid_parameter_exceptionInput parameter violates a constraint.
request_time_too_skewedThe X-TV-Timestamp header is expired, need a newer one.
incorrect_number_of_facesSelfie or original image have more than 1 faces.
image_not_found_exceptionThe image ID is not found in DB.
user_profile_not_found_exceptionThe profile of user not found.
user_profile_lockedUser profile has been locked.
face_auth_rate_limit_exceededFace auth rate limit exceeded.
face_auth_brute_force_limit_exceededFace auth brute force limit exceeded.
sdk_version_unsupportedThe SDK is older than the minimum version your tenant accepts for device-signed requests.
image_too_large_exceptionThe input image size exceeds the allowed limit (15MB).
invalid_image_format_exceptionThe provided image format is not supported (JPG/PNG).
rate_limit_exceptionThe number of requests exceeded your throughput limit.
duplicated_imageImages sent to server are duplicated.
selfie_image_invalidSelfie image sent to the server has length not equal to configuration.
sanity_check_failedVerify selfie / id_card sanity failed.
liveness_check_failedVerify selfie / id_card liveness failed.
image_has_no_facesImage sent to the server has no faces.
image_has_multiple_facesImage sent to the server has multiple faces.
face_already_registeredFace has been registered on the system.
compare_faces_not_matchedFaces detected from images sent to the server are not matched.
internal_server_errorSome unexpected error occurs while processing the request.

A failed match is an error, not a success: true with a negative verdict: 2002205 for unmatched and 2002201 for unsure. Repeated failures raise face_auth_brute_force_limit_exceeded and then lock the profile with 2002206.

Next Steps ​

Developers