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

### Sample Card Classification Response&#x20;

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

**Purpose:** Evaluates the **idFrontSideImage** 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 :

<details>

<summary>Success Response</summary>

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

</details>

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

🔹 **Glare models** are currently **only available** for **MyKad 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 -&#x20;

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

<details>

<summary>Failure Response</summary>

```json
{
    "transactionId": "Transaction id generated for the request",
    "partnerTrxId": "Partner transaction id sent by the client",
    "groupId": "Group id sent by the client",
    "errors": [
        {
            "message": "Image Quality is too low, Kindly ensure the image is well lit and is placed in the right angle",
            "code": 5014,
            "operations": [
                "idVerification",
                "ocr"
            ]
        }
    ]
}

```

</details>

{% hint style="info" %}
⚠️ **Note:** *Image Quality Assessment (IQA) responses are currently only available for* **Malaysian** *and* **KTP cards**.\
For other document types, such as **passports**, these details will **not** be included in the response.
{% endhint %}
