# API Reference

### get\_deviceid <a href="#get_device_id" id="get_device_id"></a>

```python
def get_deviceid() -> str:
```

<table data-header-hidden><thead><tr><th width="136"></th><th></th></tr></thead><tbody><tr><td><strong>Name</strong></td><td>get_device_id</td></tr><tr><td><strong>Description</strong></td><td>Retrieves the Hardware ID from a library.</td></tr><tr><td><strong>Input</strong></td><td>None</td></tr><tr><td><strong>Output</strong></td><td>The Hardware ID is returned as a standard Python string.</td></tr></tbody></table>

### set\_activation

{% code overflow="wrap" %}

```python
def set_activation(license_key: str) -> str:
```

{% endcode %}

<table data-header-hidden><thead><tr><th width="137"></th><th></th></tr></thead><tbody><tr><td><strong>Name</strong></td><td>set_activation</td></tr><tr><td><strong>Description</strong></td><td>Activates the OCR engine using the provided license key.</td></tr><tr><td><strong>Input</strong></td><td><ul><li><strong>license_key</strong> (str): License key string, this should be encoded as UTF-8.</li></ul></td></tr><tr><td><strong>Output</strong></td><td><p>A JSON-formatted string containing the result of the activation</p><p>Typically includes an "errorCode" field indicating the status of the activation. </p><ul><li>0: Success</li><li>Non-zero: Activation failed</li></ul></td></tr></tbody></table>

### init\_sdk

{% code overflow="wrap" %}

```python
def init_sdk(dict_path: str) -> int:
```

{% endcode %}

<table data-header-hidden><thead><tr><th width="137"></th><th></th></tr></thead><tbody><tr><td><strong>Name</strong></td><td>init_sdk</td></tr><tr><td><strong>Description</strong></td><td>Initializes the OCR engine with the required dictionary files.</td></tr><tr><td><strong>Input</strong></td><td><ul><li><strong>dict_path</strong> (str): Path to the engine binary files directory, This path must be provided as a UTF-8 encoded string.</li></ul></td></tr><tr><td><strong>Output</strong></td><td><p>A JSON-formatted string containing the result of the initialization. Typically includes an "errorCode" field indicating the status of the initialization.</p><ul><li>0: Success</li><li>Non-zero: Initialization failed</li></ul></td></tr></tbody></table>

### ocr\_id\_card

{% code overflow="wrap" %}

```python
def ocr_id_card(file_path1: str, file_path2: str) -> str
```

{% endcode %}

<table data-header-hidden><thead><tr><th width="137"></th><th></th></tr></thead><tbody><tr><td><strong>Name</strong></td><td>ocr_id_card</td></tr><tr><td><strong>Description</strong></td><td>Extracts data from ID card</td></tr><tr><td><strong>Input</strong></td><td><ul><li><strong>file_path1</strong> (str): The path to the front image file.</li><li><strong>file_path2</strong> (str): The path to the back image file.</li></ul></td></tr><tr><td><strong>Output</strong></td><td>A JSON-formatted string containing the OCR results.</td></tr></tbody></table>

#### Example of ID OCR results

<div><figure><img src="/files/it4aR7qDapsJd15iANCS" alt=""><figcaption></figcaption></figure> <figure><img src="/files/zHFVHd1PU0pFGABcCtRF" alt=""><figcaption></figcaption></figure></div>

