> 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/full-details-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"
    "card": {
        "country": "MALAYSIA",
        "type": "MyKad",
        "isoAlpha3CountryCode": "MYS",
        "isoAlpha2CountryCode": "MY"
    },
    "imageQualityResult": {
        "front": {
            "glare": {
                "score": 0,
                "threshold": 0.95
            },
            "blurriness": {
                "score": 0.000004,
                "threshold": 0.95
            },
            "lowLight": {
                "score": 0.138068,
                "threshold": 0.95
            }
        }
    },
    "idVerificationResult": {
        "front": {
            "spoofingResult": {
                "message": "Success",
                "code": 5000,
                "recapScore": {
                    "score": 0.129594,
                    "threshold": 0.95
                },
                "blackWhite": {
                    "score": 0.004589,
                    "threshold": 0.95
                },
                "colorPrint": {
                    "score": 0.071307,
                    "threshold": 0.95
                }
            },
            "landmarkResult": {
                "code": 5000,
                "message": "Success",
                "threshold": 0.95,
                "containerResult": [
                    {
                        "name": "ghost",
                        "score": 0.9929
                    },
                    {
                        "name": "portrait",
                        "score": 0.9795
                    },
                    {
                        "name": "hibiscus_logo",
                        "score": 0.9849
                    },
                    {
                        "name": "card_logo",
                        "score": 0.9836
                    },
                    {
                        "name": "chip",
                        "score": 0.9757
                    },
                    {
                        "name": "malaysia_flag",
                        "score": 0.9866
                    },
                    {
                        "name": "msc_logo",
                        "score": 0.9776
                    },
                    {
                        "name": "kad_pengenalan_header",
                        "score": 0.9829
                    },
                    {
                        "name": "id_number",
                        "score": 0.9936
                    },
                    {
                        "name": "name",
                        "score": 0.9843
                    }
                ]
            },
            "forgeryResult": {
                "code": 5000,
                "message": "Success",
                "summary": {
                    "score": 0.023583,
                    "threshold": 0.95
                }
            }
        }
    },
    "ocrResult": {
        "front": {
            "data": {
                "idNumber": {
                    "value": "ID NUMBER",
                    "score": 0.997506,
                    "threshold": 0.95
                },
                "name": {
                    "value": "NAME",
                    "score": 0.999969,
                    "threshold": 0.95
                },
                "address": {
                    "value": "ADDRESS",
                    "score": 0.994527,
                    "threshold": 0.95
                },
                "dob": {
                    "value": "YYYYMMDD",
                    "score": 0.997506,
                    "threshold": 0.95
                },
                "citizenship": {
                    "value": "CITIZENSHIP",
                    "score": 1,
                    "threshold": 0.95
                },
                "gender": {
                    "value": "Gender from ID Card (M/F/O)",
                    "score": 1,
                    "threshold": 0.95
                },
                "religion": {
                    "value": "Religion",
                    "score": 1,
                    "threshold": 0.95
                },
                "portraitImage": "Base 64....",
            }
        }
    }
