> 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/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.
{% endhint %}

## MyKad

### Request

<details>

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

### 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": {
      "statusCode": 5000
  },
  "card":{
     "country": "MALAYSIA",
     "type": "MyKad",
     "isoAlpha3CountryCode": "MYS",
     "isoAlpha2CountryCode": "MY"
  },
  "ocrResult": {
     "idNumber": "Id Number from the 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"
  }
}
```

</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": "eee3452d-22de-4fd9-bcd6-fe4dbe1d2161",
    "partnerTrxId": "45a247eb-9071-4ae0-a2e8-fd91c9a9d737",
    "groupId": "9c0afec4-3951-4dd3-bd40-16703f45c82a",
    "imageQualityResult": {
        "statusCode": 5000
    },
    "card": {
        "country": "MALAYSIA",
        "type": "MyKad",
        "isoAlpha3CountryCode": "MYS",
        "isoAlpha2CountryCode": "MY"
    },
    "ocrResult": {
        "idNumber": "98xxxx-10-5115*",
        "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",
    }
}
```

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

<pre class="language-json"><code class="lang-json"><strong>{
</strong>    "transactionId": "b0499f89-14e5-414a-bcda-011bf58690bd",
    "partnerTrxId": "7a3734a7-6a9c-45f3-8e7b-4d06c57905c8",
    "groupId": "1634dc4d-a2f2-4a4f-9a29-8b0ea480fa8f",
    "errors": [
        {
            "message": "Bad Quality Image , Id Number Extraction Failed",
            "code": 5023,
            "operations": [
                "ocr"
            ]
        }
    ],
    "imageQualityResult": {
        "statusCode": 5000
    },
}
</code></pre>

</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 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": "6263ef65-dfe1-4396-b2cb-0b2e2adef004",
    "partnerTrxId": "b976cba6-30f4-49bc-8c89-7c9acd86d77b",
    "groupId": "aaaaaaaa",
    "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": {
        "statusCode": 5000
    },
    "card": {
        "country": "MALAYSIA",
        "type": "MyKad",
        "isoAlpha3CountryCode": "MYS",
        "isoAlpha2CountryCode": "MY"
    },
    "ocrResult": {
        "idNumber": "EXTRACTION_ERROR", // Critical Field
        "name": "Albert",
        "address": "xyz abc xyz abc",
        "dob": "YYYYMMDD",
        "citizenship": "EXTRACTION_ERROR", // Non critical Field
        "gender": "M",
        "religion": "Religion"
    }
}
```

</details>

HTTP Status Code: `200`&#x20;

<details>

<summary>Success response - Extraction failed only for non critical field</summary>

```json
{
    "transactionId": "1373c0d1-5b35-4d0a-9287-ca7a12c3dd54",
    "partnerTrxId": "8938b90f-ef71-41c4-b088-bebf96480fd4",
    "groupId": "aaaaaaaa",
    "imageQualityResult": {
        "statusCode": 5000
    },
    "card": {
        "country": "MALAYSIA",
        "type": "MyKad",
        "isoAlpha3CountryCode": "MYS",
        "isoAlpha2CountryCode": "MY"
    },
    "ocrResult": {
        "idNumber": "98xxxx-10-xxxx",
        "name": "Albert",
        "address": "xyz abc xyz abc",
        "dob": "YYYYMMDD",
        "citizenship": "EXTRACTION_ERROR", // Non critical field
        "gender": "M",
        "religion": "ISLAM"
    }
}
```

</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": {
    "statusCode": 5000
  },
  "card": {
    "country": "MALAYSIA",
    "type": "MyTentera",
    "isoAlpha3CountryCode": "MYS",
    "isoAlpha2CountryCode": "MY"
  },
  "ocrResult": {
    "idNumber": "ID-Number",
    "name": "Name",
    "address": "ADDRESS",
    "dob": "YYYYMMDD",
    "gender": "Gender from id card (M/F/O)",
    "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": "b0499f89-14e5-414a-bcda-011bf58690bd",
    "partnerTrxId": "7a3734a7-6a9c-45f3-8e7b-4d06c57905c8",
    "groupId": "1634dc4d-a2f2-4a4f-9a29-8b0ea480fa8f",
    "errors": [
        {
            "message": "Bad Quality Image , Id Number Extraction Failed",
            "code": 5023,
            "operations": [
                "ocr"
            ]
        }
    ],
    "imageQualityResult": {
        "statusCode": 5000
    },
}
```

</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 MyTentera cards. For other fields, no error will be thrown; instead, the response will contain `EXTRACTION_ERROR`.