```json
{
	"mrz":	{
		"givenNames":"JOHN",
		"name":"DOE JOHN",
		"dateOfExpiry":"2028-12-07",
		"documentClassCode":"ID",
		"nationality":"Ukraine",
		"surname":"DOE",
		"sex":"M",
		"dateOfBirth":"1964-09-02",
		"mrzCode":"IDUKR00235423491964090245614<<^6409029M2812070UKR<<<<<<<<<<<5^DOE<<JOHN<<<<<<<<<<<<<<<<<<<<<",
		"documentNumber":"002354234",
		"issuingStateCode":"UKR",
		"validState":1
	},
	"ocr":{
		"givenNames":"IOHN",
		"name":"DOE IOHN",
		"dateOfExpiry":"2028-12-27",
		"nationality":"Ukraine",
		"surname":"DOE",
		"sex":"M",
		"dateOfBirth":"1964-09-02",
		"documentNumber":"002354234",
		"personalNumber":"1964090245614",
		"dateOfIssue":"2018-12-27",
		"authority":"7110",
		"regCertRegNumber":"3449913065",
		"placeOfBirth":"Y HRYA",
		"validState":1
	},
	"nation":{
		"name":"\xd0\x94\xd0\x9e\xd0\xa3 \xd0\x94\xd0\x96\xd0\x9e\xd0\x9d \xd0\x99\xd0\x9e\xd0\x92\xd0\x90\xd0\x9d\xd0\x9e\xd0\x92\xd0\x98\xd0\xa7",
		"surname":"\xd0\x94\xd0\x9e\xd0\xa3",
		"givenNames":"\xd0\x94\xd0\x96\xd0\x9e\xd0\x9d",
		"fathersName":"\xd0\x99\xd0\x9e\xd0\x92\xd0\x90\xd0\x9d\xd0\x9e\xd0\x92\xd0\x98\xd0\xa7",
		"nationality":"\xd0\xa3\xd0\x9a\xd0\xa0\xd0\x90\xd0\x87\xd0\x9d\xd0\x90",
		"sex":"\xd0\xa7",
		"placeOfBirth":"\xd0\xa1.\xd0\x9f\xd0\x98\xd0\x90\xd0\x93 \xd0\x92\xd0\x90\xd0\x9b"
	},
	"score":0.934643983840942,
	"position":{
		"left":0,
		"top":0,
		"right":601,
		"bottom":384
	},
	"portrait_rect":{
		"bottom":398,
		"left":21,
		"right":255,
		"top":90
	},
	"errorCode":0,
	"documentName":"Id Card",
	"countryName":"Ukraine",
	"image":{
		"ghostPortrait":"/9j/4AAQSkZJRgABAQEAxw...T680Af/9k=",
		"portrait":"/9j/4AAQSkZJRgABAQEAxwDHA...de9P70f8A8RRRTQj/2Q==",
		"signature":"/9j/4AAQSkZJRgABAQEAxwDH...AAD/2wBDAKKEJH/2Q==",
		"documentFrontSide":"/9j/4AAQSkZJRgAB...D/2wKKKKACiiigD/2Q=="
	}
}

```

### ocr\_credit\_card

```python
def ocr_credit_card(file_path: str) -> str:
```

<table data-header-hidden><thead><tr><th width="137"></th><th></th></tr></thead><tbody><tr><td><strong>Name</strong></td><td>ocr_credit_card</td></tr><tr><td><strong>Description</strong></td><td>Etracts data from credit card</td></tr><tr><td><strong>Input</strong></td><td><ul><li><strong>file_path</strong> (str): The path to the credit card image file.</li></ul></td></tr><tr><td><strong>Output</strong></td><td>A JSON-formatted string containing the OCR results.</td></tr></tbody></table>

### ocr\_barcode

```
def ocr_barcode(file_path: str) -> str:
```

<table data-header-hidden><thead><tr><th width="137"></th><th></th></tr></thead><tbody><tr><td><strong>Name</strong></td><td>ocr_barcode</td></tr><tr><td><strong>Description</strong></td><td>Etracts data from barcode</td></tr><tr><td><strong>Input</strong></td><td><ul><li><strong>file_path</strong> (str): The path to the barcode image file.</li></ul></td></tr><tr><td><strong>Output</strong></td><td>A JSON-formatted string containing the OCR results.</td></tr></tbody></table>


---

# 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.recognito.vision/id-document-recognition-sdk/integration-guide/linux/api-reference.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.
