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

<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, 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**, and a warning is returned.

<details>

<summary>Sample Success Response</summary>

<pre class="language-json"><code class="lang-json">{
  "imageQualityResult": {
        "glare": {
            "score": 0,
            "threshold": 0.95
        },
        "blurriness": {
            "score": 0.000019,
            "threshold": 0.95
        },
        ......[And Other Checks]....
<strong>  }
</strong><strong>}
</strong></code></pre>

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

<details>

<summary>Sample Failure Response</summary>

**In this case no image quality results are provided in the response, the request error out and we throw an appropriate warning showing which checks had failed.**

<pre class="language-json"><code class="lang-json"><strong>{
</strong>    "transactionId": "Transaction id generated for the request",
    "partnerTrxId": "Partner transaction id sent by the client",
    "groupId": "Group id sent by the client",
    "warnings": [
        {
            "message": "Image submitted is blurred",
            "code": 10024
        },
        {
            "message": "Image submitted is too dark to process",
            "code": 10026
        }
    ],
    "errors": [
        {
            "message": "Image Quality is too low, Kindly ensure the image is well lit and is placed in the right angle",
            "code": 5014,
            "operations": [
                "ocr",
                "idVerification"
            ]
        }
    ]
}
</code></pre>

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