API Reference · Key Extraction v3
Schemas
ตรวจและ normalize JSON Schema ก่อนสร้างงาน ไม่เรียก OCR และไม่คิดเครดิต schema ที่ใช้ดึงข้อมูลเป็น subset เข้ม ไม่ใช่ JSON Schema เต็มรูป
Validate schema
POST
https://backend.aksonocr.com/api/v3/key-extract/schemas/validate| ฟิลด์ | ชนิด | จำเป็น | รายละเอียด |
|---|---|---|---|
data_schema | object | ใช่ | รากต้องเป็น type: object + properties |
json
{"data_schema": {"type": "object","properties": {"invoice_no": { "type": "string", "description": "เลขที่ใบแจ้งหนี้" }}}}
Response 200
json
{"valid": true,"normalized_schema": {"type": "object","additionalProperties": false,"properties": {"invoice_no": { "type": ["string", "null"] }}},"stats": { "leaf_fields": 1, "arrays": 0, "max_depth": 1 },"warnings": [],"request_id": "req_01J..."}
สเกลาร์ถูกทำให้ nullable ภายใน เซิร์ฟเวอร์ไม่ใส่ค่า default เมื่อแหล่งไม่มีข้อมูล
สิ่งที่รองรับ
| ฟีเจอร์ | รองรับ |
|---|---|
| ราก | type: object เท่านั้น |
| สเกลาร์ | string, number, integer, boolean |
| object ซ้อน | ได้ ความลึกสูงสุด 5 |
| ตาราง | array ของ object หรือสเกลาร์ สูงสุด 10 ตาราง, 50 คอลัมน์, 2,000 แถว |
| คำใบ้ | description, examples, enum (≤ 100), format, required |
| format ของ string | date, date-time, time, email, uri |
| ขนาด schema | ≤ 128 KiB, leaf ≤ 200 |
ไม่รองรับ:
$ref, oneOf / anyOf / allOf, recursion, nested arrays คำตอบ 422 จะชี้ pointer ไปยัง construct ที่ไม่ผ่านErrors
| HTTP | code |
|---|---|
| 422 | invalid_schema |
json
{"type": "https://docs.aksonocr.com/problems/invalid-schema","title": "Schema is invalid","status": 422,"code": "invalid_schema","detail": "The schema contains unsupported constructs.","retryable": false,"errors": [{"pointer": "/data_schema/properties/items/items","code": "nested_array_not_supported","detail": "Nested arrays are not supported."}],"request_id": "req_01J..."}