# ID Card Recognition SDK - Server

{% hint style="info" %}
We provide the ID Card Recognition SDK for both Windows and Linux.
{% endhint %}

## Features

* [x] Support ID documents from 200+ countries
* [x] Document Detection
* [x] Recognition of ID Cards, Passports, Driver's Licenses
* [x] MRZ Recognition
* [x] Document Image Extraction
* [x] Portrait Image Extraction
* [x] 130+ languages, by including Greek, Arabic, Latin, Cyrillic, Hebrew, Chinese, and more

## License

We offer `lifetime license(perpetual license)` based on `machine ID` for server(Windows, Linux). The license is available for `one-time payment`. In other words, once you purchase license from me, you can use our SDK permanently.

To request a license, please contact us:

> **Email:** <contact@kby-ai.com>&#x20;
>
> **Telegram:** @kbyaisupport&#x20;
>
> **WhatsApp:** +19092802609

## System Requirements

### 1. Windows

* **CPU:** 2 cores or more (Recommended: 2 cores)
* **RAM:** 4 GB or more (Recommended: 8 GB)
* HDD: 4 GB or more (Recommended: 8 GB)
* **OS:** Windows 7 or later
* **Architecture:** x64

### 2. Linux

* **CPU:** 2 cores or more (Recommended: 2 cores)
* **RAM:** 4 GB or more (Recommended: 8 GB)
* HDD: 4 GB or more (Recommended: 8 GB)
* **OS:** Ubuntu 20.04 or later
* **Architecture:** x64

## Import SDK

1. Python

```python
from idsdk import getMachineCode
from idsdk import setActivation
from idsdk import initSDK
from idsdk import idcardRecognition
```

2. C++

```cpp
#include "idsdk.h"
```

```cmake
# CMake for Windows
target_link_libraries(your_app_name
    /path/to/library/idsdk.lib
)

# CMake for Linux
target_link_libraries(your_app_name
    /path/to/library/libidsdk.so
)
```

## Initializing SDK

1. Step one

* First, obtain the machine code for activation and request a license based on the `machine code`.

```python
# Python code example

machineCode = getMachineCode()
print("machineCode: ", machineCode.decode('utf-8'))
```

```cpp
// C++ code example

printf("machine code: %s\n", getMachineCode());
```

2. Step Two

* Next, activate the SDK using the received license.

```python
# Python code example

setActivation(license.encode('utf-8'))
```

```cpp
// C++ code example

int ret = setActivation("...");
```

* If activation is successful, the return value will be `SDK_SUCCESS`. Otherwise, an error value will be returned.

3. Step Three

* After activation, call the initialization function of the SDK.

```python
# Python code example

initSDK()
```

```cpp
// C++ code example

ret = initSDK();
```

{% hint style="danger" %}
The 'data' model directory should be located in the same path as the library.\
\
For example:\
\|--data\
\|     |--model1.bin\
\|     |--model2.bin\
\|     |--model3.bin\
\|--libidsdk.so\
...
{% endhint %}

* The first parameter is the path to the model.
* If initialization is successful, the return value will be `SDK_SUCCESS`. Otherwise, an error value will be returned.

## APIs

### 1. getMachineCode

First, obtain the machine code for activation and request a license based on the `machine code`.

```python
# Python code example

machineCode = getMachineCode()
print("machineCode: ", machineCode.decode('utf-8'))
```

```cpp
// C++ code example

printf("machine code: %s\n", getMachineCode());
```

### 2. setActivation

Next, activate the SDK using the received license.

```python
# Python code example

setActivation(license.encode('utf-8'))
```

```cpp
// C++ code example

int ret = setActivation("...");
```

If activation is successful, the return value will be `SDK_SUCCESS`. Otherwise, an error value will be returned.

### 3. initSDK

After activation, call the initialization function of the SDK.

```python
# Python code example

initSDK()
```

```cpp
// C++ code example

ret = initSDK();
```

The first parameter is the path to the model.

If initialization is successful, the return value will be `SDK_SUCCESS`. Otherwise, an error value will be returned.

### 4. idcardRecognition

The SDK provides a `single API` for `ID card recognition`.&#x20;

The function can be used as follows:

```python
# Python code example

jsonResult = idcardRecognition(base64_image.encode('utf-8'))
```

```cpp
// C++ code example

char* jsonResult = idcardRecognition(base64_image);
```

The function accepts only one parameter, which should be the `base64-encoded` format of the image (e.g., `JPG`, `PNG`, etc.).

If the recognition is successful, the function will return a `JSON-formatted` string containing the recognized information. In case of failure, the return value will be `NULL`.


---

# 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.kby-ai.com/help/product/id-card-recognition-sdk/id-card-recognition-sdk-server.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.
