> 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/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"
  },
  "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 for Front Side Only</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",
    "imageQualityResult": {
        "front": {
            "statusCode": 5000
        }
    },
    "card": {
        "country": "MALAYSIA",
        "type": "MyKad",
        "isoAlpha3CountryCode": "MYS",
        "isoAlpha2CountryCode": "MY"
    },
    "ocrResult": {
        "front": {
            "idNumber": "ID Number from ID Card",
            "name": "Name",
            "address": "Address",
            "dob": "YYYY-MM-DD",
            "citizenship": "Country",
            "gender": "Gender from ID Card",
            "religion": "Religion",
            "address1": "address1",
            "address2": "address2",
            "zipCode": "Zip Code",
            "city": "City",
            "state": "State"
        }
    }
}
</code></pre>

</details>

<details>

<summary>Success JSON Response for Front Side and Back Side</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": {
            "statusCode": 5000
        },
        "back": {
            "statusCode": 5000
        }
    },
    "card": {
        "country": "MALAYSIA",
        "type": "MyKad",
        "isoAlpha3CountryCode": "MYS",
        "isoAlpha2CountryCode": "MY"
    },
    "ocrResult": {
        "front": {
            "idNumber": "ID Number from ID Card",
            "name": "Name",
            "address": "Address",
            "dob": "YYYY-MM-DD",
            "citizenship": "Country",
            "gender": "Gender from ID Card",
            "religion": "Religion",
            "address1": "address1",
            "address2": "address2",
            "zipCode": "Zip Code",
            "city": "City",
            "state": "State"
        },
        "back": {
            "extendedIdNumber": "xxxxxx-xx-xxxx-xx-xx"
        }
    }
}
```

</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 '*' - 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",
    "imageQualityResult": {
      "front": {
        "statusCode": 5000
        }
      "back": {
        "statusCode": 5000
        }
    },
    "card": {
        "country": "MALAYSIA",
        "type": "MyKad",
        "isoAlpha3CountryCode": "MYS",
        "isoAlpha2CountryCode": "MY"
    },
    "ocrResult": {
        "front": {
            "idNumber": "ID Number from ID Card",
            "name": "Name from id card",
            "address": "Address from id card",
            "dob": "Date of birth in YYYYMMDD format",
            "citizenship": "Citizenship from id card",
            "gender": "Gender from id card (M/F/O)",
            "religion": "Religion from id card",
            "address1": "address1",
            "address2": "address2",
            "zipCode": "Zip Code",
            "city": "City",
            "state": "State"
        },
        "back": {
            "extendedIdNumber": "xxxxxx-xx-xxxx-x*-xx"
        }
    }
}
```

</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`&#x20;

<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",
    "errors": [
        {
            "message": "Bad Quality Image , Id Number Extraction Failed",
            "code": 5023,
            "operations": [
                "ocr"
            ]
        },
        {
            "message": "Extraction failed for the below ocr field. Please make sure the fields are properly visible on the card.",
            "code": 5026,
            "fieldName": "idNumber",
            "operations": [
                "ocr"
            ]
        }
    ],
    "imageQualityResult": {
        "front": {
            "statusCode": 5000
        }
    },
    "ocrResult": {
        "front": {
            "idNumber": "EXTRACTION_ERROR",
            "name": "Name",
            "address": "Address",
            "citizenship": "Citizenship",
            "gender": "Gender from ID Card",
            "religion": "Religion",
            "address1": "address1",
            "address2": "address2",
            "zipCode": "Zip Code",
            "city": "City",
            "state": "State"
        }
    }
}
```

</details>

### Error 5026 - Extraction failed for the below ocr field. Please make sure the fields are properly visible on the card.

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

* This error is raised only for the critical fields of MyKad cards. For other fields, no error will be thrown; instead, the response will contain `EXTRACTION_ERROR`.
* **Critical Fields for MyKad cards are:**

1. **IdNumber**
2. **Name**
3. **DOB**
4. **Address**
   {% endhint %}

HTTP Status Code: `400`&#x20;

<details>

<summary>Error 5026 - Critical field extraction failed</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": "Extraction failed for the below ocr field. Please make sure the fields are properly visible on the card.",
            "code": 5026,
            "fieldName": "idNumber",  // citizenship was not mentioned as it is non critical field
            "operations": [
                "ocr"
            ]
        }
    ],
    "imageQualityResult": {
      "front": {
        "statusCode": 5000
        }
    }
}
```

</details>

HTTP Status Code: `200`&#x20;

<details>

<summary>Success response - Extraction failed only for non critical field</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": {
        "statusCode": 5000
    },
    "card": {
        "country": "MALAYSIA",
        "type": "MyKad",
        "isoAlpha3CountryCode": "MYS",
        "isoAlpha2CountryCode": "MY"
    },
    "ocrResult": {
      "front": {
        "idNumber": "ID Number from ID Card",
        "name": "Name",
        "address": "Address",
        "dob": "YYYYMMDD",
        "citizenship": "Country",
        "gender": "Gender from ID Card",
        "religion": "religion",
        "address1": "address1",
        "address2": "address2",
        "zipCode": "Zip Code",
        "city": "City",
        "state": "State"
        }
    }
}
```

