How to Add Face Matching of Liveness Video with a Reference Photo From Your Database

This guide describes how to match a liveness video with a reference photo of a person that is already stored in your database.

However, if you prefer to include a photo ID capture step to your liveness process instead of using a stored photo, then you can refer to another guide in this section.

By this time you should have already implemented liveness video recording and liveness check. If not, please refer to these guides:

In this scenario, you upload your reference image to the same folder where you have a liveness video, initiate the BIOMETRY analysis, and poll for the results.

1. Get folder_id

Given that you already have the liveness video recorded and uploaded, you will be working with the same Oz API folder where your liveness video is. Obtain the folder ID as described below, and pass it to your back end.

  • For a video recorded by Web SDK, get the folder_id as described here.

  • For a video recorded by Android or iOS SDK, retrieve the folder_id from the analysis’ results as shown below:


        .run(object : AnalysisRequest.AnalysisListener {
            override fun onSuccess(result: List<OzAnalysisResult>) {
                // save folder_id that is needed for the next step
                val folderId = result.firstOrNull()?.folderId

scenarioStateHandler: { state in }, 
uploadProgressHandler: { (progress) in }  
)   { (analysisResults : [OzAnalysisResult], error) in 
        // save folder_id that is needed for the next step
        let folderID = analysisResults.first?.folderID

2. Upload your reference photo

Call POST /api/folders/{{folder_id}}/media/ method, replacing the folder_id with the ID you’ve got in the previous step. This will upload your new media to the folder where your ready-made liveness video is located.

Set the appropriate tags in the payload field of the request, depending on the nature of a reference photo that you have.

  "media:tags": { 
    "photo1": [
        "photo_id", "photo_id_front" // for the front side of an ID
        // OR
        "photo_selfie" // for a non-ID photo

3. Initiate the analysis

To launch the analysis, call POST /api/folders/{{folder_id}}/analyses/ with the folder_id from the previous step. In the request body, specify the biometry check to be launched.

    "analyses": [
            "type": "biometry",

4. Poll for the results

Repeat calling GET /api/analyses/{{analyse_id}} with the analyse_id from the previous step once a second until the state changes from PROCESSING to something else. For a finished analysis:

  • get the qualitative result from resolution (SUCCESS or DECLINED).

  • get the quantitative results from analyses.results_data.min_confidence

Here is the Postman collection for this guide.

With these steps completed, you are done with adding face matching via Oz API. You will be able to access your media and analysis results in Web UI via browser or programmatically via API.

Oz API methods can be combined with great flexibility. Explore Oz API using the API Developer Guide.

Last updated