MyKAD OCR API
Upload a MyKAD image and receive structured JSON with 10 extracted fields including IC number, name, address, and more.
Accurate Extraction
Advanced OCR technology ensures high accuracy for all fields
Fast Processing
Typical responses in seconds with automatic image optimization
Simple Integration
RESTful API with straightforward JSON-only responses
Extracted Fields
- IC Number โ Malaysian identification number
- Full Name โ Complete name as shown on ID
- Address โ Two-line address extraction
- Location โ Postcode, district, and state
- Personal Info โ Nationality, religion, gender
Quick Facts
Base URL
Method
CORS
https://id.devignernetwork.cloud/POST (multipart/form-data)
AuthX-API-Key headerEnabled (POST, OPTIONS)
ResponseJSON only
๐ Endpoint & Authentication
API Endpoint
POST
https://id.devignernetwork.cloud/api.php
Authentication
Include your API key using either of these header formats:
X-API-Key: 690bbfb0-b8f4-8323-a67e-d3f4d4a40d37
# or
Authorization: Bearer 690bbfb0-b8f4-8323-a67e-d3f4d4a40d37
๐ก Note: All requests must include a valid API key. Requests without authentication will receive a 401 error.
๐ค Request Format
Multipart Form Data
| Field | Type | Required | Description |
|---|---|---|---|
image |
File | โ Yes | Image file (JPEG, PNG, WEBP, GIF) |
prompt |
String | โ No | Custom instruction (uses default if omitted) |
Automatic Image Optimization
The API automatically compresses large images while preserving OCR accuracy:
- Target size: ~2.5 MB maximum
- Max dimensions: 2600px on longest side
- Format: Smart WEBP/JPEG quality adjustment
๐ก Tip: For best results, use clear, well-lit, high-resolution images with minimal glare or shadows.
๐ฅ Response Schema
The API returns a JSON object with exactly 10 string fields. Unknown values return as empty strings "".
Response Object
{
"ic_number": "",
"full_name": "",
"address_line_1": "",
"address_line_2": "",
"postcode": "",
"district": "",
"state": "",
"nationality": "",
"religion": "",
"gender": ""
}
Field Descriptions
| Field | Description |
|---|---|
ic_number |
Malaysian IC number (format: YYMMDD-PB-###G) |
full_name |
Complete name as appears on MyKAD |
address_line_1 |
First line of address |
address_line_2 |
Second line of address |
postcode |
Malaysian postal code |
district |
Value immediately following postcode |
state |
Malaysian state |
nationality |
Nationality (typically "MALAYSIAN") |
religion |
Religion as stated on MyKAD |
gender |
Gender (MALE/FEMALE) |
Example Response (200 OK)
{
"ic_number": "900101-14-5678",
"full_name": "ABDULLAH BIN AZIZ",
"address_line_1": "NO 12 JALAN MERANTI",
"address_line_2": "TAMAN BANDAR BARU",
"postcode": "43000",
"district": "KAJANG",
"state": "SELANGOR",
"nationality": "MALAYSIAN",
"religion": "ISLAM",
"gender": "MALE"
}
โ ๏ธ Error Handling
Errors return JSON with an error field describing the issue.
HTTP Status Codes
| Code | Meaning | Description |
|---|---|---|
| 400 | Bad Request | Invalid request (missing file, wrong type, etc.) |
| 401 | Unauthorized | Missing or invalid API key |
| 405 | Method Not Allowed | Use POST method only |
| 500 | Internal Server Error | Server misconfiguration |
| 502 | Bad Gateway | Upstream error or timeout |
Error Response Example
{
"error": "Unauthorized: missing or invalid API key."
}
โก Limits & Performance
Image Limits
- Max file size: ~2.5 MB (after compression)
- Max dimensions: 2600px longest side
- Supported formats: JPEG, PNG, WEBP, GIF
Performance
- Response time: Typically 2-5 seconds
- Recommended format: JPEG or WEBP
- Best practice: Pre-resize to ~3000px max
๐ก Bulk Processing: For high-volume ingestion, stagger requests and consider client-side downscaling to optimize throughput.
๐ Security
- Authentication: All requests require a valid
X-API-KeyorAuthorization: Bearertoken - CORS: Enabled for
POSTandOPTIONSmethods - Data handling: Images processed in-memory with automatic high-quality compression
- Response format: JSON only, no HTML or other formats
- Transport: HTTPS required for all requests
๐ Quickstart Examples
curl -X POST "https://id.devignernetwork.cloud/api.php" \
-H "X-API-Key: 690bbfb0-b8f4-8323-a67e-d3f4d4a40d37" \
-F "image=@/path/to/your-id.jpg"
๐งช Try It Live
Interactive browser demo using the production API endpoint.
Upload Image
Click to choose or drag & drop
JPG, PNG, WEBP, or GIF
API Response
{}
๐ OpenAPI Specification
openapi: 3.0.3
info:
title: MyKAD OCR API
version: "1.0.0"
description: Upload Malaysian ID card images and receive structured JSON data
contact:
name: Devigner Network
servers:
- url: https://id.devignernetwork.cloud/
paths:
/api.php:
post:
summary: Upload an ID image and receive structured JSON
operationId: ocrUpload
security:
- ApiKeyAuth: []
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
properties:
image:
type: string
format: binary
description: Image file (JPG, PNG, WEBP, GIF)
prompt:
type: string
description: Optional custom instruction
required: [image]
responses:
"200":
description: OCR result
content:
application/json:
schema:
type: object
properties:
ic_number: { type: string }
full_name: { type: string }
address_line_1: { type: string }
address_line_2: { type: string }
postcode: { type: string }
district: { type: string }
state: { type: string }
nationality: { type: string }
religion: { type: string }
gender: { type: string }
"4XX":
description: Client error
content:
application/json:
schema:
type: object
properties:
error: { type: string }
"5XX":
description: Server/Upstream error
content:
application/json:
schema:
type: object
properties:
error: { type: string }
components:
securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: X-API-Key
๐ Changelog
Version 1.0.0
Released: November 2025
- Initial public release
- JSON schema finalized with 10 extracted fields
- Added
districtfield extraction afterpostcode - Implemented automatic image compression
- Added interactive browser demo
- Published OpenAPI 3.0 specification