> For the complete documentation index, see [llms.txt](https://docs.vida.id/identity-stack/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.vida.id/identity-stack/verify/document-ai/ocr-and-document-verification/ocr-and-document-verification-v1/full-details-endpoint/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.
   {% 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",
  "imageQualityResult": {
    "blurriness": {
        "score": 0.001487,
        "threshold": 0.95
    },
    "lowLight": {
        "score": 0.547791,
        "threshold": 0.95
    },
    "overExposure": {
        "score": 0.600573,
        "threshold": 0.95
    },
    "cardDimension": {
        "card_coordinates": {
            "x1": 186,
            "x2": 1778,
            "y1": 376,
            "y2": 1339
        },
        "card_width": 1592,
        "card_height": 963
    }
  },
  "card": {
    "country": "INDONESIA",
    "type": "KTP",
    "isoAlpha3CountryCode": "IDN",
    "isoAlpha2CountryCode": "ID"
  },
  "ocrResult": {
        "data": {
            "idNumber": {
                "value": "ID-Number",
                "score": 0.999987,
                "threshold": 0.95
            },
            "name": {
                "value": "NAME",
                "score": 0.988557,
                "threshold": 0.95
            },
            "address": {
                "value": "Address",
                "score": 0.998239,
                "threshold": 0.95
            },
            "dob": {
                "value": "DD-MM-YYYY",
                "score": 0.999544,
                "threshold": 0.95
            },
            "gender": {
                "value": "Gender from id card (M/F/O)",
                "score": 0.999999,
                "threshold": 0.95
            },
            "religion": {
                "value": "Religion",
                "score": 0.999998,
                "threshold": 0.95
            },
            "province": {
                "value": "Provience",
                "score": 0.998472,
                "threshold": 0.95
            },
            "city": {
                "value": "City",
                "score": 0.977755,
                "threshold": 0.95
            },
            "placeOfBirth": {
                "value": "Place Of Birth",
                "score": 0.999544,
                "threshold": 0.95
            },
            "bloodType": {
                "value": "Blood type",
                "score": 0.95,
                "threshold": 0.95
            },
            "neighborhoodAssociationGroup": {
                "value": "Neighborhood Assocaition Group",
                "score": 0.99946,
                "threshold": 0.95
            },
            "village": {
                "value": "Village",
                "score": 0.998349,
                "threshold": 0.95
            },
            "subDistrict": {
                "value": "Sub District",
                "score": 0.999993,
                "threshold": 0.95
            },
            "maritalStatus": {
                "value": "Marital Status",
                "score": 0.999998,
                "threshold": 0.95
            },
            "occupation": {
                "value": "Occupation",
                "score": 0.999169,
                "threshold": 0.95
            },
            "nationality": {
                "value": "Nationality",
                "score": 0.965914,
                "threshold": 0.95
            },
            "validUntil": {
                "value": "Validity",
                "score": 0.968373,
                "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": "b0499f89-14e5-414a-bcda-011bf58690bd",
    "partnerTrxId": "7a3734a7-6a9c-45f3-8e7b-4d06c57905c8",
    "groupId": "1634dc4d-a2f2-4a4f-9a29-8b0ea480fa8f",
    "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": {
        -----[TRUNCATED]------
    },
    "card":{
        -----[TRUNCATED]------
    },
    "ocrResult": {
      "data":{
          -----[TRUNCATED]------
           "religion": {
               "value": "XYZ",
               "score": 0.93027, // Low confidence score
               "threshold": 0.95
           },
           "gender": {
               "value": "O",
               "score": 0, // Low confidence Score
               "threshold": 0.95
           },
          -----[TRUNCATED]------
      }
    }
}
```

</details>
