API Reference

OCR v3 — Async

สร้างงานแล้วได้ jobId ทันที ประมวลผลพื้นหลัง สูงสุด 1,000 หน้า / ไฟล์ 10 MBaction เป็น transcribe หรือ extractor

ต้องการ bounding box?

extractor ของ OCR v3 ไม่คืนตำแหน่งบนเอกสาร ใช้ Key Extraction v3
MethodPathรายละเอียด
POST/api/v3/ocrสร้างงานจาก JSON (URL หรือ base64) · 202
POST/api/v3/ocr/uploadสร้างงานจากไฟล์ multipart · 202
GET/api/v3/ocr/:jobIdสถานะ
GET/api/v3/ocr/:jobId/resultผลเมื่อเสร็จ
POST/api/v3/ocr/:jobId/cancelยกเลิก
DELETE/api/v3/ocr/:jobIdลบงาน

สร้างงาน

POSThttps://backend.aksonocr.com/api/v3/ocr
json
{
"action": "transcribe",
"model": "AksonOCR-preview",
"document": {
"type": "document_url",
"document_url": "https://example.com/report.pdf"
},
"webhookUrl": "https://example.com/hooks/ocr"
}
ฟิลด์จำเป็นรายละเอียด
documentใช่type: image_url | document_url | base64
modelใช่AksonOCR-preview | handwriting | 1.0
actionไม่transcribe (ค่าเริ่มต้น) หรือ extractor
modeไม่normal เท่านั้นในตอนนี้
webhookUrlไม่HTTPS เมื่องานเข้าสู่สถานะปลายทาง
customFieldsextractorอาร์เรย์ { key, description, example }
templateIdextractorเทมเพลตจาก Dashboard

Response 202

json
{
"jobId": "ocr_01J...",
"status": "queued"
}

Poll และดึงผล

GEThttps://backend.aksonocr.com/api/v3/ocr/{jobId}

หยุดเมื่อสถานะเป็น completed, failed หรือ cancelled แล้วเรียก /result

bash
curl -sS 'https://backend.aksonocr.com/api/v3/ocr/$JOB_ID' \
-H 'X-API-Key: <YOUR_API_KEY>'
curl -sS 'https://backend.aksonocr.com/api/v3/ocr/$JOB_ID/result' \
-H 'X-API-Key: <YOUR_API_KEY>'

action: extractor

คืน pages[].structuredData ตาม customFields หรือ templateId ไม่มี bbox — ดู Key Extraction v3 ถ้าต้องการกรอบบนหน้า

json
{
"action": "extractor",
"model": "AksonOCR-preview",
"document": { "type": "image_url", "image_url": "https://example.com/invoice.jpg" },
"customFields": [
{ "key": "เลขที่ใบแจ้งหนี้", "description": "Invoice number" },
{ "key": "ยอดรวม", "description": "Grand total including VAT" }
]
}

อายุงาน

  • เก็บผล 72 ชั่วโมงหลังสร้าง
  • งานหมดอายุถูกลบทุกชั่วโมง
  • signed URL ของผลมีอายุ 1 ชั่วโมง และต่อเมื่อเรียก status/result

HTTP

HTTPความหมาย
202รับงานเข้าคิว
200อ่านสถานะ / ผล / ยกเลิก
402เครดิตไม่พอ
404ไม่พบงาน
429เกินลิมิต