> For the complete documentation index, see [llms.txt](https://cartoonmango-1.gitbook.io/vida-ekyc-integration/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cartoonmango-1.gitbook.io/vida-ekyc-integration/integration-methods/api/ocr/api-reference/ktp-ocr-api-sync.md).

# KTP OCR API - Sync

This API extracts information from the user’s KTP card image using OCR and  returns the extracted data in response.

## API  Description

## KTP OCR Sync Call

<mark style="color:green;">`POST`</mark> `https://services.vida.id/verify/v1/ktp/ocr/transaction`

#### Headers

| Name                                            | Type             | Description                                                                                                                                                                     |
| ----------------------------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> |                  | <p>OAuth access token. </p><p>Get the token by calling the</p><p><a href="broken://pages/GjuJMI0UxvVP7R0D3UYx#authentication-api"><strong>Get Access Token</strong></a> API</p> |
| Content-Type<mark style="color:red;">\*</mark>  | application/json | Format type of request body                                                                                                                                                     |

#### Request Body

| Name                                         | Type   | Description                                                  |
| -------------------------------------------- | ------ | ------------------------------------------------------------ |
| ktp\_image<mark style="color:red;">\*</mark> | String | <p>Data URI scheme, Base64 encoded KTP image.</p><p><br></p> |

{% tabs %}
{% tab title="200: OK KTP OCR API request successful." %}

```javascript
{
    "data": {
        "transaction_id": "faa24b24-0e1f-4ae0-9ca4-891c8a919d42"
    }
}
```

{% endtab %}
{% endtabs %}

### Get Transaction Status

To retrieve the details of an OCR API request, you can use the following API provided by the VIDA Identity API. The VIDA Identity API follows an asynchronous model, where you can obtain the transaction status and details through a separate API call after the request has been processed by the verifiers or processors within the VIDA system.

## Get Transaction Status

<mark style="color:green;">`POST`</mark> `https://services.vida.id/verify/v1/transaction/{transaction_id}`

#### Path Parameters

| Name                                              | Type   | Description                                         |
| ------------------------------------------------- | ------ | --------------------------------------------------- |
| transaction\_id<mark style="color:red;">\*</mark> | String | Transaction ID that is produced on KTP OCR request. |

#### Headers

| Name                                            | Type             | Description                                                                                                                                                                     |
| ----------------------------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> |                  | <p>OAuth access token. </p><p>Get the token by calling the</p><p><a href="broken://pages/GjuJMI0UxvVP7R0D3UYx#authentication-api"><strong>Get Access Token</strong></a> API</p> |
| Content-Type<mark style="color:red;">\*</mark>  | application/json | Format type of request body                                                                                                                                                     |

{% tabs %}
{% tab title="200: OK KTP OCR extraction request successful. " %}

```javascript
{
	"data": {
		"result": {
			"provinsi": "JAWA BARAT",
			"kabupaten_kota": "KOTA BANDUNG",
			"golongan_darah": "",
			"agama": "ISLAM",
			"alamat": "SARIMANIS 13 TOWN HOUSE B3",
			"berlaku_hingga": "SEUMUR HIDUP",
			"kewarganegaraan": "WNI",
			"nik": "1234567890123456",
			"nama": "TEST NAME",
			"pekerjaan": "KARYAWAN SWASTA",
			"tempat_lahir": "BUKIT TINGGI",
			"kecamatan": "SUKASARI",
			"jenis_kelamin": "",
			"rt_rw": "002/006",
			"tanggal_lahir": "01-01-2001",
			"status_perkawinan": "KAWIN",
			"kelurahan_desa": "SARIJADI"

		},
		"status": "success",
		"transaction_id": "1fa03f48-12db-4abc-9c4b-c25bb7d98eab"
	}
}
```

{% endtab %}

{% tab title="400: Bad Request Invalid image extension type | Recommendation: ensure to give KTP image file extension JPEG/JPG." %}

```json
{
	"errors": [{
		"code": 2006,
		"title": "Unsupported media type",
		"detail": "Unsupported media or image type"
	}]
}
```

{% endtab %}

{% tab title="400: Bad Request Description: Invalid image format due to some reasons:  The KTP object resolution is less than 300x400 pixels The KTP object resolution is greater than 3000x4000 pixels No text in the KTP image  Recommendation: ensure to give KTP image input as the specific recommendation" %}

```json
{
	"errors": [{
		"code": 2000,
		"title": "Bad Request",
		"detail": "Invalid image format"
	}]
}
```

{% endtab %}

{% tab title="400: Bad Request Description: The image file size is greater than 2 MB.  Recommendation: ensure to give image file size less than 2 MB" %}

```json
{
    "errors": [
        {
            "code": 2000,
            "title": "Bad Request",
            "detail": "Please recheck your image file size"
        }
    ]
}

```

{% endtab %}
{% endtabs %}
