CredflareDevelopersOpen dashboard

Face match API

Send two photos and get back whether they show the same person, with a similarity score and the face found in each photo. Use it on its own, outside a verification case.

When to use it

A profile whose workflow includes a face.match check already compares faces inside each case; the default workflow adds it when the profile asks for an ID document and a selfie. Call this API when you collect the photos yourself and only need the comparison, for example to check a returning user's selfie against the ID photo you stored at sign-up.

reference is the trusted photo: an ID document page or the portrait cut from it. probe is the photo to check, usually a selfie. The service compares the largest face in each photo. On most passports and ID cards that is the holder's portrait. If another face is larger, crop to the portrait before sending.

Request

Use a server-side API key from Developers → Apps & API keys. A Sandbox key compares in Sandbox, a Live key in Live. Send both photos as multipart form data. JPG, PNG and WebP photos of up to 8 MB each are accepted.

Create one idempotency key for each new comparison and keep it when you retry the same photos.

export IDEMPOTENCY_KEY=$(uuidgen)
curl https://api.credflare.net/api/v1/client/face-matches \
  -H "X-Client-ID: $CREDFLARE_CLIENT_ID" \
  -H "X-Client-Secret: $CREDFLARE_CLIENT_SECRET" \
  -H "X-Idempotency-Key: $IDEMPOTENCY_KEY" \
  -F [email protected] \
  -F [email protected]
import { readFile } from 'node:fs/promises';

const form = new FormData();
form.append('reference', new Blob([await readFile('passport.jpg')], { type: 'image/jpeg' }), 'passport.jpg');
form.append('probe', new Blob([await readFile('selfie.jpg')], { type: 'image/jpeg' }), 'selfie.jpg');

const response = await fetch('https://api.credflare.net/api/v1/client/face-matches', {
  method: 'POST',
  headers: {
    'X-Client-ID': process.env.CREDFLARE_CLIENT_ID,
    'X-Client-Secret': process.env.CREDFLARE_CLIENT_SECRET,
    'X-Idempotency-Key': process.env.IDEMPOTENCY_KEY,
  },
  body: form,
});
if (!response.ok) {
  throw new Error('Face match failed (HTTP ' + response.status + '): ' + await response.text());
}
const { data } = await response.json();
console.log(data.status, data.score);
Header or fieldValue
X-Client-ID, X-Client-SecretThe API key. Keep the secret on your server.
X-Idempotency-KeyRequired. A new UUID for each comparison. Send the same key when you retry.
referenceThe ID photo.
probeThe selfie.

Responses

A new comparison returns HTTP 201. A retry after it completed returns the stored result with HTTP 200, as in the first sample; two overlapping requests can both return 201 with the same result. These are real responses from the face match service. Each compares the same selfie with a different reference: a passport of the same person, an ID card of someone else, and a driving licence with no portrait.

Same person

{
  "success": true,
  "message": "Operation successful",
  "data": {
    "id": "01a214a4-7bb7-7223-8069-7897eadd7bb8",
    "status": "match",
    "match": true,
    "score": 0.6997,
    "threshold": 0.363,
    "faces_found": {
      "reference": true,
      "probe": true
    },
    "faces": {
      "reference": {
        "box": [
          158.2,
          225.4,
          142.6,
          200.6
        ],
        "landmarks": [
          [
            195.1,
            302.7
          ],
          [
            268.1,
            303.9
          ],
          [
            231.1,
            340.5
          ],
          [
            198.4,
            369.2
          ],
          [
            261.3,
            370.1
          ]
        ],
        "confidence": 0.9399
      },
      "probe": {
        "box": [
          104.5,
          24.4,
          55.5,
          74.5
        ],
        "landmarks": [
          [
            111.4,
            53.4
          ],
          [
            137.9,
            53.7
          ],
          [
            118.8,
            69.3
          ],
          [
            113.7,
            82.1
          ],
          [
            135.5,
            80.6
          ]
        ],
        "confidence": 0.9307
      }
    },
    "environment": "sandbox",
    "created_at": "2026-11-25T21:37:33.000000Z"
  }
}

