# Optical Character Recognition V2

## Introduction

OCR (Optical Character Recognition) is a service that extracts information from various types of images, such as photos, PDFs, and handwritten files, and then converts them into machine-encoded text. This eliminates the need for manual data entry in certain business applications.

Many cloud vendors like Google, offer original OCR services. However, insureMO OCR service acts as an adapter that connects various OCR vendors like Google, and provides a unified interface to consumer applications.

## Basic UI Operations

### Entrance
1. Click **Sign in** to log in to [insureMO Portal](https://portal.insuremo.com/) with your personal account.

   <div class="docs-info"><span class="docs-admonitions-text">info</span>

   If you do not have a personal insureMO account, click **Sign up** to register one.

   </div>

2.  Select **Catalog** at the top of the home page.

3.  In the left pane of **Catalog** page, navigate to **Non Insurance Services > OCR** to find the **OCR Service v2** service card.


![ocr-card](./image/ocr_service/ocr-card.png)

4. For creation and other actions, click **Setting** to go to the **OCR Management** page.

![ocr-setting](./image/ocr_service/ocr-setting.png)

5. This will navigate you to the main OCR configuration page where you can manage the service.

![ocr-page](./image/ocr_service/ocr-page.png)

### Configuration Management

#### Create

- Click **Create** on the OCR service console.

![config-create_01](./image/ocr_service/config-create_01.png)

- Fill in the configuration details and click **Submit**.

![config-create_02](./image/ocr_service/config-create_02.png)

#### Edit

- Click **Edit** on the OCR service console to update the configuration.  

![config-edit](./image/ocr_service/config-edit.png)

#### Delete

- Click **Delete** against a particular record to delete the configuration.

![config-delete](./image/ocr_service/config-delete.png)

<div class="docs-note"><span class="docs-admonitions-text">note</span>  

After being deleted, the configuration will no longer be used. Therefore, before deleting the configuration, please make sure that no application is using it.

</div>

#### Share

- Click **Share** to share the current configuration with other tenants.

![config-share_01](./image/ocr_service/config-share_01.png)

![config-share_02](./image/ocr_service/config-share_02.png)

#### Test

- After the configuration is created, you can verify whether the current configuration is available through a test.

![config-test_01](./image/ocr_service/config-test_01.png)

-  Upload the file you want to identify with OCR and fill in the required information. Then click **Extract**. If the configuration is available, you will see the result of OCR recognition on the right side of the test panel.

![config-test_03](./image/ocr_service/config-test_03.png)

# OCR API Information

## Authentication

- HTTP Authentication, scheme: bearer

<a id="opIdProcessOCRBinary"></a>

## POST ProcessOCRBinary

|                           API URL                            | Method |
| :----------------------------------------------------------: | :----: |
| [https://\[HOST\]/mo-fo/1.0/eco/ocr/process/binary](https://[host]/mo-fo/1.0/eco/ocr/process/binary) |  POST  |

### Header

|     Parameter      |                     Value                     |
| :----------------: | :-------------------------------------------: |
| Authorization      |    Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXX       |

### Body Parameters

```json
{
  "code": "config-code-sample",
  "vendor_action": "string",
  "template_id": "string",
  "vendor_params_json": {},
  "vendor_param_xxx": "string",
  "body": "string",
}
```

### Response Examples

```json
{
  "code": "string",
  "data": {
    "process_id": "string",
    "result": "string"
  },
  "message": "string",
  "message_params": [
    "string"
  ],
  "trace_id": "string"
}
```

<a id="opIdProcessOCRJSON"></a>

## POST ProcessOCRJSON

|                           API URL                            | Method |
| :----------------------------------------------------------: | :----: |
| [https://\[HOST\]/mo-fo/1.0/eco/ocr/process/json](https://[host]/mo-fo/1.0/eco/ocr/process/json) |  POST  |

### Header

|     Parameter      |                     Value                     |
| :----------------: | :-------------------------------------------: |
| Authorization      |    Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXX       |

### Body Parameters

```json
{
  "code": "config-code-sample",
  "content": "string",
  "template_id": "string",
  "url": "string",
  "vendor_action": "string",
  "vendor_params": {
    "property1": "string",
    "property2": "string"
  },
  "vendor_params_json": {}
}
```

### Response Examples

```json
{
  "code": "string",
  "data": {
    "process_id": "string",
    "result": "string"
  },
  "message": "string",
  "message_params": [
    "string"
  ],
  "trace_id": "string"
}
```

# Additional Resources
1. If you want to use the SDK, see 
[Welcome to insureMO SDK for Java](https://docs.insuremo.com/common/doc_00000089).

2. For more API documentation, see [ECO Service](https://docs.insuremo.com/tech/pro/sdk/api/ocr).
