> 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/ktp.md).

# KTP

{% hint style="info" %}
**Note:** Some cards may have the blood group recorded as `'-'`. This can happen for two reasons:

1. The card **explicitly** lists the blood group as `'-'`.
2. The blood group is **difficult to read**, making it unclear in the extracted data.

If you need KTP portrait extraction, please contact VIDA support to enable that feature.
{% endhint %}

<details>

<summary>Request</summary>

```json
{
  "operations": ["ocr"],
  "payload": {
    "partnerTrxId": "random-uuid",
    "groupId": "random-uuid",
    "idType": "ID_CARD",
    "country": "IDN",
    "idSubtype": "KTP",
    "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`

<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": "INDONESIA",
        "type": "KTP",
        "isoAlpha3CountryCode": "IDN",
        "isoAlpha2CountryCode": "ID"
    },
    "imageQualityResult": {
        "front": {
            "blurriness": {
                "score": 0.000002,
                "threshold": 0.95
            },
            "lowLight": {
                "score": 0.418286,
                "threshold": 0.95
            },
            "overExposure": {
                "score": 0.709778,
                "threshold": 0.95
            },
            "cardDimension": {
                "card_coordinates": {
                    "x1": 55,
                    "x2": 987,
                    "y1": 84,
                    "y2": 662
                },
                "card_width": 932,
                "card_height": 578
            }
        }
    },
    "ocrResult": {
        "front": {
            "data": {
                "idNumber": {
                    "value": "ID Number from ID Card",
                    "score": 0.999995,
                    "threshold": 0.95
                },
                "name": {
                    "value": "Name",
                    "score": 0.998702,
                    "threshold": 0.95
                },
                "address": {
                    "value": "Address",
                    "score": 0.959262,
                    "threshold": 0.95
                },
                "dob": {
                    "value": "DD-MM-YYYY",
                    "score": 0.998832,
                    "threshold": 0.95
                },
                "gender": {
                    "value": "Gender from ID Card",
                    "score": 0.994388,
                    "threshold": 0.95
                },
                "religion": {
                    "value": "Religion",
                    "score": 0.999992,
                    "threshold": 0.95
                },
                "province": {
                    "value": "Province",
                    "score": 0.953497,
                    "threshold": 0.95
                },
                "city": {
                    "value": "City",
                    "score": 0.999676,
                    "threshold": 0.95
                },
                "placeOfBirth": {
                    "value": "POB",
                    "score": 0.998832,
                    "threshold": 0.95
                },
                "bloodType": {
                    "value": "Blood Type",
                    "score": 0.99999,
                    "threshold": 0.95
                },
                "neighborhoodAssociationGroup": {
                    "value": "RT/RW",
                    "score": 0.999826,
                    "threshold": 0.95
                },
                "village": {
                    "value": "VILLAGE",
                    "score": 0.962574,
                    "threshold": 0.95
                },
                "subDistrict": {
                    "value": "SUB-DISTRICT",
                    "score": 0.969316,
                    "threshold": 0.95
                },
                "maritalStatus": {
                    "value": "Marital Status",
                    "score": 0.999993,
                    "threshold": 0.95
                },
                "occupation": {
                    "value": "Occupation",
                    "score": 0.999993,
                    "threshold": 0.95
                },
                "nationality": {
                    "value": "Nationality",
                    "score": 0.999996,
                    "threshold": 0.95
                },
                "validUntil": {
                    "value": "DD-MM-YYYY",
                    "score": 0.999999,
                    "threshold": 0.95
                }
            }
        }
    }
}
```

</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 [religion] from ocrResult for more details",
           "code": 10034,
           "operations": [
               "ocr"
           ]
       },
       {
           "message": "Low confidence score for ocr, please check [gender] from ocrResult for more details",
           "code": 10032,
           "operations": [
               "ocr"
           ]
       }
    ],
    "imageQualityResult": {
      "front": {
            "blurriness": {
                "score": 0.000517,
                "threshold": 0.95
            },
            "lowLight": {
                "score": 0.635648,
                "threshold": 0.95
            },
            "overExposure": {
                "score": 0.526486,
                "threshold": 0.95
            },
            "cardDimension": {
                "card_coordinates": {
                    "x1": 485,
                    "x2": 1007,
                    "y1": 77,
                    "y2": 966
                },
                "card_width": 889,
                "card_height": 522
            }
        }
    },
    "ocrResult": {
        "front": {
            "data": {
                "idNumber": {
                    "value": "ID NUMBER",
                    "score": 0.999993,
                    "threshold": 0.95
                },
                "name": {
                    "value": "NAME",
                    "score": 0.99882,
                    "threshold": 0.95
                },
                "address": {
                    "value": "ADDRESS",
                    "score": 0.96567,
                    "threshold": 0.95
                },
                "dob": {
                    "value": "DD-MM-YYYY",
                    "score": 0.999964,
                    "threshold": 0.95
                },
                "gender": {
                    "value": "Gender from ID Card (M/F)",
                    "score": 0.99971,
                    "threshold": 0.95
                },
                "religion": {
                    "value": "Religion",
                    "score": 0.974708,
                    "threshold": 0.95
                },
                "province": {
                    "value": "Province",
                    "score": 0.987821,
                    "threshold": 0.95
                },
                "city": {
                    "value": "City",
                    "score": 0.964516,
                    "threshold": 0.95
                },
                "placeOfBirth": {
                    "value": "Place of Birth",
                    "score": 0.999964,
                    "threshold": 0.95
                },
                "bloodType": {
                    "value": "Blood Type",
                    "score": 0.999994,
                    "threshold": 0.95
                },
                "neighborhoodAssociationGroup": {
                    "value": "xxx/xxx",
                    "score": 0.992882,
                    "threshold": 0.95
                },
                "village": {
                    "value": "Village",
                    "score": 0.999957,
                    "threshold": 0.95
                },
                "subDistrict": {
                    "value": "District",
                    "score": 0.99837,
                    "threshold": 0.95
                },
                "maritalStatus": {
                    "value": "Marital Status",
                    "score": 0.999284,
                    "threshold": 0.95
                },
                "occupation": {
                    "value": "Occupation",
                    "score": 0.999961,
                    "threshold": 0.95
                },
                "nationality": {
                    "value": "Nationality",
                    "score": 0.999985,
                    "threshold": 0.95
                },
                "validUntil": {
                    "value": "Valid Card",
                    "score": 0.970441,
                    "threshold": 0.95
                },
                "portraitImage": "Base64..."
          }
      }
   }
}
```

</details>
