# Documents OCR

## General Input For Any Request

<mark style="color:green;">`POST`</mark> `https://api.vlenseg.com/v1/<endpoint_path>`

#### Headers

| Name                                           | Type   | Description      |
| ---------------------------------------------- | ------ | ---------------- |
| Content-Type<mark style="color:red;">\*</mark> | string | application/json |
| ApiKey<mark style="color:red;">\*</mark>       | string | API Key          |

#### Request Body

| Name                                    | Type   | Description                                                                                                                                                                                                                 |
| --------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| image<mark style="color:red;">\*</mark> | string | The base 64 encoding of the document image                                                                                                                                                                                  |
| transaction\_id                         | GUID   | The transaction Id. Required if this image belongs to an existing transaction. If null then a new transaction Id will be generated and returned in the response to be used in subsequent requests for the same transaction. |
| client\_transaction\_id                 | string | Any client generated Id that is recognized and used by the client. It will be returned in the response as is.                                                                                                               |

{% tabs %}
{% tab title="200 success" %}

```javascript
{
  "data": <Data model according to each model described below>,
  "Services": {
      "Validations": {
        "validation_errors": [
          {
            "field": <string>,
            "value": <string>,
            "errors": [
              {
                "code": <int>,
                "message": <string>
              }
            ]
          }
        ]
      },
      "spoofing": {
        "fake": <bool>
      },
      "classification": {
        "doc_type": <string>
      }
    }
  },
  "error_code": <int>,
  "error_message": <string>
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```javascript
```

{% endtab %}

{% tab title="401: Unauthorized " %}

```javascript
{
  "data": null,
  "Services": null,
  "error_code": 401,
  "error_message": "Unauthorized – invalid API Key"
}
```

{% endtab %}
{% endtabs %}

### National ID front side

## Sends National ID Front Image

<mark style="color:green;">`POST`</mark> `https://<base-url>/ocr/id/front`

Use parameters mentioned in general input above, check the data model in responses below.

{% tabs %}
{% tab title="200: OK Data model for ID front image" %}

```json
{
  "data": {
      "name": <string>,
      "address": <string>,
      "first_name": <string>,
      "last_names": <string>,
      "first_name_english": <string>,
      "last_names_english": <string>,
      "govern": <string>,
      "idKey": <string>,
      "dateOfBirth": <date>,
      "address_1": <string>,
      "address_2": <string>,
      "idNumber": <string>,
      "gender": <string>,
      "transaction_id": <GUID>,
      "client_transaction_id": <string>,
      "request_id": <GUID>
    },
    .
    .
    .
}
```

{% endtab %}
{% endtabs %}

### National ID back side

## Sends National ID Back Image

<mark style="color:green;">`POST`</mark> `https://<base-url>/ocr/id/back`

Use parameters mentioned in general input above, check the data model in responses below.

{% tabs %}
{% tab title="200: OK Data model for ID back image" %}

```json
{
  "data": {
      "job": <string>,
      "jobTitle": <string>,
      "religion": <string>,
      "maritalStatus": <string>,
      "husbandName": <string>,
      "releaseDate": <date>,
      "idExpiry": <date>,      
      "idNumber": <string>,
      "gender": <string>,
      "transaction_id": <GUID>,
      "client_transaction_id": <string>,
      "request_id": <GUID>
    },
    .
    .
    .
}
```

{% endtab %}
{% endtabs %}

### Car License front side

## Sends Car License Front Image

<mark style="color:green;">`POST`</mark> `https://<base-url>/ocr/car/license/front`

Use parameters mentioned in general input above, check the data model in responses below.

{% tabs %}
{% tab title="200: OK Data model for Car License Front image" %}

```json
{
  "data": {
      "traffic_unit": <string>,
      "license_number": <string>,
      "license_type": <string>,
      "name": <string>,
      "name_2": <string>,
      "nationality": <string>,
      "address": <string>,      
      "expiry": <date>,
      "issuance": <date>,
      "front_special": <string>,      
      "transaction_id": <GUID>,
      "client_transaction_id": <string>,
      "request_id": <GUID>
    },
    .
    .
    .
}
```

