Indonesia KTP OCR with Node.js SDK
Add Kartu Tanda Penduduk (KTP) data extraction to a Node.js backend using the official SDK and an Express route.

Working with the Kartu Tanda Penduduk (KTP)
The Kartu Tanda Penduduk (KTP) places the holder's identity number and biographical details in a country-specific layout. Re-keying those values is slow, while generic OCR still leaves a backend team to identify each text fragment and map it to a database field.
Structured Extraction for Node.js Backends
StructOCR accepts a Base64-encoded image or PDF and returns normalized national ID fields. For a readable Kartu Tanda Penduduk (KTP), the response can include the NIK, name, dates, issuing information and address when those values appear on the submitted document.
Common Integration Scenarios
- Customer onboarding: Pre-fill visible identity fields from a Kartu Tanda Penduduk (KTP) before user confirmation.
- Account operations: Reduce manual transcription when staff enter identity data into an internal workflow.
- Document review: Store normalized API output alongside the original review decision in your own system.
Live Demo: ID card scanner
No registration required. Upload a file to test the extraction.
Drop files here or click to browse
JPG · PNG · WebP · up to 500 files · max 4.5 MB each
Indonesia National ID OCR with Node.js
The official Node.js SDK reads a supported local file and calls /v1/national-id. Open the TypeScript + Express tab for a server route using the same SDK method.
Prerequisite: `npm install structocr`; set the server-side `STRUCTOCR_API_KEY` environment variable.
Prefer another stack? Open the Python SDK + FastAPI integration.
const StructOCR = require("structocr");
const client = new StructOCR(process.env.STRUCTOCR_API_KEY);
async function main() {
const result = await client.scanNationalId("id-card.jpg");
if (result.success) {
const data = result.data;
console.log(data.document_number);
console.log(data.given_names, data.surname);
} else {
console.error(result.error);
}
}
main().catch(console.error);Technical Specs
- •Endpoint: POST /v1/national-id
- •Input: Base64-encoded JPG, PNG, WebP, or PDF in JSON (Max 4.5MB)
- •Authentication: Server-side x-api-key header handled by the SDK
- •Cost: 2 credits per scan
- •Output: Structured JSON
Key Features
- •Local terminology: Handles the Kartu Tanda Penduduk (KTP) as a national identity document.
- •Identifier output: Returns the NIK in supported identifier fields when visible.
- •Normalized names and dates: Maps readable identity data to consistent JSON keys.
- •Server integration: Keeps the API key inside the Node.js backend.
JSON Response Example
This example shows the normalized response shape for a readable Kartu Tanda Penduduk (KTP); unavailable fields can be null.
{
"success": true,
"data": {
"type": "national_id",
"country_code": "IDN",
"document_number": "3174010101900001",
"personal_number": "3174010101900001",
"card_series": null,
"surname": "DOE",
"given_names": "ALEX",
"sex": null,
"date_of_birth": "1990-01-01",
"place_of_birth": null,
"date_of_issue": null,
"date_of_expiry": null,
"issuing_authority": null,
"address": "JAKARTA",
"additional_fields": {}
}
}Frequently Asked Questions
Does the API validate a NIK?
The OCR endpoint extracts visible document data. Treat the result as extracted data for your own review and validation workflow; this page does not claim government-database or authenticity verification.
Which input types are supported?
The REST endpoint accepts JSON containing a Base64-encoded JPG, PNG, WebP or PDF up to 4.5MB. The SDK handles local file encoding before it sends the request.
You May Also Like
Related tutorials, platform guides, and comparisons
UAE Emirates ID OCR with Node.js SDK
Extract Emirates ID number, names, dates and other visible fields from Emirates ID with the StructOCR Node.js SDK and Express.
Nigeria National ID OCR with Node.js SDK
Extract National Identification Number (NIN), names, dates and other visible fields from National Identity Card with the StructOCR Node.js SDK and Express.
Malaysia MyKad OCR with Node.js SDK
Extract identity number, names, dates and other visible fields from MyKad with the StructOCR Node.js SDK and Express.
Philippines PhilID OCR with Node.js SDK
Extract PhilSys Card Number, names, dates and other visible fields from Philippine Identification Card (PhilID) with the StructOCR Node.js SDK and Express.
Node.js National ID OCR API
Achieve >99% accuracy with our Node.js SDK for National ID OCR. Upload an image for a free test! Get clean, validated JSON output from any ID card image. Integrate KYC in minutes.
South Africa Smart ID OCR with Node.js SDK
Extract identity number, names, dates and other visible fields from South African Smart ID card with the StructOCR Node.js SDK and Express.
India Aadhaar OCR with Node.js SDK
Extract Aadhaar number, names, dates and other visible fields from Aadhaar card with the StructOCR Node.js SDK and Express.
Java National ID Parser API
Upload an image for a free test! Eliminate manual data entry for national IDs. Our Java ID card parsing API provides AES-256 encrypted JSON output in <4s average latency, ensuring SOC2 compliant verification.
C# National ID OCR API
Upload an image for a free test! Eliminate manual data entry for national IDs. Integrate hybrid VIZ + MRZ validation into your .NET apps. This C# OCR API delivers structured JSON in <5s average latency, backed by 98.5% uptime SLA and AES-256 encryption.
Go National ID OCR API
Upload an image for a free test! High-accuracy National ID data extraction for Go developers. Get structured JSON output via a simple API call, replacing unreliable open-source tools.
Technical Comparisons & Integrations
Explore platform integrations and competitive analysis
Add National ID OCR to Your Bolt.new App in 5 Minutes
Step-by-step guide to integrating the StructOCR National ID scanner API into a Bolt.new app. Build KYC and identity verification flows right in your browser.
Add National ID OCR using Cursor in 5 Minutes
Step-by-step guide to integrating the StructOCR National ID scanner API using the Cursor AI code editor. Build KYC and identity verification flows rapidly.
Add National ID OCR to Your Lovable.dev App in 5 Minutes
Step-by-step guide to integrating the StructOCR National ID scanner API into a Lovable.dev app. Build KYC and identity verification flows with zero backend.
Add National ID OCR to Your Replit App in 5 Minutes
Step-by-step guide to integrating the StructOCR National ID scanner API into a Replit application. Build KYC and identity verification flows using Replit Agent and Secrets.
Add National ID OCR to Your v0 App in 5 Minutes
Step-by-step guide to integrating the StructOCR National ID scanner API into a v0 by Vercel app. Build KYC and identity verification flows with zero backend.
Add Passport OCR to Your v0 App in 5 Minutes
Step-by-step guide to integrating the StructOCR Passport scanner API into a v0 by Vercel app through a secure Next.js server route.
From tutorial to production in 5 minutes.
You've seen the code. Now get your API key, grab your 200 free credits, and see it work with your own images. No credit card required.