```

</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": "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"
    "card": {
        "country": "INDONESIA",
        "type": "KTP",
        "isoAlpha3CountryCode": "IDN",
        "isoAlpha2CountryCode": "ID"
    },
    "imageQualityResult": {
        "front": {
            "blurriness": {
                "score": 0.000801,
                "threshold": 0.95
            },
            "lowLight": {
                "score": 0.657333,
                "threshold": 0.95
            },
            "overExposure": {
                "score": 0.508201,
                "threshold": 0.95
            },
            "cardDimension": {
                "card_coordinates": {
                    "x1": 0,
                    "x2": 640,
                    "y1": 1,
                    "y2": 405
                },
                "card_width": 640,
                "card_height": 404
            }
        }
    },
    "idVerificationResult": {
        "front": {
            "spoofingResult": {
                "message": "Success",
                "code": 5000,
                "recapScore": {
                    "score": 0.154017,
                    "threshold": 0.95
                },
                "blackWhite": {
                    "score": 0.023498,
                    "threshold": 0.95
                },
                "colorPrint": {
                    "score": 0.075997,
                    "threshold": 0.95
                },
                "screenshot": {
                    "score": 0.272087,
                    "threshold": 0.95
                }
            },
            "landmarkResult": {
                "code": 5000,
                "message": "Success",
                "threshold": 0.95,
                "containerResult": [
                    {
                        "position": {
                            "x": 200,
                            "y": 12,
                            "width": 97,
                            "height": 16
                        },
                        "name": "provinsi",
                        "score": 0.9924
                    },
                    {
                        "position": {
                            "x": 23,
                            "y": 62,
                            "width": 47,
                            "height": 20
                        },
                        "name": "nik",
                        "score": 0.9919
                    },
                    {
                        "position": {
                            "x": 20,
                            "y": 99,
                            "width": 39,
                            "height": 12
                        },
                        "name": "nama",
                        "score": 0.9907
                    },
                    {
                        "position": {
                            "x": 19,
                            "y": 134,
                            "width": 112,
                            "height": 12
                        },
                        "name": "tampat-tgl-lahir",
                        "score": 0.9894
                    },
                    {
                        "position": {
                            "x": 17,
                            "y": 152,
                            "width": 89,
                            "height": 12
                        },
                        "name": "jenis-kelamin",
                        "score": 0.99
                    },
                    {
                        "position": {
                            "x": 17,
                            "y": 171,
                            "width": 49,
                            "height": 12
                        },
                        "name": "alamat",
                        "score": 0.9908
                    },
                    {
                        "position": {
                            "x": 53,
                            "y": 189,
                            "width": 49,
                            "height": 11
                        },
                        "name": "rt-rw",
                        "score": 0.9897
                    },
                    {
                        "position": {
                            "x": 52,
                            "y": 207,
                            "width": 63,
                            "height": 12
                        },
                        "name": "kel-desa",
                        "score": 0.9913
                    },
                    {
                        "position": {
                            "x": 52,
                            "y": 226,
                            "width": 76,
                            "height": 12
                        },
                        "name": "kecamatan",
                        "score": 0.9905
                    },
                    {
                        "position": {
                            "x": 12,
                            "y": 244,
                            "width": 48,
                            "height": 12
                        },
                        "name": "agama",
                        "score": 0.9904
                    },
                    {
                        "position": {
                            "x": 12,
                            "y": 262,
                            "width": 125,
                            "height": 13
                        },
                        "name": "status-perkawinan",
                        "score": 0.9906
                    },
                    {
                        "position": {
                            "x": 12,
                            "y": 281,
                            "width": 66,
                            "height": 13
                        },
                        "name": "pekerjaan",
                        "score": 0.9913
                    },
                    {
                        "position": {
                            "x": 11,
                            "y": 300,
                            "width": 125,
                            "height": 13
                        },
                        "name": "kewarganegaraan",
                        "score": 0.9898
                    },
                    {
                        "position": {
                            "x": 10,
                            "y": 318,
                            "width": 103,
                            "height": 14
                        },
                        "name": "berlaku-hingga",
                        "score": 0.9902
                    },
                    {
                        "position": {
                            "x": 314,
                            "y": 152,
                            "width": 72,
                            "height": 11
                        },
                        "name": "gol-darah",
                        "score": 0.9923
                    },
                    {
                        "position": {
                            "x": 454,
                            "y": 75,
                            "width": 149,
                            "height": 186
                        },
                        "name": "portrait",
                        "score": 0.9805
                    }
                ],
                "landmarkTags": [
                    {
                        "name": "portrait_background_color",
                        "value": "red"
                    }
                ],
                "landmarkVerification": [
                    {
                        "name": "heuristic_check",
                        "status": "pass"
                    }
                ]
            },
            "forgeryResult": {
                "code": 5000,
                "message": "Success",
                "summary": {
                    "score": 0,
                    "threshold": 0.95
                }
            }
        }
    },
    "ocrResult": {
        "front": {
            "data": {
                "idNumber": {
                    "value": "ID NUMBER",
                    "score": 0.999994,
                    "threshold": 0.95
                },
                "name": {
                    "value": "NAME",
                    "score": 0.983342,
                    "threshold": 0.95
                },
                "address": {
                    "value": "ADDRESS",
                    "score": 0.999744,
                    "threshold": 0.95
                },
                "dob": {
                    "value": "DD-MM-YYYY",
                    "score": 0.965899,
                    "threshold": 0.95
                },
                "gender": {
                    "value": "Gender from ID Card (M/F)",
                    "score": 0.999884,
                    "threshold": 0.95
                },
                "religion": {
                    "value": "Religion from ID Card",
                    "score": 0.999436,
                    "threshold": 0.95
                },
                "province": {
                    "value": "Province from ID Card",
                    "score": 0.985587,
                    "threshold": 0.95
                },
                "city": {
                    "value": "City from ID Card",
                    "score": 0.998896,
                    "threshold": 0.95
                },
                "placeOfBirth": {
                    "value": "DOB",
                    "score": 0.965899,
                    "threshold": 0.95
                },
                "bloodType": {
                    "value": "Blood type from ID Card",
                    "score": 0.95,
                    "threshold": 0.95
                },
                "neighborhoodAssociationGroup": {
                    "value": "xxx/xxx",
                    "score": 0.999998,
                    "threshold": 0.95
                },
                "village": {
                    "value": "Village from ID Card",
                    "score": 0.967507,
                    "threshold": 0.95
                },
                "subDistrict": {
                    "value": "Sub District from ID Card",
                    "score": 0.999989,
                    "threshold": 0.95
                },
                "maritalStatus": {
                    "value": "Marital Status from ID Card",
                    "score": 0.999999,
                    "threshold": 0.95
                },
                "occupation": {
                    "value": "Occupation from ID Card",
                    "score": 0.999856,
                    "threshold": 0.95
                },
                "nationality": {
                    "value": "Nationality from ID Card",
                    "score": 0.980495,
                    "threshold": 0.95
                },
                "validUntil": {
                    "value": "Valid ID Card",
                    "score": 0.950421,
                    "threshold": 0.95
                }
            }
        }
    }
}
```

</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": "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"
    "card": {
        "country": "Country from ID Card",
        "type": "PASSPORT",
        "isoAlpha3CountryCode": "Country Code",
        "isoAlpha2CountryCode": "Country Code"
    },
    "ocrResult": {
        "data": {
            "idNumber": {
                "value": "ID NUMBER"
            },
            "name": {
                "value": "NAME"
            },
            "dob": {
                "value": "YYYYMMDD"
            },
            "gender": {
                "value": "Gender from ID Card"
            },
            "placeOfBirth": {
                "value": "POB"
            },
            "dateOfExpiry": {
                "value": "Card Expiry"
            },
            "dateOfIssue": {
                "value": "Date of Issue"
            },
            "citizenship": {
                "value": "Citizenship"
            },
            "issuerName": {
                "value": "Issuer Name"
            },
            "issuerCountry": {
                "value": "Issuer Country"
            },
            "issuingAuthority": {
                "value": "Issuing Authority"
            },
            "portraitImage": "Base 64..."
        }
    },
    "idVerificationResult": {
        "spoofingResult": {
            "message": "success",
            "code": 5000
        },
        "landmarkResult": {
            "message": "success",
            "code": 5000
        },
        "forgeryResult": {
            "message": "success",
            "code": 5000
        }
    }
}
```

</details>