{% endtab %}
{% endtabs %}

### Car License back side

## Sends Car License Back Image

<mark style="color:green;">`POST`</mark> `https://<base-url>/ocr/car/license/back`

Use parameters mentioned in general input above, check the data model in responses below.

{% tabs %}
{% tab title="200: OK Data model for Car License back image" %}

```json
{
  "data": {
      "model_year": <string>,
      "type": <string>,
      "sub_type": <string>,
      "sub_type_2": <string>,
      "chasis": <string>,
      "volume": <string>,
      "motor": <string>,      
      "color": <string>,
      "fuel": <string>,
      "cylinder": <string>,
      "special_1": <string>,
      "examination_dt": <string>,
      "special_2": <string>,
      "special_3": <string>,
      "special_4": <string>,       
      "transaction_id": <GUID>,
      "client_transaction_id": <string>,
      "request_id": <GUID>
    },
    .
    .
    .
}
```

{% endtab %}
{% endtabs %}

### Passport

## Sends Passport Image

<mark style="color:green;">`POST`</mark> `https://<base-url>/ocr/passport`

{% tabs %}
{% tab title="200: OK Data model for Passport image" %}

```json
{
  "data": {
      "Date_of_Birth": <date>,
      "Date_of_Expiry": <date>,
      "country_code": <string>,
      "doc_Type": <string>,
      "gender": <string>,
      "name": <string>,
      "nationality": <string>,      
      "passport_no": <string>,     
      "transaction_id": <GUID>,
      "client_transaction_id": <string>,
      "request_id": <GUID>
    },
    .
    .
    .
}
```

{% endtab %}
{% endtabs %}

### Driving License

## Sends Driving License Image

<mark style="color:green;">`POST`</mark> `https://<base-url>/ocr/driving_license`

{% tabs %}
{% tab title="200: OK Data model for Driving License image" %}

```json
{
  "data": {
      "address": <string>,
      "expiryDate": <date>,
      "issuenceDate": <date>,
      "job": <string>,
      "licenseType": <string>,
      "nameArabic": <string>,
      "nameEnglish": <string>,      
      "nationalID": <string>,
      "nationalityArabic": <string>,
      "nationalityEnglish": <string>,
      "trafficUnit1": <string>,
      "trafficUnit2": <string>,
      "special1": <string>,   
      "transaction_id": <GUID>,
      "client_transaction_id": <string>,
      "request_id": <GUID>
    },
    .
    .
    .
}
```

{% endtab %}
{% endtabs %}

### License Plate

## Sends License Plate Image

<mark style="color:green;">`POST`</mark> `https://<base-url>/ocr/license_plate`

{% tabs %}
{% tab title="200: OK Data model for License Plate image" %}

```json
{
  "data": {
      "result": <string>,
      "transaction_id": <GUID>,
      "client_transaction_id": <string>,
      "request_id": <GUID>
    },
    .
    .
    .
}
```

{% endtab %}
{% endtabs %}

### Multi card

## Sends an image containing multiple documents

<mark style="color:green;">`POST`</mark> `https://<base-url>/ocr/multi`

{% tabs %}
{% tab title="200: OK " %}

```json
{
  "data": {
    "results":[
        {
          "data": <Data model according to each model described below>,
          "Services": <Same services object returned with each result>
        },
        .
        .
      ],   
      "transaction_id": <GUID>,
      "client_transaction_id": <string>,
      "request_id": <GUID>
    },
    .
    .
    .
}
```

{% endtab %}
{% endtabs %}

### General OCR

## Sends any image containing any general text to be recognized and extracted

<mark style="color:green;">`POST`</mark> `https://<base-url>/ocr/general`

{% tabs %}
{% tab title="200: OK " %}

```json
{
  "data": {
      "lines": [
        {
          "text": <string>
        },
        .
        .
      ]
    },
    .
    .
    .
}
```

{% endtab %}
{% endtabs %}

## Postman collection for documents OCR

{% file src="/files/YB4W5eU5wGHrbn8m9tIJ" %}


---

# 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://apidoc.vlens.co/reference/api-reference/documents-ocr.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.
