Skip to main content
Version: v2

Match face images against selfies

Scenario: you have an image of your user, and want to perform a selfie match against that image, to check if the current user matches the photo you have on record. This could be used when changing very sensitive data, or as an additional verification step for transactions involving large sums of money.

Create a workflow​

Configure the initialization step​

Set up the initialization step to require a photo that you have saved in your system:

  1. Add a field name. In this tutorial we'll use faceImage.
  2. Add a linked field. Set it to Document face image if you have a face image, or if you have an image of a document, set it to "Raw document image front".
Initialization step configuration

Add the selfie capability​

The workflow could involve more steps if you need them, but to just perform a selfie (biometric) check, only one step is required: Selfie, Liveness & Face Match.

Workflow showing only the selfie, liveness & face match capability

Send the face image when you create the transaction​

After you've published your workflow, it's ready to be used. The workflow expects to find a face image in the initialization step.

You provide that image from your backend, in the same request that creates the transaction:

  1. The user starts the face check in your app.
  2. Your backend authenticates the user.
  3. Your backend fetches the face image you have on record for that user.
  4. Your backend Base64-encodes the image and calls POST /api/v2/transaction on the Agent API, with the image in formValues.
  5. The Agent API returns sdkConfiguration, and your backend returns it to your app.
  6. Your app passes sdkConfiguration to the SDK, and the user takes a selfie.

The image never passes through your app, and the SDK needs no extra configuration.

Request body​

Put the image in the formValues object, under the name you gave the field in the initialization step:

{
"workflowId": "ed8f5b8efd2a90c37e0b8aac",
"platform": "Browser",
"formValues": {
"faceImage": "/9j/4AAQSkZJRgABAQAASABIAAD/4QB..."
},
"consent": {
"userId": "unique-user-id",
"isProcessingStoringAllowed": true
}
}

Workflow user experience​

The end user goes through only one step: the selfie match.

Since the face image is added on your backend, the user only takes a selfie, while the administrator sees the face image in the transaction history for that transaction.