ข้ามไปเนื้อหาหลัก
API Docs

API Documentation

เชื่อมต่อ ScanlyIQ เข้ากับระบบของคุณผ่าน REST API

Authentication

สร้าง API Key ได้ที่หน้า Settings → API Keys (ต้อง login ก่อน)

ส่ง API Key ผ่าน header ทุก request:

Authorization: Bearer b2t_live_xxxxxxxxxxxxxxxx...

Base URL: https://www.scanlyiq.com/api

Endpoints

POST/api/upload/slip

อัปโหลดรูปสลิปหรือใบเสร็จก่อนส่งสแกน OCR

Headers

Authorization: Bearer {api_key}
Content-Type: multipart/form-data

Request

files[]  (JPEG/PNG/WebP, max 50MB each, max 50 files)

Response

{
  "uploads": [
    { "id": "upload_abc123", "fileName": "slip1.jpg", "fileSize": 245120 }
  ]
}
POST/api/jobs/slip-ocr

สร้าง OCR job จากไฟล์ที่อัปโหลดแล้ว ระบบจะหักเครดิตอัตโนมัติ

Headers

Authorization: Bearer {api_key}
Content-Type: application/json

Request

{
  "uploadIds": ["upload_abc123", "upload_def456"],
  "modelId": "model_id",
  "projectId": "project_id",       // optional
  "documentType": "slip"           // optional: "slip" | "invoice"
}

Response

{
  "jobId": "job_xyz789",
  "status": "PENDING",
  "itemCount": 2,
  "creditsCharged": 4
}
GET/api/jobs/slip-ocr/{jobId}

ดึงสถานะและผลลัพธ์ของ OCR job (polling จนกว่า status จะเป็น COMPLETED)

Headers

Authorization: Bearer {api_key}

Response

{
  "id": "job_xyz789",
  "status": "COMPLETED",
  "items": [{
    "status": "COMPLETED",
    "result": {
      "bank": "กสิกรไทย",
      "amount": 1500.00,
      "date": "2026-03-18",
      "fromAccount": "xxx-x-x1234-x",
      "toAccount": "xxx-x-x5678-x"
    }
  }]
}
GET/api/credits

ดูยอดเครดิตคงเหลือและยอดใช้ไปทั้งหมด

Headers

Authorization: Bearer {api_key}

Response

{
  "balance": 150,
  "totalUsed": 350,
  "packages": [...]
}
POST/api/credits/estimate

คำนวณเครดิตที่ต้องใช้ก่อนสร้าง job

Headers

Authorization: Bearer {api_key}
Content-Type: application/json

Request

{
  "type": "SLIP_OCR",
  "modelId": "model_id",
  "itemCount": 5
}

Response

{
  "estimatedCredits": 10,
  "currentBalance": 150,
  "sufficient": true,
  "creditsPerUnit": 2,
  "modelName": "Gemini 2.5 Flash"
}
GET/api/models

ดูรายชื่อ AI Models ที่ใช้งานได้ พร้อมราคาต่อหน่วย

Headers

Authorization: Bearer {api_key}

Response

{
  "models": [{
    "id": "clx...",
    "name": "Gemini 2.5 Flash",
    "type": "VISION",
    "creditsPerUnit": 2
  }]
}

Rate Limits

EndpointLimitWindow
/api/auth/*10 req60 วินาที
/api/upload/*20 req60 วินาที
/api/webhooks/*100 req60 วินาที
/api/* (อื่นๆ)60 req60 วินาที

Error Codes

CodeStatusคำอธิบาย
400Bad Requestข้อมูลไม่ถูกต้อง ตรวจสอบ request body
401UnauthorizedAPI Key ไม่ถูกต้องหรือหมดอายุ
402Insufficient Creditsเครดิตไม่เพียงพอ กรุณาเติมเครดิต
403Forbiddenไม่มีสิทธิ์เข้าถึง resource นี้
404Not Foundไม่พบ resource ที่ร้องขอ
429Rate Limitedคำขอมากเกินไป กรุณารอสักครู่

พร้อมเริ่มใช้งาน API แล้วหรือยัง?

สร้าง API Key แล้วเริ่มเชื่อมต่อระบบของคุณได้ทันที

API Documentation | ScanlyIQ | ScanlyIQ