API Reference · Key Extraction v3
Templates
เทมเพลตเป็นเวอร์ชัน immutable งานจะ snapshot schema, instructions และ review_threshold ตอนรับคำขอ เพื่อให้ผลย้อนหลังทำซ้ำได้เมื่อเทมเพลตถูกแก้
Create template (version 1)
POST
https://backend.aksonocr.com/api/v3/key-extract/templates| ฟิลด์ | ชนิด | จำเป็น | รายละเอียด |
|---|---|---|---|
name | string | ใช่ | 1–200 ตัวอักษร |
data_schema | object | ใช่ | JSON Schema subset เดียวกับงาน |
description | string | ไม่ | ≤ 2,000 |
instructions | string | ไม่ | ≤ 10,000 |
review_threshold | number | ไม่ | 0–1 |
json
{"name": "Thai Invoice","description": "Thai tax invoice","data_schema": {"type": "object","additionalProperties": false,"properties": {"invoice_no": { "type": "string" },"line_items": {"type": "array","items": {"type": "object","additionalProperties": false,"properties": {"description": { "type": "string" },"amount": { "type": "number" }}}}}},"instructions": "Use the net total after VAT.","review_threshold": 0.8}
สำเร็จได้ 201 คืน id และ version: 1
Create next version
POST
https://backend.aksonocr.com/api/v3/key-extract/templates/{template_id}/versionsBody ชุดเดียวกับตอนสร้าง 201 เวอร์ชันใหม่ งานเก่ายังผูกเวอร์ชันเดิม ห้าม override schema ตอนสร้างงาน — สร้างเวอร์ชันใหม่หรือส่ง data_schema ทั้งก้อน
Get template
GET
https://backend.aksonocr.com/api/v3/key-extract/templates/{template_id}| Query | รายละเอียด |
|---|---|
version | ถ้าไม่ระบุ คืนเวอร์ชันล่าสุด |
List templates
GET
https://backend.aksonocr.com/api/v3/key-extract/templatesCursor pagination เหมือน jobs: cursor, limit (1–100)
json
{"data": [{"id": "tpl_invoice_th","version": 7,"name": "Thai Invoice","status": "active","schema_sha256": "5d3a...","created_at": "2026-09-03T10:00:00Z"}],"has_more": false,"next_cursor": null,"request_id": "req_01J..."}
Archive template
DELETE
https://backend.aksonocr.com/api/v3/key-extract/templates/{template_id}204 งานใหม่ห้ามอ้างแบบไม่ปัก version งานเก่าไม่เปลี่ยน
ขอบเขตเทมเพลตเป็นต่อ tenant/project ทุก query กรองก่อนดู id