</details>

## MyTentera

### Request

<details>

<summary>Request</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>

### 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",
    "imageQualityResult": {
        "front": {
            "statusCode": 5000
        }
    },
    "card": {
        "country": "MALAYSIA",
        "type": "MyTentera",
        "isoAlpha3CountryCode": "MYS",
        "isoAlpha2CountryCode": "MY"
    },
    "ocrResult": {
        "front": {
            "idNumber": "ID Number from ID Card",
            "name": "Name",
            "address": "Address",
            "dob": "YYYY-MM-DD",
            "gender": "Gender from ID Card",
            "religion": "Religion",
            "militaryId": "Military-ID",
            "militaryRank": "Military-RANK",
            "militaryDivision": "Military-DIVISION"
        }
    }
}
```

</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`&#x20;

<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",
    "errors": [
        {
            "message": "Bad Quality Image , Id Number Extraction Failed",
            "code": 5023,
            "operations": [
                "ocr"
            ]
        },
        {
            "message": "Extraction failed for the below ocr field. Please make sure the fields are properly visible on the card.",
            "code": 5026,
            "fieldName": "idNumber",
            "operations": [
                "ocr"
            ]
        }
    ],
    "imageQualityResult": {
        "front": {
            "statusCode": 5000
        }
    },
    "ocrResult": {
        "front": {
            "idNumber": "EXTRACTION_ERROR",
            "name": "Name",
            "address": "Address",
            "citizenship": "Citizenship",
            "gender": "Gender from ID Card",
            "religion": "Religion"
        }
    }
}
```

</details>

### Error 5026 - Extraction failed for the below ocr field. Please make sure the fields are properly visible on the card.

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

* This error is raised only for the critical fields of MyTentera cards. For other fields, no error will be thrown; instead, the response will contain `EXTRACTION_ERROR`.
* **Note: Critical Fields for MyTentera cards are:**
  1. **IdNumber**
  2. **Name**
  3. **DOB**
  4. **Address**
     {% endhint %}

HTTP Status Code: `400`&#x20;

<details>

<summary>Error 5026 - Critical field extraction failed</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": "Extraction failed for the below ocr field. Please make sure the fields are properly visible on the card.",
      "code": 5026,
      "fieldName": "idNumber",
      "operations": [
        "ocr"
      ]
    }
  ],
  "imageQualityResult": {
    "front": {
      "statusCode": 5000
    }
  }
}
```

</details>

HTTP Status Code: `200`&#x20;

<details>

<summary>Success response - Extraction failed only for non critical field</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": {
            "statusCode": 5000
        }
  },
  "card": {
    "country": "MALAYSIA",
    "type": "MyTentera",
    "isoAlpha3CountryCode": "MYS",
    "isoAlpha2CountryCode": "MY"
  },
  "ocrResult": {
   "front":{
    "idNumber": "ID-Number",
    "name": "Name",
    "address": "ADDRESS",
    "dob": "YYYYMMDD",
    "gender": "M",
    "religion": "EXTRACTION_ERROR", // Non Critical Field
    "militaryId": "Military-ID",
    "militaryRank": "Military-RANK",
    "militaryDivision": "Military-DIVISION"
    }
  }
}
```

</details>

## MyKas

### Request

<details>

<summary>Request</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>

### 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",
    "imageQualityResult": {
        "front": {
            "statusCode": 5000
        }
    },
    "card": {
        "country": "MALAYSIA",
        "type": "MyKas",
        "isoAlpha3CountryCode": "MYS",
        "isoAlpha2CountryCode": "MY"
    },
    "ocrResult": {
        "front": {
            "idNumber": "ID Number from ID Card",
            "name": "Name",
            "address": "Address",
            "dob": "YYYY-MM-DD",
            "dateOfExpiry": "Date of expire from ID Card",
            "citizenship": "Country",
            "gender": "Gender from ID Card",
            "religion": "Religion"
        }
    }
}
```

</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`&#x20;

<details>

<summary>Error 5203 - 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",
    "errors": [
        {
            "message": "Bad Quality Image , Id Number Extraction Failed",
            "code": 5023,
            "operations": [
                "ocr"
            ]
        },
        {
            "message": "Extraction failed for the below ocr field. Please make sure the fields are properly visible on the card.",
            "code": 5026,
            "fieldName": "idNumber",
            "operations": [
                "ocr"
            ]
        }
    ],
    "imageQualityResult": {
        "front": {
            "statusCode": 5000
        }
    },
    "ocrResult": {
        "front": {
            "idNumber": "EXTRACTION_ERROR",
            "name": "Name",
            "address": "Address",
            "citizenship": "Citizenship",
            "gender": "Gender from ID Card",
            "religion": "Religion"
        }
    }
}
```

