# Egyptian Commercial Register ID OCR

***

Valify's Commercial Register OCR empowers organizations to effortlessly extract accurate and relevant information from Egyptian Commercial Register documents. Our powerful solution automates data extraction in a structured format, ensuring compliance with Egyptian regulatory requirements and streamlining business processes.

## Egyptian Commercial Register API

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

#### Headers

| Name                                             | Type   | Description            |
| ------------------------------------------------ | ------ | ---------------------- |
| Content-Type<mark style="color:red;">\*</mark>   | string | application/json       |
| Authentication<mark style="color:red;">\*</mark> | string | Bearer \<access-token> |

#### Request Body

| Name                                             | Type   | Description                                                                                                                                                                                              |
| ------------------------------------------------ | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| document\_type<mark style="color:red;">\*</mark> | string | egy\_cr                                                                                                                                                                                                  |
| data<mark style="color:red;">\*</mark>           | object | <p>Object containing the parameters below:<br><code>{</code> <br>  <code>document: \<base64 str>,</code><br>  <code>bundle\_key: \<str>,</code><br>  <code>lang: \<str></code><br><code>}</code><br></p> |

**Status Codes**

{% tabs %}
{% tab title="✅200 Successful" %}

```python
{
    "result": {
        "company_type": '<str>',
        "cr_number": '<str>',
        "cr_unique_number": '<str>',
        "licensing_authority": '<str>',
        "company_name": '<str>',        
        "company_commercial_name": '<str>',
        "incorporation_date": '<str>',
        "renewal_date": '<str>',
        "address": '<str>',
        "owners": '<list>',
        "capital": '<str>',
        "paid_in_capital": '<str>',
        "partners_share_value": '<str>',
        "in_kind_shares_value": '<str>',
        "remaining_capital_pledged": '<str>',
        "document_issue_date": '<str>'
    },
    "transaction_id": '<str>',
    "trials_remaining": '<int>'
}

```

{% endtab %}

{% tab title="400 Missing input data" %}

```python
{
    "message": "Bad Request – invalid request received (e.g. missing Bundle key, required parameters or invalid json) | Make sure all the required parameters are included"
}
```

{% endtab %}

{% tab title="401 Invalid bundle key" %}

```python
{
    "message": "Unauthorized – your Bundle key is invalid"
}
```

{% endtab %}

{% tab title="403 Access token error" %}

```python
{
    "message": "Forbidden – specified access_token could not be found"
}
```

{% endtab %}

{% tab title="404 Check the endpoint" %}

```python
{
    "message": "Not Found"
}
```

{% endtab %}

{% tab title="415 The format should be base64" %}

```python
{
    "message": "Unsupported Media Type"
}
```

{% endtab %}

{% tab title="422 Check Valify error codes" %}

```python
{
    "message": "<error-description>",
    "error_code": <valify-error-code>
}
```

{% endtab %}

{% tab title="500 Contact us" %}

```python
{
    "message": "Internal Server Error"
}
```

{% endtab %}
{% endtabs %}

***

## Integration&#x20;

{% tabs %}
{% tab title="🐍Python 3" %}
{% code overflow="wrap" fullWidth="true" %}

```python
import requests
import base64

def base64_encode(file_name):
    with open(file_name, "rb") as image_file:
        encoded_string = base64.b64encode(image_file.read())
        return encoded_string
    return ""

cr_document = base64_encode('<image path>')
token = "<token>"
data = {
    'document_type': 'egy_cr', 
    'data':
    {   
        'document': <Base64>,
        'bundle_key': '<bundle key>',
        'lang': '<str>' # optional, default: en
    }
}

r = requests.post("https://<base-url>/api/v1/ocr/",
        json=data,
        headers={'Authorization': 'Bearer %s' % token}
    )
print(r.json())                      
```

{% endcode %}
{% endtab %}
{% endtabs %}
