ID Card Recognition
Use multimodal AI to recognize ID cards and other document images, automatically outputting structured JSON data
When enterprises process identity verification, account opening, onboarding, and other workflows, they often need to manually enter names, ID numbers, addresses, and other information from documents one by one — a process that is both time-consuming and error-prone. With MaiAgent's multimodal AI assistant, users simply upload a document photo, and the system automatically recognizes and outputs structured JSON data that can be directly integrated with downstream business systems.
Compared to traditional OCR solutions, MaiAgent combines the multimodal capabilities of large language models with the following advantages:
Layout Adaptability
Requires designing a template for each document type
Automatically understands different document layouts
Front/Back Processing
Requires separate processing and manual matching
Can recognize both front and back from a single image
Field Expansion
Requires code modifications
Simply modify the JSON Schema
Deployment Cost
Self-hosted OCR service or purchased license
Platform configuration, no coding required
Error Handling
Returns raw text, requires post-processing
AI understands semantics and automatically corrects formatting
Use Cases
Banking Account Opening: Customer uploads ID card, automatically extracting name, ID number, and other information to fill in the account opening form
HR Onboarding Process: New employees upload documents, and the system automatically creates records
Medical Registration: Patients upload health insurance card or ID card, automatically filling in basic information
Government Agency Counter Service: Citizens present documents for instant recognition and auto-population of application forms
Solution Architecture
Setup Steps
Step 1: Create an AI Assistant
Left sidebar → AI Features → AI Assistants
Click Create AI Assistant in the upper right corner
Fill in basic settings:
Assistant Name
Document OCR Recognition Assistant
Large Language Model
Gemini 3.1 Flash-Lite (must support multimodal)

Step 2: Set Response Mode and JSON Schema
Switch to the Response Mode Settings tab:
Response Mode
RAG Q&A
Output Format
Output JSON Format
After selecting Output JSON Format, enter the following content in the JSON Schema field below:

Step 3: Write Role Instructions
In the Role Instructions section on the same tab, enter the following content:

Click Save to complete the assistant setup.
Step 4: Test Recognition Results
Enter the assistant's Test Conversation
Upload a document image (can include both front and back)
Enter "Please recognize this document image"
Verify the returned JSON structure and field content are correct

Usage Example
Upload an image containing both the front and back of an ID card, and the AI assistant will automatically recognize and output structured JSON:
Recognition accuracy depends on image quality. Ensure adequate lighting when taking photos, avoid glare, and lay the document flat for photography. If photographing both front and back simultaneously, arrange them side by side or stacked vertically.
JSON Output Field Descriptions
document_type
string
Front
Document type
name
string
Front
Document holder's name
gender
string
Front
Gender (Male/Female)
date_of_birth
string
Front
Date of birth (ROC calendar year)
military_service
string/null
Back
Military service status
place_of_birth
string/null
Back
Place of birth
id_number
string
Front
National ID number
expiry_or_issue_date
string/null
Front
Issue date
address
string/null
Back
Full address
API Integration
This assistant can be integrated with business systems via the MaiAgent API to automate the document recognition process.
Call Flow
Step 1: Upload Image to Get Attachment ID
Note the id, type, file, and filename fields from the response — they will be used in the next step.
Step 2: Call the Assistant for Recognition
Step 3: Parse the Response
The content field in the response contains the recognition result in JSON format:
Python
JavaScript
Last updated
Was this helpful?
