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

# OCR (KTP)

The VIDA OCR API allows you to extract information from a user's KTP (Kartu Tanda Penduduk) card image using OCR (Optical Character Recognition) technology. This process involves analyzing the image and identifying the relevant text and data present on the KTP card.

When you submit a request to the OCR API, the system starts processing the image to extract information such as the person's name, address, date of birth, gender, marital status, nationality, identification number, occupation, and other details printed on the KTP card.

## KTP Card  Data

#### &#x20;Sample KTP Card

<figure><img src="https://lh5.googleusercontent.com/bhwPnHvWIgkFV6hUws_mRUDasBonfdbgzxapeuxZT6xsZ2NqXsHqBJLG-9UlcLXKhP9BZ8nOx06GSWDni4-AjGgxcHuJrnvhJiCv1zpDGE17zsggapoOp6A5voAX7wzq2idLInwyQNgPSSDVDWkPSA" alt=""><figcaption></figcaption></figure>

This is a sample KTP card with dummy data for demonstration purposes. However, during the process, it is imperative that our partner sends us a real KTP card.

#### KTP Data as JSON Response&#x20;

<details>

<summary>Sample Response</summary>

```json
{
    "data": {
        "result": {
             "provinsi": "JAWA BARAT",
             "kabupaten_kota": "KOTA BANDUNG",
             "golongan_darah": "",
             "agama": "ISLAM",
             "alamat": "SARIMANIS 00 TOWN HOUSE B3",
             "berlaku_hingga": "SEUMUR HIDUP",
             "kewarganegaraan": "WNI",
             "nik": "3175070000000001",
             "nama": "JOHN DOE",
             "pekerjaan": "KARYAWAN SWASTA",
             "tempat_lahir": "BANDUNG,01-01-1980",
             "kecamatan": "MAKASAR",
             "jenis_kelamin": "LAKI-LAKI GOL DARAH:A",
             "rt_rw": "006/001",
             "tanggal_lahir": "06-01-2016",
             "status_perkawinan": "KAWIN",
             "kelurahan_desa": "MAKASAR"
        },
        "status": "success",
        "transaction_id": "1fa03f48-12db-4abc-9c4b-c25bb7d98eab"
    }
}
```

</details>

{% hint style="info" %}
To ensure accurate OCR extraction from KTP card images, please refer to the guidelines provided in the [Key Image Quality Recommendations](/identity-stack/product/product-overview.md) section.
{% endhint %}

### Error Handling

The error response will consist of:&#x20;

* code: represent the unique of the error code
* title: the response information
* detail: the description of the error

Incase of errors the API would return HTTPStatus with the following response body

<details>

<summary>Sample Error Response</summary>

```json
{
  "errors": [
    {
      "code": 0,
      "detail": "string",
      "title": "string"
    }
  ]
}
```

</details>
