> 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/full-details-endpoint/ocr/malaysian-cards.md).

# Malaysian Cards

Currently Supported Malaysian Cards include:

1. [MyKad](#mykad)
2. [MyTentera](#mytentera)
3. [MyKas](#mykas)
4. [MyPR](#mypr)

{% hint style="info" %}
Note: \
The **RELIGION** field is **optional** on Malaysian ID cards, meaning it may or may not be printed on the card. As a result, this field may also be **present or absent** in the response.\
\
Backside card support can be enabled through configuration, and the KYC flow will follow the `idSubType` you provide (for example, use `idSubType = MyKad` to apply the correct setup).
{% endhint %}

## MyKad

### Request

<details>

<summary>Request for Front Side Only</summary>

```json
{
  "operations": ["ocr"],
  "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>

<details>

<summary>Request for Front Side and Back Side</summary>

```json
{
  "operations": ["ocr"],
  "payload": {
    "partnerTrxId": "random-uuid",
    "groupId": "random-uuid",
    "idType": "ID_CARD",
    "country": "MYS",
    "idSubtype": "MyKad",
    "idFrontSideImage": "Base64 encoded image of ID front side",
    "idBackSideImage": "Base64 encoded image of ID back side" //if enabled 
  },
  "userConsent": {
    "userIP": "0.0.0.0",
    "country": "MYS",
    "obtained": true,
    "obtainedAt": "1680700959"
  }
}
```

</details>

### Success Response

HTTP Status Code: `200`

<details>

<summary>Success <strong>JSON Response for Front Side Only</strong></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
            }
        }
    },
    "ocrResult": {
        "front": {
            "data": {
                "idNumber": {
                    "value": "ID Number from ID Card",
                    "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": "YYYY-MM-DD",
                    "score": 0.997506,
                    "threshold": 0.95
                },
                "citizenship": {
                    "value": "Country",
                    "score": 1,
                    "threshold": 0.95
                },
                "gender": {
                    "value": "Gender from ID Card",
                    "score": 1,
                    "threshold": 0.95
                },
                "religion": {
                    "value": "Religion",
                    "score": 1,
                    "threshold": 0.95
                },
                "address1": {
                    "value": "address 1",
                    "score": 1,
                    "threshold": 0.95
                },
                "address2": {
                    "value": "address 2",
                    "score": 1,
                    "threshold": 0.95
                },
                "zipCode": {
                    "value": "Zip Code",
                    "score": 1,
                    "threshold": 0.95
                },
                "city": {
                    "value": "City",
                    "score": 1,
                    "threshold": 0.95
                },
                "state": {
                    "value": "State",
                    "score": 1,
                    "threshold": 0.95
                },
                "portraitImage": "Base64 encoded...."
               }
           }
      }
}
```

</details>

<details>

<summary>Success <strong>JSON Response for Front Side and Back Side</strong></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.0008,
                "threshold": 0.95
            },
            "lowLight": {
                "score": 0.076793,
                "threshold": 0.95
            }
        },
        "back": {
            "blurriness": {
                "score": 0.003535,
                "threshold": 0.95
            },
            "lowLight": {
                "score": 0,
                "threshold": 0.95
            }
        }
    },
    "ocrResult": {
        "front": {
            "data": {
                "idNumber": {
                    "value": "ID Number from ID Card",
                    "score": 0.993373,
                    "threshold": 0.95
                },
                "name": {
                    "value": "Name",
                    "score": 0.999926,
                    "threshold": 0.95
                },
                "address": {
                    "value": "Address",
                    "score": 0.997141,
                    "threshold": 0.95
                },
                "dob": {
                    "value": "YYYY-MM-DD",
                    "score": 0.993373,
                    "threshold": 0.95
                },
                "citizenship": {
                    "value": "Citizenship",
                    "score": 1,
                    "threshold": 0.95
                },
                "gender": {
                    "value": "Gender from ID Card",
                    "score": 1,
                    "threshold": 0.95
                },
                "religion": {
                    "value": "Religion",
                    "score": 1,
                    "threshold": 0.95
                },
                "address1": {
                    "value": "address 1",
                    "score": 1,
                    "threshold": 0.95
                },
                "address2": {
                    "value": "address 2",
                    "score": 1,
                    "threshold": 0.95
                },
                "zipCode": {
                    "value": "Zip Code",
                    "score": 1,
                    "threshold": 0.95
                },
                "city": {
                    "value": "City",
                    "score": 1,
                    "threshold": 0.95
                },
                "state": {
                    "value": "State",
                    "score": 1,
                    "threshold": 0.95
                },
                "portraitImage": "Base64 encoded...."
                }
        },
        "back": {
            "data": {
                "extendedIdNumber": {
                    "value": "xxxxxx-xx-xxxx-xx-xx",
                    "score": 0.988594,
                    "threshold": 0.95
                }
            }
        }
    }
}
```

</details>

### Error 5023 - IdNumber Doesn't contain a valid DOB

{% hint style="info" %}
**Note:** In some cases, glare or other obstructions on MyKad cards may prevent proper extraction of the ID number, which in turn affects the extraction of the date of birth. If the ID number is occluded or not extracted correctly, the following error message will be returned.
{% endhint %}

HTTP Status Code: `400`

<details>

<summary>Error 5023 - <strong>JSON Response</strong></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",
    "warnings": [
        {
            "message": "Low confidence score for ocr, please check [idNumber] from ocrResult for more details",
            "code": 10033,
            "operations": [
                "ocr"
            ]
        }
    ],
    "errors": [
        {
            "message": "Bad Quality Image , Id Number Extraction Failed",
            "code": 5023,
            "operations": [
                "ocr"
            ]
        }
    ],
    "imageQualityResult": {
        "front": {
            "glare": {
                "score": 0,
                "threshold": 0.95
            },
            "blurriness": {
                "score": 0.021078,
                "threshold": 0.95
            },
            "lowLight": {
                "score": 0.130729,
                "threshold": 0.95
            }
        }
    },
    "ocrResult": {
        "front": {
            "data": {
                "idNumber": {
                    "value": "Id Number from ID CARD",
                    "score": 0,
                    "threshold": 0.95
                },
                "name": {
                    "value": "Name",
                    "score": 0.999958,
                    "threshold": 0.95
                },
                "address": {
                    "value": "Address",
                    "score": 0.994541,
                    "threshold": 0.95
                },
                "citizenship": {
                    "value": "Citizenship",
                    "score": 1,
                    "threshold": 0.95
                },
                "gender": {
                    "value": "Gender from ID Card",
                    "score": 1,
                    "threshold": 0.95
                },
                "religion": {
                    "value": "Religion",
                    "score": 1,
                    "threshold": 0.95
                },
                "portraitImage": "base64...."
            }
        }
    }
}
```

