เอกสารอ้างอิง API
เอกสารอ้างอิงสำหรับ WorkItem operations, decision-step controls, integration execution และ telemetry export
APIs เหล่านี้ออกแบบเพื่อพฤติกรรม automation ที่คาดการณ์ได้ พร้อม policy และ tenant scoping ที่ชัดเจน
Endpoint พื้นฐาน
ใช้ public API endpoint ที่คุณตั้งค่าไว้สำหรับ authenticated requests
https://api.threada.ai Authentication และ context
- ใช้ scoped credentials สำหรับ API access
- รวม tenant และ role context เมื่อจำเป็น
- Requests ที่ไม่มี valid context จะ fail closed
ขอบเขตทั่วไป
- workitems:read และ workitems:write
- workflow:manage สำหรับการอัปเดตนโยบายและการตัดสินใจ
- actions:execute สำหรับการดำเนินการที่อยู่ภายใต้การกำกับดูแล
- telemetry:read สำหรับการส่งออกและการวิเคราะห์
Pagination และ filtering
- List endpoints รองรับ cursor- หรือ token-based pagination
- Filter ตาม channel, workflow, status, policy version และ time range
- ควรใช้ bounded windows สำหรับ telemetry exports ขนาดใหญ่
โมเดลข้อผิดพลาด
- Typed error categories สำหรับ validation, authorization, policy และ execution failures
- Reason codes รองรับ deterministic handling ใน operator tooling
- Correlation IDs จะถูกส่งคืนสำหรับ cross-service investigation
ตัวอย่าง requests
สร้าง WorkItem จาก intake payload
สร้าง canonical work record สำหรับ workflow processing รวม channel identifier สำหรับ intake channel เมื่อจำเป็น
curl -X POST "https://api.threada.ai/api/v1/public/work-items" \
-H "X-API-Key: <api-key>" \
-H "Content-Type: application/json" \
-d "{\"subject\":\"Review renewal request\",\"channel\":\"web\",\"channel_id\":\"web_main\",\"initial_message\":{\"role\":\"user\",\"content\":\"Review this renewal request before approval\"},\"tags\":[\"policy_review\"]}" {
"work_item": {
"summary": {
"work_item_id": "wi_123",
"status": "new",
"subject": "Review renewal request"
}
}
} ดำเนินการ action ที่อนุมัติแล้ว
รัน policy-approved action กับ integration ที่ตั้งค่าไว้
curl -X POST "https://api.threada.ai/api/v1/public/work-items/wi_123/actions" \
-H "X-API-Key: <api-key>" \
-H "Content-Type: application/json" \
-d "{\"integration_id\":\"int_workflow\",\"idempotency_key\":\"act_456\",\"payload\":{\"type\":\"custom_http\",\"method\":\"POST\",\"url\":\"https://api.example.com/approvals\",\"body_json\":\"{\\\"approved\\\":true}\"}}" {
"action": {
"action_id": "act_456",
"work_item_id": "wi_123",
"action_type": "custom_http",
"status": "completed"
}
} ตัวอย่างอาร์ติแฟกต์
ตัวอย่างประกอบของอ็อบเจกต์ที่ Threada สร้างขึ้น โดยใช้ข้อมูลสังเคราะห์ — ไม่ใช่ลูกค้าหรือระเบียนจริง ชื่อฟิลด์เป็นไปตามสคีมา API และสคีมาการตรวจสอบ (audit) ของ Threada
- ตัวอย่าง WorkItem (JSON) generation_mode: illustrative_sample · provenance_citation: docs/spec/product.md#design-principles
- ตัวอย่างชุดหลักฐาน (JSON) generation_mode: illustrative_sample · provenance_citation: docs/spec/product.md#design-principles
- ตัวอย่างใบรับรองการดำเนินการ (JSON) generation_mode: illustrative_sample · provenance_citation: docs/spec/product.md#design-principles
- ตัวอย่างการส่งออกการตรวจสอบ (CSV) generation_mode: illustrative_sample · provenance_citation: docs/spec/product.md#design-principles
ต้องการแนวทางการใช้งานไหม?
ใช้เอกสารและภาพรวมทางเทคนิคสำหรับรูปแบบการ rollout และ governance
ติดต่อทีมเทคนิค