> 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/iqa-and-card-classification.md).

# IQA & Card-Classification

The **Image Quality Assessment (IQA)** and **Card Classification** steps are **pre-processing** operations executed **before** performing any requested tasks.&#x20;

If these steps **fail**, the execution stops, and an **error** is returned in the response body.

***

### Card-Classification&#x20;

**Purpose:** Determines the type of card being processed and includes these details in the response.

<details>

<summary>Sample Card Classification Response</summary>

```json
"card": {
    "country": "Country Name Of Which the Card Belongs To",
    "type": "Name of the card type that was sent, ex - MyKad , KTP, etc",
    "isoAlpha3CountryCode": "iso Alpha 3 Country Code of the country the card belongs to",
    "isoAlpha2CountryCode": "iso Alpha 2 Country Code of the country the card belongs to"
},
```

</details>

{% hint style="info" %}
Note: If an **error occurs** during processing, the **card classification details** will **not be included** in the response.
{% endhint %}

***

### Image Quality Assessment&#x20;

**Purpose:** Evaluates the **idFrontSideImage and idBackSideImage (if enabled)** quality based on different parameters like:\
✔ **Glare** – Checks if glare affects the captured image.\
✔ **Blurriness** – Detects if the image is blurry.\
✔ **Low Light** – Ensures the image is not underexposed.

**Response:**

* **Success:** If the image passes all quality checks, an **`imageQualityResult`** object is included in the response.
* **Failure:** If any check fails, the request **errors out.**

### Sample Success Response :&#x20;

<details>

<summary>Success Response </summary>

```json
"imageQualityResult": {
        "front": {
            "statusCode": 5000
        },
  }
```

</details>

<details>

<summary>Success Response for Front Side and Back Side </summary>

```json
"imageQualityResult": {
    "front": {
        "statusCode": 5000
    },
    "back": {
        "statusCode": 5000
    }
}
```

</details>

{% hint style="info" %}
**Note:**&#x20;

🔹 **Glare models** are currently **only available** for **MyKad (Front Side Only) and KTP** cards.\
🔹 **Glare detection** will **only return high scores** if the glare **obscures essential fields** such as **Name, ID Number, or Portrait Image**.
{% endhint %}

### Sample Failure Response:

**In this case no image quality results are provided in the response, the request errors out.**

<details>

<summary>Failure 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",
    "errors": [
        {
            "message": "Quality check failed. Image is too blurry. (123005)",
            "code": 5202,
            "operations": [
                "idVerification",
                "ocr"
            ]
        }
    ]
}
```

</details>

{% hint style="info" %}
Note:&#x20;

1. *Image Quality Assessment (IQA) responses are currently only available for* **Malaysian** *and* **KTP cards**.
2. For other document types, such as **passports**, these details will **not** be included in the response.
   {% endhint %}
