> For the complete documentation index, see [llms.txt](/llms.txt)

# Verify users against 2 different documents

## Introduction

Follow this guide to be able to verify a single user against 2 different documents with a single live photo or live video.

Entrust allows you to complete 2 checks for a single applicant, against 2 different documents, without the user needing to upload a live photo or video twice.

Instead of asking the user to repeat the upload of a live photo or live video with a new document, it is possible to request the upload of a second document at the end of the standard capture flow. An additional check can then be submitted to compare the user's live photo or video, provided during the initial flow, with the second uploaded document. Using this process reduces friction and wait time for end users, allowing you to onboard customers quickly and efficiently whilst meeting the necessary requirements.

**Concurrent checks are required for this flow. Please contact Entrust's [Customer Support](mailto:identity-client-support@entrust.com) to enable this for your account.**

## Overview of steps

The following diagram illustrates the flow for a check containing 2 Document reports, one for an ID document and one for a driving license, and a single Facial Similarity video report:

<div>
  <img src="./2docs-1face.png" />
</div>

**Note:** You can customize and re-order the steps for document and biometric capture based on the desired flow for your application.

## Integration guidance

This guide assumes you're using the Entrust Identity Verification SDKs. If you have built your own capture experience, you will need to adjust your experience to allow for the upload of 2 documents and 1 live photo or video in order to use this process.

Follow the steps below to create 2 checks for a single applicant against 2 different documents using the same live photo or video.

You may find our SDK reference pages for [iOS](/sdk/ios/), [Android](/sdk/android/) and [Web](/sdk/web/) useful.

### [1. Create an applicant](#create-an-applicant)

The first step in creating any check is to [create an applicant](/api/latest/#create-applicant) from your backend server, using a valid API token.

For Document and Facial Similarity reports, you must at least specify the applicant's first and last names in the body of the request.

### [2. Generate an SDK token](#generate-an-sdk-token)

Use your API token to make a request to the ['generate SDK token' endpoint](/api/latest/#generate-sdk-token), including the applicant ID you created in the previous step and a valid referrer.

You can use the same SDK token for both instances of the SDK.

### [3. Initialize the SDK](#initialize-the-onfido-sdk)

You'll need to setup the SDK to support the submission of 2 documents and 1 live photo or live video from an end user.

You can also customize the welcome screen of the SDK flow to specify to the end user which steps they will be presented with, including both document uploads.

The first instance of the SDK will allow the user to upload the first document and a live photo or video. The second instance of the SDK, once it has been re-initialized, will allow the user to upload the second document.

**Example first initialization of the SDK (iOS)**

```swift
func StartCheck(){
        GetSDKToken(tokenCreated: {response in
            sdkToken = response["token"].rawString()!
            let config = try! OnfidoConfig.builder()
                .withSDKToken(sdkToken)
                .withDocumentStep(ofType: .drivingLicence(config: nil))
                .withFaceStep(ofVariant: .video(withConfiguration: nil))
                .build()

            let onfidoFlow = OnfidoFlow(withConfiguration: config)
                .with(responseHandler: { results in
                    switch results {
                    case .success:
                        self.SendLicenceAndVideo()
                    case .cancel:
                        self.resetApp()
                    case .error(_):
                        self.resetApp()
                    @unknown default:
                        self.resetApp()
                    }
                })

            let onfidoRun = try! onfidoFlow.run()
            self.present(onfidoRun, animated: true, completion: nil)
        })
    }
```

**Example handle completion of first step (iOS)**

```swift
func SendLicenceAndVideo() {
        let parameters: [String:Any] = [
            "applicant_id": applicantId,
            "report_names": [
                "document",
                "facial_similarity_video"
            ],
            "document_ids": [
                firstDocumentId
            ]
        ]

        AF.request("https://\(remoteServer)/create_checks",
                   method: .post,
                   parameters: parameters,
                   encoding: JSONEncoding.default,
                   headers: headers
        ).responseJSON { response in
            let banner = StatusBarNotificationBanner(title: "Starting first check: DL + video", style: .info)
            banner.show(queuePosition: .front)
            firstCheck = JSON(response.value as Any)
​
            self.SecondStep()
        }
    }
```

### [4. Create a check](#create-a-check)

After the user has uploaded the first document and a live photo or video, create a check containing a Document report and one type of Facial Similarity report.

The first check will compare the first document uploaded to the live photo or video submitted.

### [5. Re-initialize the SDK](#re-initialize-the-sdk)

**Without waiting for the first check to be completed**, re-initialize the SDK for the second document capture flow.

The end user will not see that the SDK has been re-initialized, but will continue through the SDK flow process to upload a second document. After this step the user has completed the verification flow.

**Note:** You can re-initialize the SDK using the same SDK token or by generating a new SDK token.
**Example second initialization of the SDK (iOS)**

```swift
func SecondStep(){
        let config = try! OnfidoConfig.builder()
            .withSDKToken(sdkToken)
            .withDocumentStep(ofType: .passport(config: nil))
            .build()

        let onfidoFlow = OnfidoFlow(withConfiguration: config)
            .with(responseHandler: { results in
                switch results {
                case .success:
                    self.SendSecondDocument()
                case .cancel:
                    self.resetApp()
                case .error(_):
                    self.resetApp()
                @unknown default:
                    self.resetApp()
                }
            })

        let onfidoRun = try! onfidoFlow.run()
        self.present(onfidoRun, animated: true, completion: nil)
    }
```

**Example handle completion of second step (iOS)**

```swift
func SendSecondDocument() {
    // Note that a second check can't start on the same applicant while
    // another one is ongoing. Your backend should handle this logic by
    // implementing a Webhook listener and a check queue.
        let parameters: [String:Any] = [
            "applicant_id": applicantId,
            "report_names": [
                "document",
                "facial_similarity_video"
            ],
            "document_ids": [
                secondDocumentId
            ]
        ]
        AF.request("\(remoteServer)/check_loop",
                   method: .post,
                   parameters: parameters,
                   encoding: JSONEncoding.default).response{ response in
                    print(response.value as Any)
                   }
        self.resetApp()

        let alert = UIAlertController(title: "Data upload completed", message: "You can monitor check progress\nand status on your Dashboard", preferredStyle: .alert)

        alert.addAction(UIAlertAction(title: "Close", style: .default, handler: nil))

        self.present(alert, animated: true)
    }
```

### [6. Submit a second check](#submit-a-second-check)

After the second document has been uploaded, submit a second check containing a Document report and Facial Similarity report. The second check will compare the second document uploaded to the live photo or live video submitted.

**Note:** If you require specific driving license information, such as obtainment date, you can use the [Document with Driving License Information](/api/latest/#document-with-driving-license-information) document report in the associated check.
**Note:** Any Facial Similarity report will always compare to the latest uploaded identity document associated with the applicant ID.

### 7. Recieve the results of both checks

If you have [set up webhooks](/getting-started/quick-start-guide/#step-seven-receiving-webhooks), a webhook notification will be sent upon completion of each check.

You can retrieve an individual check or report's status and result via the API. Further details on how to retrieve checks can be found in our [API reference](/api/latest/#retrieve-check).