</details>

### Error 5026 - Extraction failed for the below ocr field. Please make sure the fields are properly visible on the card.

{% hint style="info" %}
**Note:**

* This error is raised only for the critical fields of MyKas cards. For other fields, no error will be thrown; instead, the response will contain `EXTRACTION_ERROR`.
* **Critical Fields for MyKas cards are ->**
  1. **IdNumber**
  2. **Name**
  3. **DOB**
  4. **Address**
     {% endhint %}

HTTP Status Code: `400`&#x20;

<details>

<summary>Error 5026 - Critical field extraction failed</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": "Extraction failed for the below ocr field. Please make sure the fields are properly visible on the card.",
      "code": 5026,
      "fieldName": "idNumber",
      "operations": [
        "ocr"
      ]
    }
  ],
  "imageQualityResult": {
   "front": {
    "statusCode": 5000
    }
  }
}
```

</details>

HTTP Status Code: `200`&#x20;

<details>

<summary>Success response - Extraction failed only for non critical field</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": {
       "statusCode": 5000
       }
  },
  "card":{
     "country": "MALAYSIA",
     "type": "MyKas",
     "isoAlpha3CountryCode": "MYS",
     "isoAlpha2CountryCode": "MY"
  },
  "ocrResult": {
    "front": {
     "idNumber": "Id-Number",
     "name": "NAME",
     "address": "ADDRESS",
     "dob": "YYYYMMDD",
     "dateOfExpiry": "DateOfExpiry",
     "citizenship": "Citizenship",
     "gender": "Gender from id card (M/F/O)",
     "religion": "EXTRACTION_ERROR" // Non Critical Field
     }
  }
}
```

</details>

## MyPR

### Request

<details>

<summary>Request</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>

### Success Response

HTTP Status Code: `200`&#x20;

<details>

<summary>Success JSON Response</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",
    "imageQualityResult": {
        "front": {
            "statusCode": 5000
        }
    },
    "card": {
        "country": "MALAYSIA",
        "type": "MyPR",
        "isoAlpha3CountryCode": "MYS",
        "isoAlpha2CountryCode": "MY"
    },
    "ocrResult": {
        "front": {
            "idNumber": "ID Number from ID Card",
            "name": "Name",
            "address": "Address",
            "dob": "YYYY-MM-DD",
            "citizenship": "Country",
            "gender": "Gender from ID Card"
        }
    }
}
</code></pre>

</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`&#x20;

<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",
    "errors": [
        {
            "message": "Bad Quality Image , Id Number Extraction Failed",
            "code": 5023,
            "operations": [
                "ocr"
            ]
        },
        {
            "message": "Extraction failed for the below ocr field. Please make sure the fields are properly visible on the card.",
            "code": 5026,
            "fieldName": "idNumber",
            "operations": [
                "ocr"
            ]
        }
    ],
    "imageQualityResult": {
        "front": {
            "statusCode": 5000
        }
    },
    "ocrResult": {
        "front": {
            "idNumber": "EXTRACTION_ERROR",
            "name": "Name",
            "address": "Address",
            "citizenship": "Citizenship",
            "gender": "Gender from ID Card",
            "religion": "Religion"
        }
    }
}
```

</details>

### Error 5026 - Extraction failed for the below ocr field. Please make sure the fields are properly visible on the card.

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

* This error is raised only for the critical fields of MyPR cards. For other fields, no error will be thrown; instead, the response will contain `EXTRACTION_ERROR`.
* **Critical Fields for MyPR cards are:**
  1. **IdNumber**
  2. **Name**
  3. **DOB**
  4. **Address**
     {% endhint %}

HTTP Status Code: `400`&#x20;

<details>

<summary>Error 5026 - Critical field extraction failed</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": "Extraction failed for the below ocr field. Please make sure the fields are properly visible on the card.",
      "code": 5026,
      "fieldName": "idNumber",
      "operations": [
        "ocr"
      ]
    }
  ],
  "imageQualityResult": {
    "front": {
      "statusCode": 5000
    }
  }
}
```

</details>

HTTP Status Code: `200`&#x20;

<details>

<summary>Success response - Extraction failed only for non critical field</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": {
      "statusCode": 5000
    }
  },
  "card":{
     "country": "MALAYSIA",
     "type": "MyPR",
     "isoAlpha3CountryCode": "MYS",
     "isoAlpha2CountryCode": "MY"
  },
  "ocrResult": {
    "front": {
     "idNumber": "Id-Number",
     "name": "EXTRACTION_ERROR", // Non Critical Field
     "address": "ADDRESS",
     "dob": "YYYYMMDD",
     "citizenship": "Citizenship",
     "gender": "Gender from id card (M/F/O)",
     "religion": "EXTRACTION_ERROR" // Non Critical Field
     }
  }
}
```

</details>
