---
title: "Extract KTP (Synchronous)"
method: POST
path: "/v2/ktp/extract"
tags: ["KTP - Synchronous"]
---

# Extract KTP (Synchronous)

`POST /v2/ktp/extract`

Synchronous KTP method helps you to recognize text in KTP image and the extraction result will be processed and returned immediately.

The detection of KTP quality is always checked in this Extract KTP Synchronous, but you can set whether you want to validate your KTP quality photo by using validate_quality request.

You will receive a response consists of message and an error code if the request fails to process. The following is a list of error codes.
<br>

| Error status                                  | Error code                    | Description                                  |
| ------------------------------|----------------------------------------------|----------------------------------------------|
| 400 | INVALID_PAYLOAD                | No value in payload or empty string more than 1  |
| 400 | INVALID_PAYLOAD_IMAGE_MISSING  | Image empty string |
| 400 | INVALID_PAYLOAD_IMAGE_SIZE    | Image size too big/too small |
| 400 | INVALID_PAYLOAD_IMAGE_FORMAT           | Image unable to be decoded/got from url OR invalid image extension|
| 400 | MISSING_PAYLOAD_IMAGE         |  Missing payload image                       |
| 400 | KTP_NOT_DETECTED | KTP not detected from image |
| 400 | INVALID_PAYLOAD_REFERENCE_ID | reference_id is too short/too long |
| 400 | INVALID_PAYLOAD_REFERENCE_ID_EXISTS | reference_id already exists (not unique) |
| 400 | INVALID_PAYLOAD_QUALITY_VALIDATION_DEPENDENCY | is_quality must be true if validate_quality true|
| 403 | INSUFFICIENT_QUOTA    | Quota for extract/quality is not sufficient to further continue the request (Only appears on testing mode) |
| 500 | INTERNAL_SERVER_ERROR         | Internal server error |

## Headers

- `App-ID` string, required
- `API-Key` string, required

## Request body

- ExtractKTPSync
  - `image` string, required — A base64 image file
  - `validate_quality` boolean — A flag to determine whether quality validation will be executed. The validation consists of checking blur and dark with threshold.

## Response `200`

Successful Response

- ResponseExtractKTPSync
  - `Message` string — Message indicating the status of the request to be processed
  - `error_code` string — This error_code indicates an error that appeared in processing the request from the extract-async method
  - `data` object — Show the recognition result
    - `address` string — Shows address from KTP
    - `administrative_village` string — Shows administrative village from KTP
    - `blood_type` string — Shows blood type from KTP
    - `city` string — Shows city from KTP
    - `date_of_birth` string — Shows date of birth from KTP
    - `district` string — Shows district from KTP
    - `full_name` string — Shows full name from KTP
    - `gender` string — Shows gender from KTP
    - `marital_status` string — Shows marital status from KTP
    - `nationality` string — Shows nationality from KTP
    - `nik` string — Shows NIK from KTP
    - `occupation` string — Shows occupation from KTP
    - `place_of_birth` string — Shows place of birth from KTP
    - `religion` string — Shows religion from KTP
    - `rt_rw` string — Shows RT/ RW from KTP
    - `state` string — Shows state from KTP
    - `image_quality` object — Shows quality of image
      - `blur` boolean
      - `dark` boolean
      - `flashlight` boolean
      - `grayscale` boolean

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `500` — Internal Server Error

---

[API](https://skmtc.dev/verihubs/apis/sms-api-documentation.md) · [All operations](https://skmtc.dev/verihubs/apis/sms-api-documentation/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/verihubs/sms-api-documentation/revisions/5fa885d38adc/schema)
