# Identity Document scanner API

Andia Scanning technology works on driving licenses, passports,  Mexican Voter IDs, travel visas, and others documents.

![](/files/-LvIp6Z15Nnt2kvP8axp)

## Requirements

A **desktop** or mobile web browser.

## Integration

The integration of this SDK is very straight forward.

1\) Inside any HTML page just import the Javascript library before the **\</body>** tag

```markup
�<script src="https://s3.us-east-2.amazonaws.com/api.andia/andiaScanSdk.js" ></script>
<div class="component-wrapper">
    <andia-ui-web  autoscroll>
        <img slot="loader-image" src="https://s3.us-east-2.amazonaws.com/api.andia/loader-icon.1.0.41.gif" />
    </andia-ui-web>
</div>
<div id="result" ></div>
```

**2) Callback**

To get the result of the scan, just implement the following 2 javascript functions &#x20;

```javascript
<script type="text/javascript">
    AndiaScan.SDK.SetApiKey('YOUR_API_KEY');
    document.querySelector('andia-ui-web').addEventListener('resultReady', function(event) {
        var result = event.detail.result;
        $("#result").append(JSON.stringify(result));  //do something
        console.log(JSON.stringify(result));
    });
    document.querySelector('andia-ui-web').addEventListener('error', function(event) {
        var error = event.error, message = event.message;
        $("#result").append(JSON.stringify(error)); //do something
    });
</script>
```

{% hint style="info" %}
**`Parameters`**

**YOUR\_API\_KEY** .    Your customer API\_KEY , **mandatory**  (we provide these credentials)
{% endhint %}

> Response JSON&#x20;
>
> **success** .       Boolean, true if the Selfie was made successful
>
> **data**                A JSON object with the following fields.

```javascript
//Example Response
{
	"success": true,
	"error_code": 0,
	"data": [{
		"primaryID": "DIAZ LOPEZ",
		"secondaryID": "JOSE ROBERTO",
		"documentCode": "P<",
		"documentNumber": "G12501128",
		"documentType": "PASSPORT",
		"issuer": "MEX",
		"sex": "M",
		"nationality": "MEX",
		"dateOfBirth": {
			"day": 19,
			"month": 10,
			"year": 1993,
			"originalString": "931019"
		},
		"dateOfExpiry": {
			"day": 13,
			"month": 11,
			"year": 2022,
			"originalString": "221113"
		},
		"alienNumber": "",
		"applicationReceiptNumber": "",
		"immigrantCaseNumber": "",
		"mrtdVerified": true,
		"opt1": "<<<<<<<<<<<<<<",
		"opt2": "",
		"rawMRZString": "P<MEXDIAZ<LOPEZ<<JOSE<LOPEZ<<<<<<<<<<<<<<<<<\nG125011284MEX9310195M2211178<<<<<<<<<<<<<<04\n",
		"type": "MRTD"
	}]
}
```

>


---

# 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://andia.gitbook.io/api/identity-document-scanning.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.
