ข้ามไปยังเนื้อหา

เอกสารอ้างอิง 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/work-items" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{\"workflow_id\":\"policy_review\",\"channel_id\":\"web_main\",\"payload\":{\"message\":\"Review this renewal request before approval\"}}"
คำตอบ
{
  "work_item_id": "wi_123",
  "status": "new",
  "workflow_id": "policy_review"
}

ดำเนินการ action ที่อนุมัติแล้ว

รัน policy-approved action กับ integration ที่ตั้งค่าไว้

คำขอ
curl -X POST "https://api.threada.ai/actions/execute" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{\"work_item_id\":\"wi_123\",\"action_id\":\"request_approval\",\"integration_id\":\"int_workflow\"}"
คำตอบ
{
  "execution_id": "ex_456",
  "status": "started",
  "idempotency_key": "idem_789"
}

ต้องการแนวทางการใช้งานไหม?

ใช้เอกสารและภาพรวมทางเทคนิคสำหรับรูปแบบ rollout และ governance

ติดต่อทีมเทคนิค