Different people

{
  "success": true,
  "message": "Face match completed",
  "data": {
    "id": "01a214a4-7e85-706d-9fd8-5f84ede7e713",
    "status": "no_match",
    "match": false,
    "score": 0.0834,
    "threshold": 0.363,
    "faces_found": {
      "reference": true,
      "probe": true
    },
    "faces": {
      "reference": {
        "box": [
          118.1,
          204.7,
          121.6,
          178.4
        ],
        "landmarks": [
          [
            147.6,
            279
          ],
          [
            208.2,
            279.4
          ],
          [
            174.8,
            312.4
          ],
          [
            150.2,
            330.8
          ],
          [
            200.8,
            337
          ]
        ],
        "confidence": 0.9303
      },
      "probe": {
        "box": [
          104.5,
          24.4,
          55.5,
          74.5
        ],
        "landmarks": [
          [
            111.4,
            53.4
          ],
          [
            137.9,
            53.7
          ],
          [
            118.8,
            69.3
          ],
          [
            113.7,
            82.1
          ],
          [
            135.5,
            80.6
          ]
        ],
        "confidence": 0.9307
      }
    },
    "environment": "sandbox",
    "created_at": "2026-11-25T21:37:34.000000Z"
  }
}

No face in one photo

{
  "success": true,
  "message": "Face match completed",
  "data": {
    "id": "01a214a4-80da-72d3-8939-d9c54e842506",
    "status": "no_face",
    "match": false,
    "score": null,
    "threshold": 0.363,
    "faces_found": {
      "reference": false,
      "probe": true
    },
    "faces": {
      "reference": null,
      "probe": {
        "box": [
          104.5,
          24.4,
          55.5,
          74.5
        ],
        "landmarks": [
          [
            111.4,
            53.4
          ],
          [
            137.9,
            53.7
          ],
          [
            118.8,
            69.3
          ],
          [
            113.7,
            82.1
          ],
          [
            135.5,
            80.6
          ]
        ],
        "confidence": 0.9307
      }
    },
    "environment": "sandbox",
    "created_at": "2026-11-25T21:37:34.000000Z"
  }
}
FieldMeaning
statusmatch, no_match or no_face.
scoreHow alike the two faces are. Higher is more alike. null when a face is missing.
thresholdA score at or above this counts as a match. Use status rather than comparing yourself, since the threshold can change with the model and the returned score is rounded.
faces_foundWhether a face was found in each photo.
facesThe face box [x, y, width, height] in pixels, five landmarks and the detector's confidence for each photo.
environmentsandbox or live, from the key.

Read a result again with GET /client/face-matches/{id}.

Retries

Retrying with the same API key, the same X-Idempotency-Key and the same photos in the same fields returns the stored result and does not use another verification. The same key with different photos returns HTTP 409.

Errors

StatusCauseRetry?
401Missing or invalid API key.No
402The plan does not include face match in this environment, or its verifications are used up.After choosing a plan, or when a monthly allowance renews
409The idempotency key was used with other photos.With a new key
422A photo is missing or not a readable image, X-Idempotency-Key is missing or not a UUID, or face match is not set up in this environment (errors.code provider_not_configured).Fix the photos or send a UUID in X-Idempotency-Key. For provider_not_configured, retry once face match is set up in this environment.
503The face match service could not be reached (errors.code provider_unavailable).Yes, with the same key

Billing

Each completed comparison uses one verification from the plan, including one where no face was found. In Sandbox it uses the monthly Sandbox checks first, then Live verifications if the plan includes Live. A refused request, an unreadable photo or an unreachable service uses nothing, and the allowance is checked before the photos are compared. See pricing.

What is stored

The photos are compared in memory and discarded. Credflare keeps the result shown above (status, score, threshold and the faces found), the idempotency key, and one hash of the two photos so it can recognise a retry. It does not keep the photos or a face template.

A face match tells you two photos look like the same person. On its own it does not prove the selfie was taken live; use a liveness check in a profile for that.