Key Extraction v3 · ตัวอย่าง
บัตรประชาชนไทย
สกัดข้อมูลจากรูปถ่ายหรือสแกนบัตรประชาชน สำหรับ KYC เปิดบัญชี หรือลงทะเบียน พร้อม bounding box ของแต่ละฟิลด์
API v3
อัปโหลดไฟล์แล้วสร้างงานที่
/api/v3/key-extractส่ง output.evidence: "bbox"data_schema
json
{"type": "object","additionalProperties": false,"properties": {"national_id": { "type": "string", "description": "เลขประจำตัวประชาชน 13 หลัก", "examples": ["1-1001-00123-45-6"] },"full_name_th": { "type": "string", "description": "ชื่อและนามสกุลภาษาไทย" },"full_name_en": { "type": "string", "description": "First and last name in English" },"date_of_birth": { "type": "string", "description": "วันเดือนปีเกิด (พ.ศ.)" },"expiry_date": { "type": "string", "description": "วันที่บัตรหมดอายุ" },"issue_date": { "type": "string", "description": "วันที่ออกบัตร" },"address": { "type": "string", "description": "ที่อยู่ตามทะเบียนบ้านบนบัตร" },"religion": { "type": "string", "description": "ศาสนาของผู้ถือบัตร" }},"required": ["national_id"]}
Request
FILE_ID=$(curl -sS -X POST 'https://backend.aksonocr.com/api/v3/key-extract/files' \-H 'X-API-Key: <YOUR_API_KEY>' \-F '[email protected]' | jq -r '.files[0].id')curl -sS -X POST 'https://backend.aksonocr.com/api/v3/key-extract/jobs' \-H 'X-API-Key: <YOUR_API_KEY>' \-H 'Content-Type: application/json' \-H 'Idempotency-Key: id-card-001' \-d "{\"inputs\": [{ \"file_id\": \"$FILE_ID\" }],\"data_schema\": {\"type\": \"object\",\"properties\": {\"national_id\": { \"type\": \"string\", \"description\": \"เลขประจำตัวประชาชน 13 หลัก\" },\"full_name_th\": { \"type\": \"string\" },\"full_name_en\": { \"type\": \"string\" },\"date_of_birth\": { \"type\": \"string\" },\"address\": { \"type\": \"string\" }}},\"instructions\": \"บัตรมีทั้งข้อความไทยและอังกฤษ ดึงทั้งสองภาษา เลขบัตรมี 13 หลัก อาจมีขีดคั่น\",\"output\": { \"evidence\": \"bbox\" }}"
ผลลัพธ์หลัง completed
json
{"data": {"national_id": "1-1001-00123-45-6","full_name_th": "นายสมชาย ใจดี","full_name_en": "Mr. Somchai Jaidee","date_of_birth": "1 มกราคม 2540","address": "45/12 ซ.ลาดพร้าว 80 แขวงวังทองหลาง กรุงเทพฯ 10310"},"field_metadata": {"/national_id": {"status": "verified","confidence": 0.99,"regions": [{ "page": 1, "bbox": [0.42, 0.18, 0.88, 0.24], "text": "1 1001 00123 45 6" }]}}}