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

# KTP

<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"
    },
    "idVerificationResult": {
        "spoofingResult": {
            "message": "Success",
            "code": 5000,
            "recapScore": {
                "score": 0.545752,
                "threshold": 0.95
            },
            "blackWhite": {
                "score": 0.034161,
                "threshold": 0.95
            },
            "colorPrint": {
                "score": 0.492669,
                "threshold": 0.95
            },
            "screenshot": {
                "score": 0.073531,
                "threshold": 0.95
            }
        },
        "landmarkResult": {
            "code": 5000,
            "message": "Success",
            "threshold": 0.95,
            "containerResult": [
                {
                    "position": {
                        "x": 568,
                        "y": 26,
                        "width": 233,
                        "height": 41
                    },
                    "name": "provinsi",
                    "score": 0.9915
                },
                {
                    "position": {
                        "x": 101,
                        "y": 131,
                        "width": 113,
                        "height": 45
                    },
                    "name": "nik",
                    "score": 0.992
                },
                {
                    "position": {
                        "x": 91,
                        "y": 217,
                        "width": 112,
                        "height": 35
                    },
                    "name": "nama",
                    "score": 0.9921
                },
                {
                    "position": {
                        "x": 86,
                        "y": 258,
                        "width": 328,
                        "height": 37
                    },
                    "name": "tampat-tgl-lahir",
                    "score": 0.9905
                },
                {
                    "position": {
                        "x": 78,
                        "y": 302,
                        "width": 259,
                        "height": 34
                    },
                    "name": "jenis-kelamin",
                    "score": 0.9925
                },
                {
                    "position": {
                        "x": 77,
                        "y": 345,
                        "width": 140,
                        "height": 33
                    },
                    "name": "alamat",
                    "score": 0.9913
                },
                {
                    "position": {
                        "x": 168,
                        "y": 390,
                        "width": 143,
                        "height": 33
                    },
                    "name": "rt-rw",
                    "score": 0.9908
                },
                {
                    "position": {
                        "x": 165,
                        "y": 434,
                        "width": 174,
                        "height": 35
                    },
                    "name": "kel-desa",
                    "score": 0.9907
                },
                {
                    "position": {
                        "x": 160,
                        "y": 479,
                        "width": 228,
                        "height": 35
                    },
                    "name": "kecamatan",
                    "score": 0.993
                },
                {
                    "position": {
                        "x": 64,
                        "y": 522,
                        "width": 137,
                        "height": 33
                    },
                    "name": "agama",
                    "score": 0.9878
                },
                {
                    "position": {
                        "x": 62,
                        "y": 568,
                        "width": 373,
                        "height": 39
                    },
                    "name": "status-perkawinan",
                    "score": 0.9903
                },
                {
                    "position": {
                        "x": 54,
                        "y": 613,
                        "width": 206,
                        "height": 36
                    },
                    "name": "pekerjaan",
                    "score": 0.9903
                },
                {
                    "position": {
                        "x": 52,
                        "y": 659,
                        "width": 375,
                        "height": 39
                    },
                    "name": "kewarganegaraan",
                    "score": 0.9918
                },
                {
                    "position": {
                        "x": 51,
                        "y": 705,
                        "width": 303,
                        "height": 38
                    },
                    "name": "berlaku-hingga",
                    "score": 0.9915
                },
                {
                    "position": {
                        "x": 815,
                        "y": 319,
                        "width": 199,
                        "height": 34
                    },
                    "name": "gol-darah",
                    "score": 0.9913
                },
                {
                    "position": {
                        "x": 1161,
                        "y": 140,
                        "width": 367,
                        "height": 485
                    },
                    "name": "portrait",
                    "score": 0.9967
                }
            ],
            "landmarkTags": [
                {
                    "name": "portrait_background_color",
                    "value": "red"
                }
            ],
            "landmarkVerification": [
                {
                    "name": "heuristic_check",
                    "status": "pass"
                }
            ]
        },
        "forgeryResult": {
            "code": 5000,
            "message": "Success",
            "summary": {
                "score": 0.02,
                "threshold": 0.95
            }
        }
    }
}
```

</details>

### Forged Card Response

HTTP Status Code: `400`

<details>

<summary>Forged Card 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": "The card appears to be forged.",
            "code": 5024,
            "operations": [
                "idVerification"
            ]
        }
    ],
  "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
        }
    }
}
```

</details>

### Landmark Warning Response

HTTP Status Code: `200`

<details>

<summary>Landmark Warning 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": "Image has Occlusion, please check [provinsi] from landmarkResult for more details",
            "code": 10411,
            "operations": [
                "idVerification"
            ]
        },
        {
            "message": "Image has Occlusion, please check [nik] from landmarkResult for more details",
            "code": 10412,
            "operations": [
                "idVerification"
            ]
        }
  ],
  "imageQualityResult": {
    ----[TRUNCATED]-----
  }
  "card":{
    ----[TRUNCATED]-----
  },
  "idVerificationResult": {
    "spoofingResult": {
      ----[TRUNCATED]-----
    },
    "landmarkResult": {
        "code": 5000,
        "message": "Success",
        "threshold": 0.95,
        "containerResult": [
            ----[TRUNCATED]-----
            {
                "position": {
                    "x": 195,
                    "y": 1172,
                    "width": 677,
                    "height": 522
                },
                "name": "provinsi",
                "score": 0.12 // Low Confidence Score
            },
            {
                "position": {
                    "x": null,
                    "y": null,
                    "width": null,
                    "height": null
                },
                "name": "nik",
                "score": 0 // Low Confidence Score
            },
            ----[TRUNCATED]-----
        ]
    },
    "forgeryResult": {
        ----[TRUNCATED]-----
    }
  }
}
```

</details>

### Spoof Warning Response

{% hint style="info" %}
**Note**: This happens when 1 spoof check fails.
{% endhint %}

HTTP Status Code: `200`

<details>

<summary>Spoof Warning 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": "Image submitted is Recaptured",
            "code": 10008,
            "operations": [
                "idVerification"
            ]
        }
  ],
  "imageQualityResult": {
    ----[TRUNCATED]-----
  }
  "card":{
    ----[TRUNCATED]-----
  },
  "idVerificationResult": {
    "spoofingResult": {
        "message": "Recap score is above the threshold",
        "code": 5012,
        "recapScore": {
            "score": 0.99,
            "threshold": 0.95
        },
        "blackWhite": {
            "score": 0.027551,
            "threshold": 0.95
        },
        "colorPrint": {
            "score": 0.446124,
            "threshold": 0.95
        },
        "screenshot": {
            "score": 0.139836,
            "threshold": 0.95
        }
    },
    "landmarkResult": {
        ----[TRUNCATED]-----
    },
    "forgeryResult": {
        ----[TRUNCATED]-----
    }
  }
}
```

</details>

### Spoof Error Response

{% hint style="info" %}
**Note**: This happens when **more than 1** spoof check fails.
{% endhint %}

HTTP Status Code: `400`

<details>

<summary>Spoof Error 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": "Image submitted is Recaptured",
            "code": 10008,
            "operations": [
                "idVerification"
            ]
        },
        {
            "message": "Image submitted is either B&W or Photocopy",
            "code": 10007,
            "operations": [
                "idVerification"
            ]
        }
  ],
  "errors": [
        {
            "message": "Score is above the threshold",
            "code": 5012,
            "operations": [
                "idVerification"
            ]
        }
  ],
  "imageQualityResult": {
    ----[TRUNCATED]-----
  }
}
```

</details>