**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": {
    "statusCode": 5000
  },
  "card": {
    "country": "MALAYSIA",
    "type": "MyTentera",
    "isoAlpha3CountryCode": "MYS",
    "isoAlpha2CountryCode": "MY"
  },
  "ocrResult": {
    "idNumber": "EXTRACTION_ERROR", // Critical Field
    "name": "Name",
    "address": "ADDRESS",
    "dob": "YYYYMMDD",
    "gender": "M",
    "religion": "EXTRACTION_ERROR", // Non Critical Field
    "militaryId": "Military-ID",
    "militaryRank": "Military-RANK",
    "militaryDivision": "Military-DIVISION"
  }
}
```

</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": "MyTentera",
    "isoAlpha3CountryCode": "MYS",
    "isoAlpha2CountryCode": "MY"
  },
  "ocrResult": {
    "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": {
     "statusCode": 5000
  },
  "card":{
     "country": "MALAYSIA",
     "type": "MyKas",
     "isoAlpha3CountryCode": "MYS",
     "isoAlpha2CountryCode": "MY"
  },
  "ocrResult": {
     "idNumber": "Id-Number",
     "name": "NAME",
     "address": "ADDRESS",
     "dob": "YYYYMMDD",
     "dateOfExpiry": "DateOfExpiry",
     "citizenship": "Citizenship",
     "gender": "Gender from id card (M/F/O)",
     "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>

<pre class="language-json"><code class="lang-json"><strong>{
</strong>    "transactionId": "b0499f89-14e5-414a-bcda-011bf58690bd",
    "partnerTrxId": "7a3734a7-6a9c-45f3-8e7b-4d06c57905c8",
    "groupId": "1634dc4d-a2f2-4a4f-9a29-8b0ea480fa8f",
    "errors": [
        {
            "message": "Bad Quality Image , Id Number Extraction Failed",
            "code": 5023,
            "operations": [
                "ocr"
            ]
        }
    ],
    "imageQualityResult": {
        "statusCode": 5000
    },
}
</code></pre>

</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": {
    "statusCode": 5000
  },
  "card":{
     "country": "MALAYSIA",
     "type": "MyKas",
     "isoAlpha3CountryCode": "MYS",
     "isoAlpha2CountryCode": "MY"
  },
  "ocrResult": {
     "idNumber": "EXTRACTION_ERROR", // Critical Field
     "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>

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": "MyKas",
     "isoAlpha3CountryCode": "MYS",
     "isoAlpha2CountryCode": "MY"
  },
  "ocrResult": {
     "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>

```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": "MyPR",
     "isoAlpha3CountryCode": "MYS",
     "isoAlpha2CountryCode": "MY"
  },
  "ocrResult": {
     "idNumber": "Id-Number",
     "name": "NAME",
     "address": "ADDRESS",
     "dob": "YYYYMMDD",
     "citizenship": "Citizenship",
     "gender": "Gender from id card (M/F/O)",
     "religion": "Religion"
  }
}
```

</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": "b0499f89-14e5-414a-bcda-011bf58690bd",
    "partnerTrxId": "7a3734a7-6a9c-45f3-8e7b-4d06c57905c8",
    "groupId": "1634dc4d-a2f2-4a4f-9a29-8b0ea480fa8f",
    "errors": [
        {
            "message": "Bad Quality Image , Id Number Extraction Failed",
            "code": 5023,
            "operations": [
                "ocr"
            ]
        }
    ],
    "imageQualityResult": {
        "statusCode": 5000
    },
}
```

</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 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": {
    "statusCode": 5000
  },
  "card":{
     "country": "MALAYSIA",
     "type": "MyPR",
     "isoAlpha3CountryCode": "MYS",
     "isoAlpha2CountryCode": "MY"
  },
  "ocrResult": {
     "idNumber": "EXTRACTION_ERROR", // Critical Field
     "name": "NAME",
     "address": "ADDRESS",
     "dob": "YYYYMMDD",
     "citizenship": "Citizenship",
     "gender": "Gender from id card (M/F/O)",
     "religion": "EXTRACTION_ERROR" // Non Critical Field
  }
}
```

</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": "MyPR",
     "isoAlpha3CountryCode": "MYS",
     "isoAlpha2CountryCode": "MY"
  },
  "ocrResult": {
     "idNumber": "Id-Number",
     "name": "NAME",
     "address": "ADDRESS",
     "dob": "YYYYMMDD",
     "citizenship": "Citizenship",
     "gender": "Gender from id card (M/F/O)",
     "religion": "EXTRACTION_ERROR" // Non Critical Field
  }
}
```

</details>
