Skip to main content

Compare Faces

faceCompare does a 1:1 comparison of two face images and tells you whether they are the same person, along with the raw confidence score. Unlike faceDetect, it doesn't touch the enrolled gallery — it only compares the two images you send.

API Endpoint

  • HTTP Method: POST
  • Endpoint: /api/v1/faces/faceCompare
  • Base URL (Cloud): https://customername.econnectcloud.com/identities
  • Base URL (On-prem): https://<server-host-or-ip>:5009

Authentication

Requires a JWT bearer token in the Authorization header. See Authentication.

Minimum Permission

The permission name and category below are what you'll see in the Identities web app under System → System settings → Roles.

PermissionCategory
Face DetectionFacial Recognition Services

Request Body

Content-Type: application/json. Both images are sent as base64-encoded strings.

FieldTypeRequiredDescription
image1byte[] (base64)YesThe first face image.
image2byte[] (base64)YesThe second face image to compare against the first.

How match Is Decided

The comparison always returns a raw confidence. match is derived server-side: it is true when confidence meets the server's configured minimum match threshold, and false otherwise.

Apply your own threshold if you need one

Because the raw confidence is always returned, you can ignore match and apply a stricter threshold of your own for high-assurance flows — e.g. only accept a match at confidence >= 0.95 even if the server would call a lower score a match.

Code Examples

API_URL="https://customername.econnectcloud.com/identities"
TOKEN="your_jwt" # from POST /api/v1/authenticate
IMG1_B64=$(base64 -w 0 face.jpg)
IMG2_B64=$(base64 -w 0 face2.jpg)

# Compare two faces (1:1). "match" is threshold-based; "confidence" is the raw score.
curl -sk -X POST "$API_URL/api/v1/faces/faceCompare" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d "{\"image1\": \"$IMG1_B64\", \"image2\": \"$IMG2_B64\"}" | jq

Raw Sample

Request

POST https://customername.econnectcloud.com/identities/api/v1/faces/faceCompare
Authorization: Bearer <your_jwt_token>
Content-Type: application/json
{
"image1": "base64_encoded_first_face",
"image2": "base64_encoded_second_face"
}

Response

200 OK — a FaceCompareResponse:

{ "match": true, "confidence": 0.97 }

Response Fields

FieldTypeDescription
matchbooltrue when confidence meets the server's minimum match threshold.
confidencefloatRaw similarity score, 0.01.0.

Response Codes

CodeMeaning
200 OKThe comparison ran; match and confidence are returned.
401 UnauthorizedMissing or invalid JWT.
403 ForbiddenThe user lacks the Face Detection permission.
500 Internal Server ErrorA server-side error occurred (e.g. a face could not be found in one of the images).

Notes

  • match is threshold-based on the server's configured minimum; confidence is the raw score.
  • Keep the raw confidence if you want to apply a stricter, integration-specific threshold.
  • To match a face against the enrolled gallery rather than a single other image, use faceDetect.