API OCR มิเตอร์น้ำ
API OCR มิเตอร์น้ำ. หน้านี้บันทึก HTTP API สาธารณะที่เปิดเผยโดยแบ็กเอนด์ของเว็บไซต์สำหรับการผสานรวมของบุคคลที่สาม
เริ่มจากการอัปโหลดจริง
สมัครก่อน อัปโหลดรูปมาตรวัดน้ำของคุณใน workspace แล้วสร้าง API key เมื่อพร้อมเชื่อมต่อระบบ
ภาพรวม
- ใช้แบ็กเอนด์ของเว็บไซต์สำหรับการบูรณาการภายนอกทั้งหมด
- อย่าเรียก waterMeterAi โดยตรงจากโปรแกรมบุคคลที่สาม
- open API แบ่งปันผู้ใช้ โควต้า แคช งาน และกฎการตรวจสอบเดียวกันกับเว็บพอร์ทัล
- แบ็กเอนด์สามารถกำหนดเป้าหมายธุรกิจดาวน์สตรีม AI ที่แตกต่างกันได้โดยการกำหนดค่าการปรับใช้
- ขณะนี้การตอบกลับงานมีออบเจ็กต์ result_summary ทั่วไป ดังนั้นธุรกิจต่างๆ จึงสามารถแสดงผลลัพธ์ประเภทต่างๆ ได้
การรับรองความถูกต้อง
- ลงชื่อเข้าใช้บนเว็บไซต์และสร้างคีย์ API บนหน้า API Keys
- คีย์ API แบบเต็มจะแสดงเพียงครั้งเดียวเมื่อมีการสร้างขึ้น
- ส่งรหัสในส่วนหัวการอนุญาตในทุกคำขอ
Authorization: Bearer wm_xxxxxxxxxxxxxxxxx
API Key Permissions and Limits
- Each API key can have independent scopes, an IPv4/IPv6/CIDR allowlist, a total requests-per-minute limit, and a task submissions-per-minute limit.
- A valid key without the required scope or outside its source IP allowlist returns 403.
- Every valid-key request consumes the total request limit, including requests rejected by scope, IP, or submission policy.
- Batch requests consume one total request unit and one submission unit per uploaded file.
- Rate-limited responses return 429 with Retry-After and both X-RateLimit-* and X-SubmissionLimit-* headers.
- Task creation also has a per-key concurrency limit and returns X-ConcurrencyLimit-* headers; a concurrency rejection uses 429.
- For batch concurrency, only files that pass image validation reserve slots, and success headers report the actual active slots after task binding.
Retry-After: 30 X-RateLimit-Limit: 60 X-RateLimit-Remaining: 59 X-RateLimit-Reset: 1785902400 X-SubmissionLimit-Limit: 10 X-SubmissionLimit-Remaining: 9 X-ConcurrencyLimit-Limit: 3 X-ConcurrencyLimit-Active: 1 X-ConcurrencyLimit-Remaining: 2
กฎการอัปโหลด
- ขนาดไฟล์สูงสุด: 20MB ต่อภาพ
- รูปแบบที่รองรับ: JPEG, PNG, WEBP
- แบ็กเอนด์ตรวจสอบเนื้อหาไฟล์จริง ไม่ใช่แค่นามสกุลไฟล์
การบังคับใช้ขนาดการอัปโหลด
- การอัปโหลดเป็นกลุ่มยอมรับได้สูงสุด 8 ภาพโดยค่าเริ่มต้น โดยมีขีดจำกัด 20MB ต่อภาพ และขีดจำกัดเนื้อหาไฟล์ทั้งหมด 20MB
- ไฟล์หรือแบตช์ที่เกินขีดจำกัดจะส่งคืน 413 ก่อนการตรวจสอบความถูกต้องของรูปภาพหรือการสร้างงาน ไม่มีการสร้างแบทช์บางส่วน
- แบ็กเอนด์บังคับใช้จำนวนไบต์ที่ได้รับจริง แม้ว่า Content-Length จะหายไปหรือมีการใช้การถ่ายโอนแบบก้อนก็ตาม
สถานะของงาน
- queued: ยอมรับแล้วและกำลังรอการประมวลผล AI
- running: กำลังดำเนินการอยู่ หรือได้ส่งมอบให้กับผู้มอบหมายงานแล้ว และยังคงสำรวจหาผลลัพธ์สุดท้าย
- batch_waiting_ai: ทุกรายการในชุดกำลังรอให้บริการ AI กลับมาออนไลน์อีกครั้ง
- batch_running: แบทช์ถูกส่งไปยังผู้จัดส่งแล้วและยังคงดำเนินการอยู่
- done: เสร็จสิ้นเรียบร้อยแล้ว
- failed: กำลังประมวลผล failed
- waiting_ai: queued จนกว่าบริการ AI จะกลับมาออนไลน์ จากนั้นจะกลับมาทำงานต่อโดยอัตโนมัติ
แหล่งที่มาของผลลัพธ์
- fresh: สร้างโดยการรัน AI ใหม่
- cached_exact: ตรงกับแคชเวอร์ชัน AI ปัจจุบัน
- cached_stale: AI ออฟไลน์ ส่งคืนผลลัพธ์แคชล่าสุด
- pending: ยังไม่มีผลลัพธ์สุดท้าย
- failed: งาน failed
- เมื่องานยังไม่ done ให้ตรวจสอบ error_message เพื่อดูสาเหตุการลองใหม่หรือรอครั้งล่าสุด
โควตาและการคิดค่าบริการ
- ใช้ `GET /api/open/quota` ก่อนส่งงานจำนวนมาก หากการเชื่อมต่อของคุณต้องหลีกเลี่ยงข้อผิดพลาดจากโควตา
- เฉพาะการรัน AI แบบ `fresh` เท่านั้นที่ใช้โควตา
- ผลลัพธ์ `cached_exact`, `cached_stale`, `pending` และ `failed` ไม่ใช้โควตา
- บัญชีฟรีใช้โควตารายวันก่อน บัญชีแบบชำระเงินใช้แพ็กเกจโควตาตามรอบที่ยังใช้งานได้ จากนั้นใช้โควตาชั่วคราวหรือโควตาคงที่ตามนโยบาย backend
- เมื่อโควตาหมด การส่งงานจะคืนค่า `429` พร้อมข้อความผิดพลาด แทนที่จะสร้างงานใหม่
แคชและความสดใหม่ของผลลัพธ์
- backend แคชผลลัพธ์ที่สำเร็จตาม hash ของภาพและเวอร์ชัน AI รวมถึง namespace ของธุรกิจ downstream
- `cached_exact` หมายความว่าภาพเดียวกันมีผลลัพธ์สำเร็จสำหรับเวอร์ชัน AI ปัจจุบันแล้ว จึงไม่ต้องรัน AI ใหม่
- `cached_stale` หมายความว่าบริการ AI ออฟไลน์ และ backend ส่งคืนผลลัพธ์ประวัติล่าสุดที่มีอยู่
- เมื่อ `is_latest_ai_version` เป็น false ให้เก็บผลลัพธ์เป็นข้อมูลประวัติที่ใช้ได้แต่ควรตรวจสอบได้
- อย่าถือว่างาน `done` ทุกงานใช้โควตา ให้ตรวจสอบ `result_source`
Task completion webhooks
- Send signed task completion events to your HTTPS endpoint with automatic retries.
- This API key is inactive. Existing records remain available, but new, enabled, test, and secret-rotation operations are blocked.
X-WaterMeter-Webhook-Id: whev_new_event X-WaterMeter-Webhook-Replay-Of: whev_original_event replay_of_event_id: whev_original_event blocked endpoint management: HTTP 409 canceled delivery status: canceled
GET/api/open/quota
/api/open/quotaอ่านโควต้าปัจจุบันและการใช้งานที่เหลืออยู่
ขอตัวอย่าง
curl -X GET "https://watermeterai.com/api/open/quota" \ -H "Authorization: Bearer wm_xxxxxxxxxxxxxxxxx"
ตัวอย่างการตอบสนอง
{
"ok": true,
"email": "[email protected]",
"quota": {
"account_type": "free",
"daily_limit": 20,
"used": 3,
"remaining": 17,
"day_tag": "2026-06-01",
"is_unlimited": false,
"monthly_remaining": 0,
"monthly_bonus_remaining": 0,
"fixed_remaining": 0,
"nearest_expire_at": null,
"quota_summary_text": "Free daily quota: 3/20 used today. Remaining: 17."
}
}GET/api/open/ai-status
/api/open/ai-statusอ่านสถานะการบริการสาธารณะสำหรับการส่งงานและทางเลือกผลลัพธ์แคช
ขอตัวอย่าง
curl -X GET "https://watermeterai.com/api/open/ai-status" \ -H "Authorization: Bearer wm_xxxxxxxxxxxxxxxxx"
ตัวอย่างการตอบสนอง
{
"ok": true,
"is_online": true,
"busy": false,
"active_jobs": 0,
"public_status": "online",
"public_status_label": "online",
"public_status_reason": "ready",
"accepts_new_tasks": true,
"can_return_cached_result": true,
"queue_state": "idle",
"queue_count": 0,
"current_ai_version": "water_v2:wm-ai-v2-2026-06-01",
"last_checked_at": "2026-06-01T06:15:30Z"
}POST/api/open/tasks
/api/open/tasksอัปโหลดหนึ่งภาพและสร้างงานเดียว
ขอตัวอย่าง
curl -X POST "https://watermeterai.com/api/open/tasks" \ -H "Authorization: Bearer wm_xxxxxxxxxxxxxxxxx" \ -F "file=@D:\data\meter_001.jpg"
ตัวอย่างการตอบสนอง
{
"ok": true,
"task_id": "8e6c4d1f8f8348c0bc53e2e39d2dc111",
"status": "queued",
"result_source": "pending",
"visibility": "private",
"ai_online": true,
"is_latest_ai_version": false,
"final_reading": "-",
"result_summary": {
"resultKind": "unknown",
"primaryLabel": "Result",
"primaryValue": "-",
"secondaryLabel": "Detail",
"secondaryValue": "-",
"summaryText": "No result is available yet."
},
"error_message": "",
"created_at": "2026-06-01T06:16:10Z"
}GET/api/open/tasks/{task_id}
/api/open/tasks/{task_id}อ่านสถานะงานหนึ่งรายการและการอ่านครั้งสุดท้าย
ขอตัวอย่าง
curl -X GET "https://watermeterai.com/api/open/tasks/task_a" \ -H "Authorization: Bearer wm_xxxxxxxxxxxxxxxxx"
ตัวอย่างการตอบสนอง
{
"ok": true,
"task_id": "8e6c4d1f8f8348c0bc53e2e39d2dc111",
"status": "done",
"result_source": "fresh",
"ai_online": true,
"is_latest_ai_version": true,
"final_reading": "123.45",
"meter_type": "pointer",
"success": "yes",
"result_summary": {
"resultKind": "water_meter",
"primaryLabel": "Final Reading",
"primaryValue": "123.45",
"secondaryLabel": "Meter Type",
"secondaryValue": "pointer",
"summaryText": "Water meter recognition finished."
},
"error_message": "",
"created_at": "2026-06-01T06:16:10Z"
}GET/api/open/tasks
/api/open/tasksอ่านงานล่าสุดที่เป็นของผู้ใช้คีย์ API ปัจจุบัน
ขอตัวอย่าง
curl -X GET "https://watermeterai.com/api/open/tasks?limit=20" \ -H "Authorization: Bearer wm_xxxxxxxxxxxxxxxxx"
ตัวอย่างการตอบสนอง
{
"ok": true,
"items": [
{
"task_id": "8e6c4d1f8f8348c0bc53e2e39d2dc111",
"status": "done",
"result_source": "cached_exact",
"final_reading": "123.45",
"meter_type": "pointer",
"success": "yes",
"result_summary": {},
"ai_online": true,
"is_latest_ai_version": true,
"created_at": "2026-06-01T06:16:10Z",
"error_message": ""
}
]
}POST/api/open/batches
/api/open/batchesอัปโหลดหลายภาพในคำขอเดียว
ขอตัวอย่าง
curl -X POST "https://watermeterai.com/api/open/batches" \ -H "Authorization: Bearer wm_xxxxxxxxxxxxxxxxx" \ -F "files=@D:\data\meter_001.jpg" \ -F "files=@D:\data\meter_002.jpg"
ตัวอย่างการตอบสนอง
{
"ok": true,
"batch_id": "5a14f4e5f6d34fdabce00e62c0dd0001",
"status": "batch_running",
"total_count": 2,
"done_count": 0,
"failed_count": 0,
"pending_count": 2,
"items": [
{
"index": 0,
"file_name": "meter_001.jpg",
"task_id": "task_a",
"status": "queued",
"result_source": "pending",
"final_reading": "-",
"failure_kind": "",
"error_message": ""
},
{
"index": 1,
"file_name": "meter_002.jpg",
"task_id": "task_b",
"status": "queued",
"result_source": "pending",
"final_reading": "-",
"failure_kind": "",
"error_message": ""
}
]
}GET/api/open/batches/{batch_id}
/api/open/batches/{batch_id}อ่านความคืบหน้าของแบทช์และสถานะงานต่อไฟล์
ขอตัวอย่าง
curl -X GET "https://watermeterai.com/api/open/batches/5a14f4e5f6d34fdabce00e62c0dd0001" \ -H "Authorization: Bearer wm_xxxxxxxxxxxxxxxxx"
ตัวอย่างการตอบสนอง
{
"ok": true,
"batch_id": "5a14f4e5f6d34fdabce00e62c0dd0001",
"status": "batch_done",
"total_count": 2,
"done_count": 2,
"failed_count": 0,
"pending_count": 0,
"items": [
{
"index": 0,
"file_name": "meter_001.jpg",
"task_id": "task_a",
"status": "done",
"result_source": "fresh",
"final_reading": "123.45",
"failure_kind": "",
"error_message": ""
},
{
"index": 1,
"file_name": "meter_002.jpg",
"task_id": "task_b",
"status": "done",
"result_source": "cached_exact",
"final_reading": "456.78",
"failure_kind": "",
"error_message": ""
}
]
}การไหลที่แนะนำ
- ตรวจสอบ `GET /api/open/ai-status` ก่อนส่งปริมาณงานจำนวนมาก
- จัดเก็บ `task_id` หรือ `batch_id` ในระบบของคุณเองทันทีหลังจากส่ง
- ถือว่า `queued`, `running`, `waiting_ai`, `batch_waiting_ai` และ `batch_running` เป็นสถานะที่ไม่สิ้นสุด และทำการสำรวจต่อไป
- ใช้คำขอแบบแบตช์เมื่อเส้นทางเครือข่ายไปยังแบ็กเอนด์มีเวลาแฝงสูงและธุรกิจที่ปรับใช้รองรับโหมดแบตช์
- คำขอแบบกลุ่มในปัจจุบันไหลผ่าน `webBackend -> dispatchCenter -> waterMeterAi`
- `batch_waiting_ai` หมายความว่าทุกรายการยังคงรอบริการ AI ยังไม่ได้ดำเนินการ running
- เมื่อธุรกิจที่ปรับใช้คือ `CAD` ให้ใช้ `POST /api/open/tasks` ในตอนนี้และถือว่าการอัปโหลดแบบกลุ่มไม่พร้อมใช้งาน
หมายเหตุข้อผิดพลาด
- 400: คำขอไม่ถูกต้อง หรือธุรกิจที่ใช้งานไม่รองรับการอัปโหลดเป็นกลุ่ม
- 401: หายไป ไม่ถูกต้อง หมดอายุ หรือปิดใช้งานคีย์ API
- 403: the user account is not active, the key lacks the required scope, or the source IP is outside the key allowlist.
- 404: ไม่พบงานหรือแบตช์ หรือผู้ใช้ปัจจุบันไม่ได้เป็นเจ้าของ
- 413: ไฟล์ใหญ่เกินไป.
- 415: ไม่รองรับประเภทรูปภาพหรือเนื้อหารูปภาพไม่ถูกต้อง
- 429: quota exhausted or the API key request, submission, or concurrency limit was exceeded.
ไม่สามารถอัปโหลดชุด 400 ได้
{
"detail": "batch upload is not supported for business: cax"
}401 คีย์ API หายไปหรือไม่ถูกต้อง
{
"ok": false,
"error": "unauthorized",
"message": "Missing or invalid API key."
}ไฟล์ 413 ใหญ่เกินไป
{
"ok": false,
"error": "file_too_large",
"message": "Maximum file size is 20MB."
}โควต้า 429 หมดแล้ว
{
"ok": false,
"error": "quota_exhausted",
"message": "Quota exhausted.",
"quota": {
"remaining": 0,
"quota_summary_text": "Free daily quota: 20/20 used today. Remaining: 0."
}
}พร้อมทดสอบ workflow แล้วหรือยัง?
ใช้ web workspace กับรูปแรก แล้วค่อยไปใช้ API keys เมื่อรูปแบบผลลัพธ์เหมาะกับระบบของคุณ