KTP OCR API: A 5-Step Integration Guide (Sample Request & Response)
A developer guide to integrating a KTP OCR API: credentials, sending images, reading the JSON response, NIK validation, and data security, with examples and a vendor checklist.
by Verity Teknologi
A KTP OCR API accepts a photo of an Indonesian ID card in a single HTTPS request and returns structured JSON: NIK, name, place and date of birth, address, and marital status. Integration usually takes five steps: get credentials, send the image, read the response, validate the result, and store it in your system.
When does a company need a KTP OCR API?
A KTP OCR API is used when ID data must flow into a system automatically, without staff retyping it. Common cases:
Digital customer onboarding at banks, fintechs, and multifinance companies.
Credit or financing applications that need the applicant's identity data.
Customer registration in insurance, telecoms, and marketplaces.
Digitising old files that contain photocopied ID cards.
If you are new to KTP OCR, start with our guide on how KTP OCR works in 5 steps.
Step 1: Get credentials and a test environment
Providers usually issue an API key and two environments: a sandbox for testing and production for real traffic. Keep the API key on the server side, never inside a mobile app or browser JavaScript.
Step 2: Send the KTP image
Send the image over HTTPS, either as a file (multipart) or as base64 text. Practices that improve accuracy:
Compress images, but not to the point that text blurs.
Make sure all four corners are visible and there is no glare on the laminate.
Accept common formats such as JPG, PNG, or PDF.
Step 3: Read the JSON response
A good response contains not only text but also a confidence score per field. The score decides which documents can be processed straight away and which need a human check. In our live OCR demo, extracting one KTP takes about 3 seconds.
Step 4: Validate before storing
Do not store OCR output blindly. Add these automatic checks:
NIK format: 16 digits, with a consistent region code and birth date. See automatic KTP NIK validation.
Confidence threshold: fields below it go to a manual review queue.
Photocopy or screen-photo detection to prevent misuse.
Dukcapil verification where your process requires it, for example in financial onboarding.
Step 5: Store and protect the data
KTP data is personal data protected by Law No. 27 of 2022 on Personal Data Protection. Encrypt it in transit and at rest, restrict access, and keep the original image only as long as needed. Banks that cannot send data outside should choose a provider with private-cloud or on-premise options.
Checklist for choosing a KTP OCR API provider
| Criterion | What to ask |
|---|---|
| Accuracy | Is there a per-field confidence? Can we test with our own ID cards? |
| Speed | How many seconds per document at peak volume? |
| Security | Where is data processed and how long is it kept? |
| Deployment | Cloud, private cloud, or on-premise? |
| Support | Is there a sandbox, documentation, and a local technical team? |
Compare vendors in our list of OCR providers in Indonesia, or explore Verity Indonesian ID OCR, available as an API, cloud, or on-premise. The fastest way to judge quality is to try the free OCR demo.