</details>

### IdNumber with '\*' at the end

{% hint style="info" %}
**Note:** Some MyKad cards have an `*` at the end of the ID number. This asterisk indicates that the **ID number does not match the cardholder’s date of birth**. Instead, the **first six digits**, which typically represent the date of birth, correspond to the **date of application** for the MyKad.
{% endhint %}

HTTP Status Code: `200`&#x20;

<details>

<summary>IdNumber with '*' <strong>JSON Response</strong></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": {
        "front": {
        -----[TRUNCATED]------
        }
    },
    "card": {
        -----[TRUNCATED]------
    },
    "ocrResult": {
      "front": {
        "data": {
            "idNumber": {
                "value": "xxxxxx-xx-xxxx-*x-xx",
                "score": 0.9916,
                "threshold": 0.95
            },
            -----[TRUNCATED]------
            "portraitImage": "base 64..."
            }
        }
    }
}
```

</details>

### OCR Warning for low scores

{% hint style="info" %}
**Note:** Any field if has a score lower than threshold value of 0.95, we raise a low score warning for the field.
{% endhint %}

HTTP Status Code: `200`&#x20;

<details>

<summary>OCR Warning <strong>JSON Response</strong></summary>

<pre class="language-json"><code class="lang-json">{
    "transactionId": "unique transaction id generated to identify this transaction",
<strong>    "partnerTrxId": "partner transaction id submitted by customer in request",
</strong>    "groupId": "partner group id submitted by customer in request",            
    "warnings": [
       {
           "message": "Low confidence score for ocr, please check [name] from ocrResult for more details",
           "code": 10028,
           "operations": [
               "ocr"
           ]
       },
       {
           "message": "Low confidence score for ocr, please check [address] from ocrResult for more details",
           "code": 10029,
           "operations": [
               "ocr"
           ]
       }
    ],
    "imageQualityResult": {
        "front": {
        -----[TRUNCATED]------
        }
    },
    "card": {
        -----[TRUNCATED]------
    },
    "ocrResult": {
      "front": {
        "data": {
            "idNumber": {
                "value": "xxxxx",
                "score": 0.9916,
                "threshold": 0.95
            },
            "name": {
               "value": "abc",
               "score": 0.11, // score below the threshold.
               "threshold": 0.95
            },
            "address": {
               "value": "xyz",
               "score": 0, // score below the threshold.
               "threshold": 0.95
            },
            -----[TRUNCATED]------
            "portraitImage": "base 64"
            }
        }
    }
}
</code></pre>

</details>

### Image Color Reprint

HTTP Status Code: `200`&#x20;

<details>

<summary>Image Color Reprint <strong>JSON Response</strong></summary>

```json
{
    "transactionId": "105add36-f0eb-40bf-b31d-64f0236b6144",
    "partnerTrxId": "217e9ad6-dd04-4869-b632-1c8321c8b976",
    "groupId": "aaaaaaaa",
    "errors": [
        {
            "message": "Spoof check failed. Image submitted is color reprint",
            "code": 5603,
            "operations": [
                "ocr"
            ]
        }
    ],
    "imageQualityResult": {
        "front": {
            "glare": {
                "score": 0,
                "threshold": 0.95
            },
            "blurriness": {
                "score": 0.013282,
                "threshold": 0.95
            },
            "lowLight": {
                "score": 0.012254,
                "threshold": 0.95
            }
        }
    },
    "ocrResult": {
        "front": {
            "data": {
                "idNumber": {
                    "value": "ID NUMBER",
                    "score": 0.974472,
                    "threshold": 0.95
                },
                "name": {
                    "value": "NAME",
                    "score": 0.999658,
                    "threshold": 0.95
                },
                "address": {
                    "value": "ADDRESS",
                    "score": 0.998371,
                    "threshold": 0.95
                },
                "dob": {
                    "value": "YYYYMMDD",
                    "score": 0.974472,
                    "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
                },
                "portraitImage": "Base64...",
        }
    }
}
```

</details>

## MyTentera

<details>

<summary>Request for Front Side Only</summary>

```json
{
  "operations": ["ocr"],
  "payload": {
    "partnerTrxId": "random-uuid",
    "groupId": "random-uuid",
    "idType": "ID_CARD",
    "country": "MYS",
    "idSubtype": "MyTentera",
    "idFrontSideImage": "Base64 encoded image of ID front side"
  },
  "userConsent": {
    "userIP": "0.0.0.0",
    "country": "MYS",
    "obtained": true,
    "obtainedAt": "1680700959"
  }
}
```

</details>

<details>

<summary>Request for Front Side and Back Side</summary>

```json
{
  "operations": ["ocr"],
  "payload": {
    "partnerTrxId": "random-uuid",
    "groupId": "random-uuid",
    "idType": "ID_CARD",
    "country": "MYS",
    "idSubtype": "MyTentera",
    "idFrontSideImage": "Base64 encoded image of ID front side",
    "idBackSideImage": "Base64 encoded image of ID back side" //if enabled 
  },
  "userConsent": {
    "userIP": "0.0.0.0",
    "country": "MYS",
    "obtained": true,
    "obtainedAt": "1680700959"
  }
}
```

</details>

### Success Response

HTTP Status Code: `200`

<details>

<summary>Success <strong>JSON Response for Front Side Only</strong></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": "MyTentera",
        "isoAlpha3CountryCode": "MYS",
        "isoAlpha2CountryCode": "MY"
    },
    "imageQualityResult": {
        "front": {
            "blurriness": {
                "score": 0.03898,
                "threshold": 0.95
            },
            "lowLight": {
                "score": 0.003386,
                "threshold": 0.95
            }
        }
    },
    "ocrResult": {
        "front": {
            "data": {
                "idNumber": {
                    "value": "ID Number from ID Card",
                    "score": 0.996411,
                    "threshold": 0.95
                },
                "name": {
                    "value": "NAME",
                    "score": 0.997854,
                    "threshold": 0.95
                },
                "address": {
                    "value": "Address",
                    "score": 0.996456,
                    "threshold": 0.95
                },
                "dob": {
                    "value": "YYYY-MM-DD",
                    "score": 0.996411,
                    "threshold": 0.95
                },
                "gender": {
                    "value": "Gender from ID Card",
                    "score": 1,
                    "threshold": 0.95
                },
                "religion": {
                    "value": "Religion",
                    "score": 1,
                    "threshold": 0.95
                },
                "militaryId": {
                    "value": "Military-ID",
                    "score": 0.997516,
                    "threshold": 0.95
                },
                "militaryRank": {
                    "value": "Military-Rank",
                    "score": 1,
                    "threshold": 0.95
                },
                "militaryDivision": {
                    "value": "Military-Division",
                    "score": 1,
                    "threshold": 0.95
                },
                "portraitImage": "Base64....."
            }
        }
    }
}
```

</details>

<details>

<summary>Success <strong>JSON Response for Front Side and Back Side</strong></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": "MyTentera",
        "isoAlpha3CountryCode": "MYS",
        "isoAlpha2CountryCode": "MY"
    },
    "imageQualityResult": {
        "front": {
            "blurriness": {
                "score": 0.03898,
                "threshold": 0.95
            },
            "lowLight": {
                "score": 0.003386,
                "threshold": 0.95
            }
        },
        "back": {
            "blurriness": {
                "score": 0.021608,
                "threshold": 0.95
            },
            "lowLight": {
                "score": 0,
                "threshold": 0.95
            }
        }
    },
    "ocrResult": {
        "front": {
            "data": {
                "idNumber": {
                    "value": "ID Number from ID Card",
                    "score": 0.996411,
                    "threshold": 0.95
                },
                "name": {
                    "value": "NAME",
                    "score": 0.997854,
                    "threshold": 0.95
                },
                "address": {
                    "value": "Address",
                    "score": 0.996456,
                    "threshold": 0.95
                },
                "dob": {
                    "value": "YYYY-MM-DD",
                    "score": 0.996411,
                    "threshold": 0.95
                },
                "gender": {
                    "value": "Gender from ID Card",
                    "score": 1,
                    "threshold": 0.95
                },
                "religion": {
                    "value": "Religion",
                    "score": 1,
                    "threshold": 0.95
                },
                "militaryId": {
                    "value": "Military-ID",
                    "score": 0.997516,
                    "threshold": 0.95
                },
                "militaryRank": {
                    "value": "Military-Rank",
                    "score": 1,
                    "threshold": 0.95
                },
                "militaryDivision": {
                    "value": "Military-Division",
                    "score": 1,
                    "threshold": 0.95
                },
                "portraitImage": "Base64....."
            },
            "back": {
            "data": {
                "extendedIdNumber": {
                    "value": "950912-02-6211-04",
                    "score": 0.993886,
                    "threshold": 0.95
                }
            }
        }
```

</details>

### Error 5023 - IdNumber Doesn't contain a valid DOB

{% hint style="info" %}
**Note:** In some cases, glare or other obstructions on MyTentera cards may prevent proper extraction of the ID number, which in turn affects the extraction of the date of birth. If the ID number is occluded or not extracted correctly, the following error message will be returned.
{% endhint %}

HTTP Status Code: `400`

<details>

<summary>Error 5023 - <strong>JSON Response</strong></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",
    "warnings": [
        {
            "message": "Low confidence score for ocr, please check [idNumber] from ocrResult for more details",
            "code": 10033,
            "operations": [
                "ocr"
            ]
        }
    ],
    "errors": [
        {
            "message": "Bad Quality Image , Id Number Extraction Failed",
            "code": 5023,
            "operations": [
                "ocr"
            ]
        }
    ],
    "imageQualityResult": {
        "front": {
            "glare": {
                "score": 0,
                "threshold": 0.95
            },
            "blurriness": {
                "score": 0.021078,
                "threshold": 0.95
            },
            "lowLight": {
                "score": 0.130729,
                "threshold": 0.95
            }
        }
    },
    "ocrResult": {
        "front": {
            "data": {
                "idNumber": {
                    "value": "Id Number from ID CARD",
                    "score": 0,
                    "threshold": 0.95
                },
                "name": {
                    "value": "Name",
                    "score": 0.999958,
                    "threshold": 0.95
                },
                "address": {
                    "value": "Address",
                    "score": 0.994541,
                    "threshold": 0.95
                },
                "citizenship": {
                    "value": "Citizenship",
                    "score": 1,
                    "threshold": 0.95
                },
                "gender": {
                    "value": "Gender from ID Card",
                    "score": 1,
                    "threshold": 0.95
                },
                "religion": {
                    "value": "Religion",
                    "score": 1,
                    "threshold": 0.95
                },
                "portraitImage": "base64...."
            }
        }
    }
}
```

</details>

### OCR Warning's for low score

{% hint style="info" %}
**Note:** Any field if has a score lower than threshold value of 0.95, we raise a low score warning for the field.
{% endhint %}

HTTP Status Code: `200`

<details>

<summary>OCR Warning <strong>JSON Response</strong></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",
    "warnings": [
       {
           "message": "Low confidence score for ocr, please check [name] from ocrResult for more details",
           "code": 10028,
           "operations": [
               "ocr"
           ]
       },
       {
           "message": "Low confidence score for ocr, please check [address] from ocrResult for more details",
           "code": 10029,
           "operations": [
               "ocr"
           ]
       },
    ]
    "imageQualityResult": {
        "front": {
        -----[TRUNCATED]------
        }
    },
    "card":{
        -----[TRUNCATED]------
    },
    "ocrResult": {
      "front": {
        "data":{
              -----[TRUNCATED]------
              "name": {
                   "value": "",
                   "score": 0, // Low confidence score
                   "threshold": 0.95
               },
               "address": {
                   "value": "",
                   "score": 0, // Low confidence score
                   "threshold": 0.95
               },
              -----[TRUNCATED]------
          }
       }
    }
}
```

</details>

### Image Color Reprint

HTTP Status Code: `200`&#x20;

<details>

<summary>Image Color Reprint <strong>JSON Response</strong></summary>

```json
{
    "transactionId": "ef022939-bc59-46cd-8ca7-d251b5a8cdb5",
    "partnerTrxId": "4a149108-f8f3-4c5d-880b-3a52e51282e2",
    "groupId": "aaaaaaaa",
    "errors": [
        {
            "message": "Spoof check failed. Image submitted is color reprint",
            "code": 5603,
            "operations": [
                "ocr"
            ]
        }
    ],
    "imageQualityResult": {
        "front": {
            "glare": {
                "score": 0,
                "threshold": 0.95
            },
            "blurriness": {
                "score": 0.013282,
                "threshold": 0.95
            },
            "lowLight": {
                "score": 0.012254,
                "threshold": 0.95
            }
        }
    },
    "ocrResult": {
        "front": {
            "data": {
                "idNumber": {
                    "value": "ID NUMBER",
                    "score": 0.974472,
                    "threshold": 0.95
                },
                "name": {
                    "value": "NAME",
                    "score": 0.999658,
                    "threshold": 0.95
                },
                "address": {
                    "value": "ADDRESS",
                    "score": 0.998371,
                    "threshold": 0.95
                },
                "dob": {
                    "value": "YYYYMMDD",
                    "score": 0.974472,
                    "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
                },
                "portraitImage": "Base64...",
        }
    }
}
```

</details>

## MyKas

<details>

<summary>Request for Front Side Only</summary>

```json
{
  "operations": ["ocr"],
  "payload": {
    "partnerTrxId": "random-uuid",
    "groupId": "random-uuid",
    "idType": "ID_CARD",
    "country": "MYS",
    "idSubtype": "MyKas",
    "idFrontSideImage": "Base64 encoded image of ID front side"
  },
  "userConsent": {
    "userIP": "0.0.0.0",
    "country": "MYS",
    "obtained": true,
    "obtainedAt": "1680700959"
  }
}
```

</details>

<details>

<summary>Request for Front Side and Back Side</summary>

```json
{
  "operations": ["ocr"],
  "payload": {
    "partnerTrxId": "random-uuid",
    "groupId": "random-uuid",
    "idType": "ID_CARD",
    "country": "MYS",
    "idSubtype": "MyKas",
    "idFrontSideImage": "Base64 encoded image of ID front side",
    "idBackSideImage": "Base64 encoded image of ID back side" //if enabled 
  },
  "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>

<pre class="language-json"><code class="lang-json"><strong>{
</strong>    "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": "MyKas",
        "isoAlpha3CountryCode": "MYS",
        "isoAlpha2CountryCode": "MY"
    },
    "imageQualityResult": {
        "front": {
            "blurriness": {
                "score": 0.000273,
                "threshold": 0.95
            },
       -----[TRUNCATED]------
        }
    },
    "ocrResult": {
        "front": {
            "data": {
                "idNumber": {
                    "value": "ID Number for ID card",
                    "score": 0.999806,
                    "threshold": 0.95
                },
                "name": {
                    "value": "NAME",
                    "score": 0.996765,
                    "threshold": 0.95
                },
                "address": {
                    "value": "Address",
                    "score": 0.999314,
                    "threshold": 0.95
                },
               -----[TRUNCATED]------
                "portraitImage": "{
            }
        }
    }
}
</code></pre>

</details>

### Error 5023 - IdNumber Doesn't contain a valid DOB

{% hint style="info" %}
**Note:** In some cases, glare or other obstructions on MyKas cards may prevent proper extraction of the ID number, which in turn affects the extraction of the date of birth. If the ID number is occluded or not extracted correctly, the following error message will be returned.
{% endhint %}

HTTP Status Code: `400`

<details>

<summary>Error 5023 - 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",
    "warnings": [
        {
            "message": "Low confidence score for ocr, please check [idNumber] from ocrResult for more details",
            "code": 10033,
            "operations": [
                "ocr"
            ]
        }
    ],
    "errors": [
        {
            "message": "Bad Quality Image , Id Number Extraction Failed",
            "code": 5023,
            "operations": [
                "ocr"
            ]
        }
    ],
    "imageQualityResult": {
        "front": {
            "glare": {
                "score": 0,
                "threshold": 0.95
            },
            "blurriness": {
                "score": 0.021078,
                "threshold": 0.95
            },
            "lowLight": {
                "score": 0.130729,
                "threshold": 0.95
            }
        }
    },
    "ocrResult": {
        "front": {
            "data": {
                "idNumber": {
                    "value": "Id Number from ID CARD",
                    "score": 0,
                    "threshold": 0.95
                },
                "name": {
                    "value": "Name",
                    "score": 0.999958,
                    "threshold": 0.95
                },
                "address": {
                    "value": "Address",
                    "score": 0.994541,
                    "threshold": 0.95
                },
                "citizenship": {
                    "value": "Citizenship",
                    "score": 1,
                    "threshold": 0.95
                },
                "gender": {
                    "value": "Gender from ID Card",
                    "score": 1,
                    "threshold": 0.95
                },
                "religion": {
                    "value": "Religion",
                    "score": 1,
                    "threshold": 0.95
                },
                "portraitImage": "base64...."
            }
        }
    }
}
```

</details>

### OCR Warning's for low score

{% hint style="info" %}
**Note:** Any field if has a score lower than threshold value of 0.95, we raise a low score warning for the field.
{% endhint %}

HTTP Status Code: `200`

<details>

<summary>OCR Warning <strong>JSON Response</strong></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",
    "warnings": [
       {
           "message": "Low confidence score for ocr, please check [citizenship] from ocrResult for more details",
           "code": 10030,
           "operations": [
               "ocr"
           ]
       },
       {
           "message": "Low confidence score for ocr, please check [gender] from ocrResult for more details",
           "code": 10032,
           "operations": [
               "ocr"
           ]
       }
    ]
    "imageQualityResult": {
         "front": {
        -----[TRUNCATED]------
    },
    "card":{
        -----[TRUNCATED]------
    },
    "ocrResult": {
      "front": {
        "data":{
              -----[TRUNCATED]------
               "citizenship": {
                   "value": "abc",
                   "score": 0, // Low confidence Score
                   "threshold": 0.95
               },
               "gender": {
                   "value": "O",
                   "score": 0, // Low confidence Score
                   "threshold": 0.95
               },
              -----[TRUNCATED]------
            }
        }
    }
}
```

</details>

### Image Color Reprint

HTTP Status Code: `200`&#x20;

<details>

<summary>Image Color Reprint <strong>JSON Response</strong></summary>

```json
{
    "transactionId": "6f840f86-6859-4270-8389-a0707c0f8049",
    "partnerTrxId": "bee5db78-d55f-44cf-83d2-c02f85753ce2",
    "groupId": "aaaaaaaa",
    "errors": [
        {
            "message": "Spoof check failed. Image submitted is color reprint",
            "code": 5603,
            "operations": [
                "ocr"
            ]
        }
    ],
    "imageQualityResult": {
        "front": {
            "glare": {
                "score": 0,
                "threshold": 0.95
            },
            "blurriness": {
                "score": 0.003044,
                "threshold": 0.95
            },
            "lowLight": {
                "score": 0.090518,
                "threshold": 0.95
            }
        }
    },
    "ocrResult": {
        "front": {
            "data": {
                "idNumber": {
                    "value": "ID NUMBER",
                    "score": 0.974472,
                    "threshold": 0.95
                },
                "name": {
                    "value": "NAME",
                    "score": 0.999658,
                    "threshold": 0.95
                },
                "address": {
                    "value": "ADDRESS",
                    "score": 0.998371,
                    "threshold": 0.95
                },
                "dob": {
                    "value": "YYYYMMDD",
                    "score": 0.974472,
                    "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
                },
                "portraitImage": "Base64...",
        }
    }
}
```

</details>

## MyPR

<details>

<summary>Request for Front Side Only</summary>

```json
{
  "operations": ["ocr"],
  "payload": {
    "partnerTrxId": "random-uuid",
    "groupId": "random-uuid",
    "idType": "ID_CARD",
    "country": "MYS",
    "idSubtype": "MyPR",
    "idFrontSideImage": "Base64 encoded image of ID front side"
  },
  "userConsent": {
    "userIP": "0.0.0.0",
    "country": "MYS",
    "obtained": true,
    "obtainedAt": "1680700959"
  }
}
```

</details>

<details>

<summary>Request for Front Side and Back Side</summary>

```json
{
  "operations": ["ocr"],
  "payload": {
    "partnerTrxId": "random-uuid",
    "groupId": "random-uuid",
    "idType": "ID_CARD",
    "country": "MYS",
    "idSubtype": "MyPR",
    "idFrontSideImage": "Base64 encoded image of ID front side",
    "idBackSideImage": "Base64 encoded image of ID back side" //if enabled 
  },
  "userConsent": {
    "userIP": "0.0.0.0",
    "country": "MYS",
    "obtained": true,
    "obtainedAt": "1680700959"
  }
}
```

</details>

### Success Response

HTTP Status Code: `200`

<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": "MyPR",
        "isoAlpha3CountryCode": "MYS",
        "isoAlpha2CountryCode": "MY"
    },
    "imageQualityResult": {
        "front": {
            "blurriness": {
                "score": 0.000053,
                "threshold": 0.95
            },
            "lowLight": {
                "score": 0.166888,
                "threshold": 0.95
            }
        }
    },
    "ocrResult": {
        "front": {
            "data": {
                "idNumber": {
                    "value": "ID Number from ID Card",
                    "score": 0.998806,
                    "threshold": 0.95
                },
                "name": {
                    "value": "Name",
                    "score": 0.999115,
                    "threshold": 0.95
                },
                "address": {
                    "value": "Address",
                    "score": 0.99602,
                    "threshold": 0.95
                },
                "dob": {
                    "value": "YYYY-MM-DD",
                    "score": 0.998806,
                    "threshold": 0.95
                },
                "citizenship": {
                    "value": "Country",
                    "score": 1,
                    "threshold": 0.95
                },
                "gender": {
                    "value": "Gender from ID Card",
                    "score": 1,
                    "threshold": 0.95
                },
                "religion": {
                    "value": "Religion",
                    "score": 1,
                    "threshold": 0.95
                },
                "portraitImage": "Base64...."
            }
        }
    }
}
```

</details>

### Error 5023 - IdNumber Doesn't contain a valid DOB

{% hint style="info" %}
**Note:** In some cases, glare or other obstructions on MyPR cards may prevent proper extraction of the ID number, which in turn affects the extraction of the date of birth. If the ID number is occluded or not extracted correctly, the following error message will be returned.
{% endhint %}

HTTP Status Code: `400`

<details>

<summary>Error 5023 - <strong>JSON Response</strong></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",
    "warnings": [
        {
            "message": "Low confidence score for ocr, please check [idNumber] from ocrResult for more details",
            "code": 10033,
            "operations": [
                "ocr"
            ]
        }
    ],
    "errors": [
        {
            "message": "Bad Quality Image , Id Number Extraction Failed",
            "code": 5023,
            "operations": [
                "ocr"
            ]
        }
    ],
    "imageQualityResult": {
        "front": {
            "glare": {
                "score": 0,
                "threshold": 0.95
            },
            "blurriness": {
                "score": 0.021078,
                "threshold": 0.95
            },
            "lowLight": {
                "score": 0.130729,
                "threshold": 0.95
            }
        }
    },
    "ocrResult": {
        "front": {
            "data": {
                "idNumber": {
                    "value": "Id Number from ID CARD",
                    "score": 0,
                    "threshold": 0.95
                },
                "name": {
                    "value": "Name",
                    "score": 0.999958,
                    "threshold": 0.95
                },
                "address": {
                    "value": "Address",
                    "score": 0.994541,
                    "threshold": 0.95
                },
                "citizenship": {
                    "value": "Citizenship",
                    "score": 1,
                    "threshold": 0.95
                },
                "gender": {
                    "value": "Gender from ID Card",
                    "score": 1,
                    "threshold": 0.95
                },
                "religion": {
                    "value": "Religion",
                    "score": 1,
                    "threshold": 0.95
                },
                "portraitImage": "base64...."
            }
        }
    }
}
```

