Skip to content
Verity Teknologi
Panduan Published November 24, 2026

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

Alur integrasi API OCR KTP dengan contoh request dan respons JSON

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.

KTP OCR API integration flow: HTTPS request with the ID photo, JSON response with NIK and name plus confidence, then validation and storage
Illustrative KTP OCR API request and response with fictional data.

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

CriterionWhat to ask
AccuracyIs there a per-field confidence? Can we test with our own ID cards?
SpeedHow many seconds per document at peak volume?
SecurityWhere is data processed and how long is it kept?
DeploymentCloud, private cloud, or on-premise?
SupportIs there a sandbox, documentation, and a local technical team?
Checklist for evaluating KTP OCR API providers.

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.

Frequently asked questions

What is a KTP OCR API?

A KTP OCR API receives a photo of an Indonesian ID card over HTTPS and returns structured data such as NIK, name, date of birth, and address as JSON.

How long does a KTP OCR API call take?

It depends on the provider and image size. In the Verity live OCR demo, extracting one KTP takes about 3 seconds.

Does KTP OCR output need validation?

Yes. Check the NIK format, per-field confidence thresholds, and photocopy detection. Financial institutions should also verify with Dukcapil.

Can a KTP OCR API run on-premise?

Yes, if the provider offers it. Verity offers cloud, private cloud, and on-premise options for institutions that cannot send data outside.

How do I keep KTP data secure?

Keep the API key on the server, use HTTPS, encrypt data at rest, restrict access, and keep original images only as long as needed under the Personal Data Protection Law.

Ready to automate your document processing?

Book a short demo. We’ll show how Verity extracts data from your documents — on your real use case.