Developer
API
Documentation
DOC.IN.TH REST API v2 — เชื่อมต่อระบบจัดการเอกสารเข้ากับแอปพลิเคชันของคุณได้อย่างสมบูรณ์
Base URL: api.doc.in.th/v2
REST · JSON
Bearer Token Auth
Plan M+: 500 req/min
🔑 Authentication
ทุก API Request ต้องแนบ API Key ใน Header ดึง API Key ได้จาก Settings → API → Generate Key
Authorization: Bearer YOUR_API_KEY Content-Type: application/json
POST
/auth/token
สร้าง Access Token จาก Credentials
Request Body:
{
"api_key": "your_api_key",
"workspace_id": "ws_abc123"
}
Response:
{
"access_token": "eyJhbGciOiJIUzI1NiJ9...",
"expires_in": 3600,
"token_type": "Bearer"
}
📄 Documents
GET
/documents
รายการเอกสารทั้งหมด
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
folder_id | string | optional | Filter by folder |
page | integer | optional | Page number (default: 1) |
per_page | integer | optional | Items per page (max: 100) |
{
"data": [
{
"id": "doc_xyz789",
"name": "ใบเสนอราคา Q1-2026.pdf",
"size": 245678,
"mime_type": "application/pdf",
"created_at": "2026-01-15T09:30:00Z",
"folder_id": "fld_abc123",
"ocr_status": "completed"
}
],
"meta": { "total": 142, "page": 1, "per_page": 20 }
}
POST
/documents/upload
อัปโหลดเอกสารใหม่
Multipart Form Data:
| Field | Type | Required | Description |
|---|---|---|---|
file | file | required | ไฟล์ที่ต้องการอัปโหลด (max 500MB) |
folder_id | string | optional | โฟลเดอร์ปลายทาง |
run_ocr | boolean | optional | เรียก OCR หลังอัปโหลด (default: true) |
tags | string[] | optional | Tag สำหรับจัดหมวดหมู่ |
GET
/documents/{id}
ดูรายละเอียดเอกสาร
DELETE
/documents/{id}
ลบเอกสาร (ย้ายไป Trash)
🔍 Search
GET
/search
Full-text search ทั้งชื่อไฟล์และเนื้อหา
| Parameter | Type | Required | Description |
|---|---|---|---|
q | string | required | คำค้นหา รองรับภาษาไทย/อังกฤษ |
type | string | optional | pdf, docx, xlsx, image |
from | date | optional | วันที่เริ่มต้น (YYYY-MM-DD) |
to | date | optional | วันที่สิ้นสุด |
🤖 OCR
POST
/ocr/extract
ดึงข้อความจากไฟล์ภาพหรือ PDF สแกน
Request Body (JSON):
{
"document_id": "doc_xyz789",
"language": "th+en",
"output_format": "json"
}
Response:
{
"text": "ใบเสนอราคา\nบริษัท ตัวอย่าง จำกัด\n...",
"pages": 3,
"confidence": 0.997,
"processing_time_ms": 1240,
"blocks": [
{ "page": 1, "text": "ใบเสนอราคา", "bbox": [100,80,400,120], "confidence": 0.999 }
]
}
🔔 Webhooks
รับ Event แบบ Real-time เมื่อมีการเปลี่ยนแปลงในระบบ ตั้งค่า Webhook Endpoint ได้ที่ Settings → Integrations
POST
/webhooks
สร้าง Webhook ใหม่
Available Events:
"document.uploaded" | "document.deleted" | "ocr.completed" "workflow.approved" | "workflow.rejected" "user.invited" | "user.removed"
Payload ที่ส่งมายัง Endpoint ของคุณ:
{
"event": "ocr.completed",
"document_id": "doc_xyz789",
"workspace_id": "ws_abc123",
"timestamp": "2026-04-23T10:30:00Z",
"data": { "confidence": 0.997, "pages": 3 }
}
⚡ Rate Limits
Rate limit ส่งกลับใน Response Headers:
X-RateLimit-Limit: 500 X-RateLimit-Remaining: 483 X-RateLimit-Reset: 1745400600
Plan S: 100 req/min · Plan M: 500 req/min · Plan L: 2,000 req/min