For the complete documentation index, see llms.txt. This page is also available as Markdown.

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:

Traditional OCR Engine
MaiAgent Multimodal AI

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

  1. Left sidebar → AI FeaturesAI Assistants

  2. Click Create AI Assistant in the upper right corner

  3. Fill in basic settings:

Field
Value

Assistant Name

Document OCR Recognition Assistant

Large Language Model

Gemini 3.1 Flash-Lite (must support multimodal)

When selecting a large language model, make sure the model supports multimodal (image input), such as the Gemini series. If you select a text-only model, it will not be able to recognize image content.

Step 2: Set Response Mode and JSON Schema

Switch to the Response Mode Settings tab:

Field
Value

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:

JSON Schema output format settings

Step 3: Write Role Instructions

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

Role instructions settings

Click Save to complete the assistant setup.

Step 4: Test Recognition Results

  1. Enter the assistant's Test Conversation

  2. Upload a document image (can include both front and back)

  3. Enter "Please recognize this document image"

  4. 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:

JSON Output Field Descriptions

Field
Type
Source
Description

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

For complete example code, refer to Playma-Co-Ltd/maiagent-api-examples.

Last updated

Was this helpful?