> 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-v1/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/v1/verify`

#### Headers

| Name                                             | Type   | Description                 |
| ------------------------------------------------ | ------ | --------------------------- |
| Content-Type                                     |        | Format type of request body |
| Authentication<mark style="color:red;">\*</mark> | String | Bearer \<Token>             |

#### Request Body

<table><thead><tr><th width="155">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>}</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"
  },
  "userConsent": {
    "userIP": "0.0.0.0",
    "country": "MYS",
    "obtained": true,
    "obtainedAt": "1680700959"
  }
}
```

</details>

### Success Response

HTTP Status Code: `200`&#x20;

<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": {
      "statusCode": 5000
   },
  "card":{
     "country": "MALAYSIA",
     "type": "MyKad",
     "isoAlpha3CountryCode": "MYS",
     "isoAlpha2CountryCode": "MY"
   },
   "ocrResult": {
     "idNumber": "Id Number from the card",
     "name": "Name from id card",
     "address": "Address from id card",
     "dob": "Date of birth in YYYYMMDD format",
     "citizenship": "Citizenship from id card",
     "gender": "Gender from id card (M/F/O)",
     "religion": "Religion from id card"
  }
  "idVerificationResult": {
     "statusCode": 5000
   }
}
```

</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>

```json
{
    "transactionId": "Transaction Id Generated for this transaction",
    "partnerTrxId": "Partner transaction Id sent by the client",
    "groupId": "Group Id sent by the client",
    "imageQualityResult": {
        "statusCode": 5000
    },
    "card": {
        "country": "INDONESIA",
        "type": "KTP",
        "isoAlpha3CountryCode": "IDN",
        "isoAlpha2CountryCode": "ID"
    },
    "idVerificationResult": {
        "statusCode": 5000
    },
    "ocrResult": {
        "idNumber": "ID-Number",
        "name": "NAME",
        "address": "Address",
        ......[TRUNCATED]....
    }
}
```

</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>

```json
{
    "transactionId": "ae31c00c-404c-4129-bd34-17ad470583a3",
    "partnerTrxId": "dcc75297-bb57-49b8-84cf-b5e10de608a5",
    "groupId": "0a7d2eca-4829-4d7c-93cb-85f144c60e01",
    "card": {
        "country": "India",
        "type": "PASSPORT",
        "isoAlpha3CountryCode": "IND",
        "isoAlpha2CountryCode": "IN"
    },
    "ocrResult": {
        "idNumber": "Id-Number",
        "personalIdNumber": "Personal Id Number",
        "name": "Name from passport",
        ......[TRUNCATED]....
    },
    "idVerificationResult": {
        "statusCode": 5000
    }
}
```

</details>
