> For the complete documentation index, see [llms.txt](https://docs.vida.id/identity-stack/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.vida.id/identity-stack/verify/document-ai/ocr-and-document-verification/ocr-and-document-verification-v2/summary-endpoint/perform-ocr-and-id-verification.md).

# Perform OCR and ID Verification

The OCR + ID Verification service enables simultaneous Optical Character Recognition and Identity Verification. By including both "`ocr`" and "`idVerification`" in the operations list, and supplying the necessary data, users can initiate the processes.

**The API concurrently performs both operations and returns the extracted information and verification results.**

### API Description

<mark style="color:green;">`POST`</mark> `https://{vida-host}/api/v2/verify/summary`

#### Headers

<table><thead><tr><th width="161.58258056640625">Name</th><th width="176.22442626953125">Type</th><th>Description</th></tr></thead><tbody><tr><td>Content-Type</td><td>application/json</td><td>Format type of request body</td></tr><tr><td>Authentication<mark style="color:red;">*</mark></td><td>string</td><td>Bearer &#x3C;Token></td></tr></tbody></table>

#### Request Body

<table><thead><tr><th width="137.6893310546875">Name</th><th width="98">Type</th><th>Description</th></tr></thead><tbody><tr><td>operations<mark style="color:red;">*</mark></td><td>String</td><td>["ocr", "idVerification"]</td></tr><tr><td>payload<mark style="color:red;">*</mark></td><td>String</td><td><p>{ </p><p>    "partnerTrxId": "random-uuid", </p><p>    "groupId": "random-uuid",</p><p>    "country": "country code",</p><p>    "idType": "ID_TYPE",</p><p>    "idSubtype": "IDSubType",</p><p>    "idFrontSideImage": "Base64 encoded image of ID frontside", </p><p>    "idBackSideImage": "Base64 encoded image of ID backside" <em>(<strong>if enabled)</strong></em></p><p>}</p></td></tr><tr><td>userConsent<mark style="color:red;">*</mark></td><td>String</td><td><p>{ </p><p>    "userIp": "0.0.0.0",</p><p>    "country": "MYS",</p><p>    "obtained": true,</p><p>    "obtainedAt": "1680700959"</p><p>}</p></td></tr></tbody></table>

## Sample Request and Response

Example request and response formats are listed below for Malaysian cards, KTP cards and Passports.

{% hint style="info" %}
Note: The response includes a transaction ID, any warnings or errors that arose during processing, and the results of the OCR and ID Verification process. Due to the size of the response, specific result details are truncated in these examples.
{% endhint %}

## Malaysian Cards

### Request

<details>

<summary>Request</summary>

```json
{
  "operations": ["ocr", "idVerification"],
  "payload": {
    "partnerTrxId": "random-uuid",
    "groupId": "random-uuid", 
    "idType": "ID_CARD",
    "country": "MYS",
    "idSubtype": "MyKad",
    "idFrontSideImage": "Base64 encoded image of ID front side",
    "idBackSideImage": "Base64 encoded image of ID back side" //if enabled
  },
  "userConsent": {
    "userIP": "0.0.0.0",
    "country": "MYS",
    "obtained": true,
    "obtainedAt": "1680700959"
  }
}
```

</details>

### Success Response

HTTP Status Code: `200`&#x20;

#### MyKad

<details>

<summary>Success JSON Response</summary>

```json
{
    "transactionId": "unique transaction id generated to identify this transaction",
    "partnerTrxId": "partner transaction id submitted by customer in request",
    "groupId": "partner group id submitted by customer in request",
    "imageQualityResult": {
        "front": {
            "statusCode": 5000
        },
        "back": {
            "statusCode": 5000
        }
    },
    "card": {
        "country": "MALAYSIA",
        "type": "MyKad",
        "isoAlpha3CountryCode": "MYS",
        "isoAlpha2CountryCode": "MY"
    },
    "idVerificationResult": {
        "front": {
            "statusCode": 5000
        },
        "back": {
            "statusCode": 5000
        }
    },
    "ocrResult": {
        "front": {
            "idNumber": "ID Number from ID Card",
            "name": "Name",
            "address": "Address",
            "dob": "YYYY-MM-DD",
            "citizenship": "Country",
            "gender": "Gender from ID Card",
            "religion": "Religion"
        },
        "back": {
            "extendedIdNumber": "xxxxxx-xx-xxxx-xx-xx"
        }
    }
}
```

</details>

#### Non-MyKad (MyKAS, MyPR, MyTentera)

<details>

<summary>Success JSON Response</summary>

```json
{
    "transactionId": "unique transaction id generated to identify this transaction",
    "partnerTrxId": "partner transaction id submitted by customer in request",
    "groupId": "partner group id submitted by customer in request",
    "imageQualityResult": {
        "front": {
            "statusCode": 5000
        },
        "back": {
            "statusCode": 5000
        }
    },
    "card": {
        "country": "MALAYSIA",
        "type": "MyTentera", //depends on Malaysian Card type used 
        "isoAlpha3CountryCode": "MYS",
        "isoAlpha2CountryCode": "MY"
    },
    "idVerificationResult": {
        "front": {
            "statusCode": 5000
        },
        "back": {
            "statusCode": 5000
        }
    },
    "ocrResult": {
        "front": {
            "idNumber": "ID Number from ID Card",
            "name": "Name",
            "address": "Address",
            "dob": "YYYY-MM-DD",
            "gender": "Gender from ID Card",
            "religion": "Religion",
            "militaryId": "Military-ID",
            "militaryRank": "Military-RANK",
            "militaryDivision": "Military-DIVISION"
        },
        "back": {
            "extendedIdNumber": "ID NUMBER"
        }
    }
}
```

</details>

## KTP

### Request

<details>

<summary>Request</summary>

```json
{
    "operations": ["ocr","idVerification"],
    "payload": {
        "partnerTrxId": "{{$guid}}",
        "groupId":"{{$guid}}",
        "country": "IDN",
        "idType": "ID_CARD",
        "idSubtype": "KTP",
        "idFrontSideImage":"Base64 encoded image of KTP card"
      },
      "userConsent": {
        "userIp": "226.80.211.232",
        "country": "IDN",
        "obtained": true,
        "obtainedAt": "1680700959"
    }
}
```

</details>

### Success Response

HTTP Status Code: `200`&#x20;

<details>

<summary>Success JSON Response</summary>

<pre class="language-json"><code class="lang-json">{
    "transactionId": "unique transaction id generated to identify this transaction",
<strong>    "partnerTrxId": "partner transaction id submitted by customer in request",
</strong>    "groupId": "partner group id submitted by customer in request",
    "imageQualityResult": {
        "front": {
            "statusCode": 5000
        }
    },
    "card": {
        "country": "INDONESIA",
        "type": "KTP",
        "isoAlpha3CountryCode": "IDN",
        "isoAlpha2CountryCode": "ID"
    },
    "idVerificationResult": {
        "front": {
            "statusCode": 5000
        }
    },
    "ocrResult": {
        "front": {
            "idNumber": "ID-Number",
            "name": "NAME",
            "address": "Address",
            "dob": "DD-MM-YYYY",
            "gender": "Gender from id card (M/F/O)",
            "religion": "Religion",
            "province": "Provience",
            "city": "City",
            "placeOfBirth": "Place Of Birth",
            "bloodType": "Blood type",
            "neighborhoodAssociationGroup": "Neighborhood Assocaition Group",
            "village": "Village",
            "subDistrict": "Sub District",
            "maritalStatus": "Marital Status",
            "occupation": "Occupation",
            "nationality": "Nationality",
            "validUntil": "Expired ID Card"
        }
    }
}
</code></pre>

</details>

## Passport&#x20;

### Request

<details>

<summary>Request</summary>

```json
{
    "operations": ["ocr","idVerification"],
    "payload": {
        "partnerTrxId": "{{$guid}}",
        "groupId":"{{$guid}}",
        "country": "IND",
        "idType": "PASSPORT",
        "idSubtype": "N/A",
        "idFrontSideImage":"Base64 encoded image of passport front side"
      },
      "userConsent": {
        "userIp": "226.80.211.232",
        "country": "IND",
        "obtained": true,
        "obtainedAt": "1680700959"
    }
}
```

</details>

### Success Response

HTTP Status Code: `200`&#x20;

<details>

<summary>Success JSON Response</summary>

<pre class="language-json"><code class="lang-json">{
    "transactionId": "unique transaction id generated to identify this transaction",
    "partnerTrxId": "partner transaction id submitted by customer in request",
<strong>    "groupId": "partner group id submitted by customer in request",
</strong>    "card": {
        "country": "Romania",
        "type": "PASSPORT",
        "isoAlpha3CountryCode": "ROU",
        "isoAlpha2CountryCode": "RO"
    },
    "ocrResult": {
        "front": {
            "idNumber": "Id-Number",
            "name": "Name from Passport",
            "dob": "YYYYMMDD",
            "gender": "Gender from Passport",
            "placeOfBirth": "Place of birth from passport",
            "dateOfExpiry": "Date of expiry",
            "dateOfIssue": "Date of Issuance",
            "citizenship": "citizenship from passport",
            "issuerName": "issuer name from passport",
            "issuerCountry": "issuer country from passport",
            "issuingAuthority": "issuing authority from passport"            "issuingAuthority": "DÂMBOVIȚA"
        }
    },
    "idVerificationResult": {
        "front": {
            "statusCode": 5000
        }
    }
}

</code></pre>

</details>