</details>

### OCR Warning's for low score

{% hint style="info" %}
**Note:** Any field if has a score lower than threshold value of 0.95, we raise a low score warning for the field.
{% endhint %}

HTTP Status Code: `200`

<details>

<summary>OCR Warning <strong>JSON Response</strong></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",
    "warnings": [
       {
           "message": "Low confidence score for ocr, please check [citizenship] from ocrResult for more details",
           "code": 10030,
           "operations": [
               "ocr"
           ]
       },
       {
           "message": "Low confidence score for ocr, please check [gender] from ocrResult for more details",
           "code": 10032,
           "operations": [
               "ocr"
           ]
       },
    ],
    "imageQualityResult": {
        -----[TRUNCATED]------
    },
    "card":{
        -----[TRUNCATED]------
    },
    "ocrResult": {
      "front": { 
          "data":{
              -----[TRUNCATED]------
               "citizenship": {
                   "value": "abc",
                   "score": 0, // Low confidence Score
                   "threshold": 0.95
               },
               "gender": {
                   "value": "O",
                   "score": 0, // Low confidence Score
                   "threshold": 0.95
               },
              -----[TRUNCATED]------
          }
       }
    }
}
```

</details>

### Image Color Reprint

HTTP Status Code: `200`&#x20;

<details>

<summary>Image Color Reprint <strong>JSON Response</strong></summary>

```json
{
    "transactionId": "edd59ff5-a511-4197-b720-a5a101d95119",
    "partnerTrxId": "80edd431-9572-4d7c-a714-42ab7b342d9a",
    "groupId": "aaaaaaaa",
    "errors": [
        {
            "message": "Spoof check failed. Image submitted is color reprint",
            "code": 5603,
            "operations": [
                "ocr"
            ]
        }
    ],
    "imageQualityResult": {
        "front": {
            "glare": {
                "score": 0.1,
                "threshold": 0.95
            },
            "blurriness": {
                "score": 0,
                "threshold": 0.95
            },
            "lowLight": {
                "score": 0.02345,
                "threshold": 0.95
            }
        }
    },
    "ocrResult": {
        "front": {
            "data": {
                "idNumber": {
                    "value": "ID NUMBER",
                    "score": 0.984532,
                    "threshold": 0.95
                },
                "name": {
                    "value": "NAME",
                    "score": 0.999568,
                    "threshold": 0.95
                },
                "address": {
                    "value": "ADDRESS",
                    "score": 0.999137,
                    "threshold": 0.95
                },
                "dob": {
                    "value": "YYYYMMDD",
                    "score": 0.991234,
                    "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
                },
                "portraitImage": "Base64...",
        }
    }
}
```

</details>
