๐Ÿ†”
MyKAD OCR API
by Devigner Network
Status: Operational

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
https://id.devignernetwork.cloud/
Method
POST (multipart/form-data)
Auth
X-API-Key header
CORS
Enabled (POST, OPTIONS)
Response
JSON 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-Key or Authorization: Bearer token
  • CORS: Enabled for POST and OPTIONS methods
  • 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"
const formData = new FormData();
formData.append("image", fileInput.files[0]);

const response = await fetch("https://id.devignernetwork.cloud/api.php", {
  method: "POST",
  headers: {
    "X-API-Key": "690bbfb0-b8f4-8323-a67e-d3f4d4a40d37"
  },
  body: formData
});

const data = await response.json();
console.log(data);
import requests

url = "https://id.devignernetwork.cloud/api.php"
headers = {"X-API-Key": "690bbfb0-b8f4-8323-a67e-d3f4d4a40d37"}
files = {"image": open("/path/to/your-id.jpg", "rb")}

response = requests.post(url, headers=headers, files=files)
print(response.status_code)
print(response.json())
$ch = curl_init();

curl_setopt_array($ch, [
    CURLOPT_URL => "https://id.devignernetwork.cloud/api.php",
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "X-API-Key: 690bbfb0-b8f4-8323-a67e-d3f4d4a40d37"
    ],
    CURLOPT_POSTFIELDS => [
        "image" => new CURLFile("/path/to/your-id.jpg")
    ]
]);

$response = curl_exec($ch);
$data = json_decode($response, true);
print_r($data);

๐Ÿงช 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 district field extraction after postcode
  • Implemented automatic image compression
  • Added interactive browser demo
  • Published OpenAPI 3.0 specification