# Lookup Flow

**Note:** This feature requires an additional permission and must be explicitly requested

The "Lookup Flow" it's the same as the "Enrollment Flow" with the only difference that the first step is not the automatic scanning of a document through the camera phone but the user is asked to manually type in some information of the document that can be used to perform the lookup on the government database. Only one document at the time is supported. Other features like facial recognition and background check can be enabled in the same way as per the "Enrollment Flow". Note that not all the documents are supported.

In order to use our SDK you need an authorization token. Please check our API "[Authorisation](/docs/kyc/uqudo-api/authorisation.md)" in this regard.

Add the following code at the start-up of your application to initialize the SDK:

```javascript
import { 
  DocumentType, 
  LookupBuilder, 
  UqudoIdSDK,
  BackgroundCheckConfigurationBuilder,
  FacialRecognitionConfigurationBuilder
} from 'uqudosdk-react-native';

...
//On App startup
constructor(){
    super()
    this.sdk = new UqudoIdSDK();
    this.sdk.init();
  }
...

```

Use the below method for setting the locale of the application:

```javascript
...
new UqudoIdSDK().setLocale(<your locale eg. en, ar etc.>);
...
```

To check if a document supports lookup and lookup + facial recognition you can use the below methods:

```javascript
...
const isLookupSupported = await this.sdk.isLookupSupported(DocumentType.NGA_DL);
const isLookupFacialRecognitionSupported = await this.sdk.isLookupFacialRecognitionSupported(DocumentType.NGA_DL);
...
```

Below, you can find an example on how to initiate the lookup flow:

```javascript
try {
    let lookupConfiguration = new LookupBuilder()
                .setToken(token)
                .setDocumentType(DocumentType.NGA_DL)
                .enableFacialRecognition(
                	new FacialRecognitionConfigurationBuilder()
                		.setLookupMinimumMatchLevel(4)
                		.build()
                )
                .enableBackgroundCheck(
                	new BackgroundCheckConfigurationBuilder()
                		.skipView()
                		.build()
                )
                .build();
   const result = await this.sdk.lookup(lookupConfiguration);
} catch (error) {
   console.log(JSON.parse(error.code));
   // {"code":"USER_CANCEL","message":"User canceled the Enrollment process","task":"LOOKUP"}
}
```

In order to evaluate all the possible options please refer to section [Lookup Flow](/docs/kyc/uqudo-sdk/integration/android/lookup-flow.md). The JS interface is the porting of the Kotlin implementation. You can find the JS implementation in uqudoBuilder/uqudo.js under the uqudoid module path.

If **successful**, the response is a JSON Web Signature (JWS). Please refer to section "[SDK result](/docs/kyc/uqudo-sdk/sdk-result.md)" for further details.

In case of a **failure**, the callback returns the following object:

<table><thead><tr><th width="122">Property</th><th width="83">Type</th><th width="99">Optional</th><th width="96">Default</th><th>Description</th></tr></thead><tbody><tr><td>code</td><td>String</td><td>No</td><td>None</td><td>See <a href="/pages/UR6uc5miVN2hQN8J0q8L#handling-the-result">Handling the Result</a></td></tr><tr><td>message</td><td>String</td><td>Yes</td><td>null</td><td>Description of the error if any</td></tr><tr><td>task</td><td>String</td><td>Yes</td><td>null</td><td>See <a href="/pages/UR6uc5miVN2hQN8J0q8L#handling-the-result">Handling the Result</a></td></tr></tbody></table>

Add the following event to enable the tracing mechanism. Please refer to section [Analytics](/docs/kyc/uqudo-sdk/integration/android/analytics.md) for details.

```javascript
(new NativeEventEmitter(NativeModules.UqudoId)).addListener('TraceEvent', (event) => {
     console.log(JSON.stringify(event));
  });
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.uqudo.com/docs/kyc/uqudo-sdk/integration/react-native/lookup-flow.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
