Key Extraction v3 · ตัวอย่าง

ใบแจ้งหนี้ / ใบกำกับภาษี

ระบบบัญชีดึงข้อมูลใบแจ้งหนี้ PDF อัตโนมัติ — เลขที่เอกสาร ผู้ขาย รายการ และยอดรวม พร้อม bounding box สำหรับตรวจทานบนหน้าเอกสาร

ตารางใน schema

ใส่ line_items เป็น array ของ object ไม่ต้องมี listConfig

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: invoice-001' \
-d "{
\"inputs\": [{ \"file_id\": \"$FILE_ID\" }],
\"data_schema\": {
\"type\": \"object\",
\"additionalProperties\": false,
\"properties\": {
\"invoice_no\": { \"type\": \"string\", \"description\": \"เลขที่ใบแจ้งหนี้\" },
\"invoice_date\": { \"type\": \"string\", \"description\": \"วันที่ออกเอกสาร\" },
\"seller_name\": { \"type\": \"string\" },
\"tax_id\": { \"type\": \"string\" },
\"subtotal\": { \"type\": \"number\" },
\"vat\": { \"type\": \"number\" },
\"total\": { \"type\": \"number\" },
\"line_items\": {
\"type\": \"array\",
\"items\": {
\"type\": \"object\",
\"properties\": {
\"description\": { \"type\": \"string\" },
\"quantity\": { \"type\": \"number\" },
\"amount\": { \"type\": \"number\" }
}
}
}
},
\"required\": [\"invoice_no\", \"total\"]
},
\"output\": { \"evidence\": \"bbox\" }
}"

data + field_metadata

json
{
"data": {
"invoice_no": "INV-2026-0142",
"invoice_date": "6 ก.ย. 2569",
"seller_name": "บริษัท ตัวอย่าง จำกัด",
"tax_id": "0105551234567",
"subtotal": 10000,
"vat": 700,
"total": 10700,
"line_items": [{ "description": "บริการ OCR", "quantity": 1, "amount": 10000 }]
},
"field_metadata": {
"/invoice_no": {
"status": "verified",
"confidence": 0.98,
"regions": [{ "page": 1, "bbox": [0.684, 0.072, 0.912, 0.104], "text": "INV-2026-0142" }]
},
"/line_items/0/amount": {
"status": "verified",
"confidence": 0.94,
"regions": [{ "page": 1, "bbox": [0.811, 0.424, 0.928, 0.452], "text": "10,000.00" }]
}
}
}