Skip to content

Register Faces ​

Enrols a user's face profile, the template every later authentication is matched against. Registration runs sanity, liveness and cross-image matching checks before the profile is created.

Endpoint ​

http
POST /v1/face_auth_register
Content-Type: application/json
json
{
  "user_id": "user_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.
facesImageData[]Yes—Images of the user's selfie, or a document containing a selfie photo such as an ID card front. At least one is required.
device_idstringNo—The user's device ID, so face auth history shows which device performed the registration on the admin portal.
app_idstringNo—The app the customer used, so face auth history shows which app performed the registration.
latstringNo—Latitude of the device used for this registration.
lngstringNo—Longitude of the device used for this registration.
face_typestringNoselfieType of face input: selfie or id_card. Use id_card for a face extracted from a Citizen ID card, for example while reading its NFC chip.
metadatajson_objectNo—Any key-value metadata to store with this customer. Nested objects are allowed.

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}

Supply either id or base64, never both. CAKE recommends id over base64.

INFO

faces is required — send at least one; a registration with no faces has nothing to enrol.

Returns: RegisterFacesResponse

Sample Request ​

bash
curl -X POST \
  '<BASE_URL>/v1/face_auth_register' \
  -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" }
    ],
    "face_type": "selfie",
    "device_id": "device_00000001",
    "app_id": "app_00000001",
    "lat": "10.7769",
    "lng": "106.7009",
    "metadata": {
      "key1": { "key11": "value11", "key12": "value12" },
      "key2": "value2"
    }
  }'

Response ​

json
{
  "data": {
    "status": "success",
    "request_id": "cfc7b8d5-f2e2-437b-80e5-d600dfad26e2",
    "face_auth": {
      "user_id": "user_00000001",
      "status": "VERIFIED"
    }
  },
  "success": true,
  "code": 0,
  "message": "Success"
}
FieldTypeDescription
data.statusstringsuccess or failure.
data.request_idstringRequest ID; quote it to CAKE Support when checking logs.
data.face_auth.user_idstringThe user ID the profile was created for.
data.face_auth.statusstringProfile status, e.g. VERIFIED.

WARNING

A face template is biometric data. Register only with the customer's consent, and use Delete Face Authen to honour erasure requests.

Errors ​

Registration surfaces the quality and matching failures that rejected the enrolment:

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.
2001014Register rate limit exceeded.
2001015Register brute force limit exceeded.
2001025Selfie image sent to the server has length not equal to configuration.
2001026Images sent to server are duplicated.
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_id_not_foundAccess ID not found.
register_rate_limit_exceededRegister rate limit exceeded.
register_brute_force_limit_exceededRegister brute force limit exceeded.
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_already_registeredThe user_id has been registered.
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.

face_already_registered and user_already_registered are different failures: the first means that face belongs to another profile, the second means this user_id already has one.

Next Steps ​

Developers