API

API Referansı

Worktio REST API dokümantasyonu.

Authentication

Tüm API endpoint’leri session authentication gerektirir. NextAuth.js cookie ile otomatik yönetilir.

Endpoints

GET/api/flowsTüm flowları listeler
Response:
[{ "id": "uuid", "name": "string", "nodes": [], "edges": [] }]
POST/api/flowsYeni flow oluşturur
Request Body:
{ "name": "string", "nodes": [], "edges": [] }
PATCH/api/flows/:idFlow günceller
Request Body:
{ "name": "string", "nodes": [], "edges": [] }
DELETE/api/flows/:idFlow siler
Response:
{ "success": true }
POST/api/flows/:id/runFlow'u çalıştırır
Response:
{ "success": true, "results": {}, "duration": 234 }
GET/api/agentsTüm agentları listeler
Response:
[{ "id": "uuid", "name": "string", "model": "gpt-4o" }]
POST/api/agents/:id/chatAgent'a mesaj gönderir
Request Body:
{ "content": "string" }

Webhook Endpoint

POST/api/webhooks/:flowId

Dış servislerden flow tetiklemek için kullanılır. Authentication gerektirmez.

// Örnek istek:
curl -X POST https://worktio.com/api/webhooks/<flowId> \
  -H "Content-Type: application/json" \
  -d '{"event": "new_user", "userId": 123}'