Skip to content

Index Faces ​

Indexes the face in an image and adds it to a collection, building the searchable set that Search Faces queries for duplicates and blocklist hits.

Endpoint ​

http
POST /v1/index_faces_sync
Content-Type: application/json
json
{
  "image": {
    "id": "a4facba3-334b-41fb-97e3-4766cb70ae29",
    "base64": "",
    "label": "portrait",
    "metadata": "{}"
  },
  "enable_update_metadata": false,
  "collection": "default",
  "type": 0
}

Parameters:

ParamTypeRequiredDefaultDescription
imageImageDataYes—Image containing the face to index. When using the TS SDK, pass the last frontal frame.
enable_update_metadataboolNofalseAllows image.metadata to be updated on an already-indexed image.
collectionstringNodefault collectionCollection to index the face into. Case-sensitive.
typeintNo—Type of collection.

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: {"id":"<ID>","type":1}

Sample Request ​

bash
curl -X POST \
  '<BASE_URL>/v1/index_faces_sync' \
  -H 'Authorization: ATV <ACCESS_ID>:<SIGNATURE>' \
  -H 'X-TV-Timestamp: <TIMESTAMP>' \
  -H 'Content-Type: application/json' \
  -d '{
    "image": {
      "id": "a4facba3-334b-41fb-97e3-4766cb70ae29"
    }
  }'

Response ​

json
{
  "success": true,
  "code": 0,
  "message": "success",
  "data": {
    "status": "success",
    "image": {
      "id": "a4facba3-334b-41fb-97e3-4766cb70ae29",
      "transformed_image_id": ""
    },
    "request_id": "dfdef016-e89b-4da4-ae17-5844f909c947"
  },
  "errors": []
}
FieldTypeDescription
data.statusstringsuccess or failure.
data.image.idstringID of the indexed image.
data.image.transformed_image_idstringID of the transformed image, present only when the image was transformed.
data.request_idstringRequest ID; quote it to CAKE Support when checking logs.

WARNING

Indexing enrols a biometric template that persists until you delete it. Index only after the customer has consented and the onboarding has been approved, and use Delete Faces to honour erasure requests.

Errors ​

CodeMessage
2001010Access ID not found.
401100You are not authorized to perform the action.
4001000Input parameter violates a constraint.
4001001The X-TV-Timestamp header is expired, need a newer one.
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.
image_not_found_exceptionThe image ID is not found in DB.
request_not_found_exceptionThe request ID is not found when polling result by id.
request_timeout_exceptionRequest takes too long to process.
rate_limit_exceptionThe number of requests exceeded your throughput limit.
internal_server_errorSome unexpected error occurs while processing the request.

Next Steps ​

Developers