Nodeflux Central
Workflows

API Reference — Workflows

Endpoint untuk membuat, mengelola, mengeksekusi, dan memantau riwayat eksekusi Workflow pada platform Lenz.

Semua endpoint memerlukan header Authorization: Bearer <token>. Basis URL mengikuti variabel lingkungan VITE_API_URL yang dikonfigurasi pada instalasi Lenz. Jika Anda belum punya Token, lihat halaman Otentikasi.


Manajemen Workflow

Endpoint utama untuk membuat, membaca, memperbarui, dan menghapus Workflow.

GET
/api/workflows

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Query Parameters

page?integer

Nomor halaman, dimulai dari 1.

Default1
limit?integer

Jumlah data per halaman.

Default10
search?string

Pencarian berdasarkan nama Workflow (pencarian parsial, tidak case-sensitive).

Response Body

application/json

application/json

curl -X GET "https://lenz.example.com/api/workflows"
{  "ok": true,  "message": "success",  "data": [    {      "id": "wf-uuid-001",      "name": "Laporan Harian Face Recognition",      "description": "Ekspor riwayat FR setiap pagi lalu kirim via Telegram",      "is_active": true,      "trigger_node": {        "type": "schedule",        "config": {          "cron": "0 0 7 * * *"        }      },      "nodes": [        {          "id": "node-export",          "type": "event_history_export",          "name": "Ekspor Riwayat FR",          "config": {            "analytic_type": "FR",            "date_range": "yesterday"          }        },        {          "id": "node-telegram",          "type": "telegram_send_attachment",          "name": "Kirim ke Telegram",          "config": {            "credential_id": "cred-tg-001",            "file": "{{prev.body.file_url}}"          }        }      ],      "created_at": "2025-01-15T00:00:00Z",      "updated_at": "2025-04-01T08:00:00Z"    }  ],  "limit": 10,  "current_page": 1,  "total_data": 1,  "total_page": 1}
{  "ok": false,  "message": "invalid request"}
POST
/api/workflows

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X POST "https://lenz.example.com/api/workflows" \  -H "Content-Type: application/json" \  -d '{    "name": "Laporan Harian Face Recognition",    "description": "Ekspor riwayat Face Recognition setiap pagi lalu kirim via Telegram",    "is_active": true,    "trigger_node": {      "type": "schedule",      "config": {        "cron": "0 0 7 * * *"      }    },    "nodes": [      {        "id": "node-export",        "type": "event_history_export",        "name": "Ekspor Riwayat FR Kemarin",        "config": {          "analytic_type": "FR",          "date_range": "yesterday",          "format": "csv",          "output_dir": "/exports/fr"        }      },      {        "id": "node-telegram",        "type": "telegram_send_attachment",        "name": "Kirim Laporan ke Telegram",        "config": {          "credential_id": "cred-tg-001",          "file": "{{prev.body.file_url}}",          "caption": "Laporan FR harian — {{prev.body.date}}"        }      }    ]  }'
{  "ok": true,  "message": "workflow created successfully",  "data": {    "id": "wf-uuid-002",    "name": "Laporan Harian Face Recognition",    "description": "Ekspor riwayat Face Recognition setiap pagi lalu kirim via Telegram",    "is_active": true,    "trigger_node": {      "type": "schedule",      "config": {        "cron": "0 0 7 * * *"      }    },    "nodes": [      {        "id": "node-export",        "type": "event_history_export",        "name": "Ekspor Riwayat FR Kemarin",        "config": {          "analytic_type": "FR",          "date_range": "yesterday"        }      },      {        "id": "node-telegram",        "type": "telegram_send_attachment",        "name": "Kirim Laporan ke Telegram",        "config": {          "credential_id": "cred-tg-001",          "file": "{{prev.body.file_url}}"        }      }    ],    "created_at": "2025-04-30T08:00:00Z",    "updated_at": null  }}
{  "ok": false,  "message": "invalid request"}
{  "ok": false,  "message": "invalid request"}
GET
/api/workflows/{id}

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Path Parameters

id*string

ID Workflow (UUID).

Response Body

application/json

application/json

curl -X GET "https://lenz.example.com/api/workflows/wf-uuid-001"
{  "ok": true,  "message": "success",  "data": {    "id": "wf-uuid-001",    "name": "Laporan Harian Face Recognition",    "description": "Ekspor riwayat Face Recognition setiap pagi lalu kirim via Telegram",    "is_active": true,    "trigger_node": {      "type": "schedule",      "config": {        "cron": "0 0 7 * * *"      }    },    "nodes": [      {        "id": "node-export",        "type": "event_history_export",        "name": "Ekspor Riwayat FR Kemarin",        "config": {          "analytic_type": "FR",          "date_range": "yesterday",          "format": "csv"        }      },      {        "id": "node-telegram",        "type": "telegram_send_attachment",        "name": "Kirim Laporan ke Telegram",        "config": {          "credential_id": "cred-tg-001",          "file": "{{prev.body.file_url}}",          "caption": "Laporan FR harian — {{prev.body.date}}"        }      }    ],    "created_at": "2025-01-15T00:00:00Z",    "updated_at": "2025-04-01T08:00:00Z"  }}
{  "ok": false,  "message": "invalid request"}
PUT
/api/workflows/{id}

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Path Parameters

id*string

ID Workflow (UUID).

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X PUT "https://lenz.example.com/api/workflows/wf-uuid-001" \  -H "Content-Type: application/json" \  -d '{    "name": "Laporan Harian Face Recognition",    "description": "Nonaktifkan sementara untuk maintenance",    "is_active": false,    "trigger_node": {      "type": "schedule",      "config": {        "cron": "0 0 7 * * *"      }    },    "nodes": [      {        "id": "node-export",        "type": "event_history_export",        "name": "Ekspor Riwayat FR Kemarin",        "config": {          "analytic_type": "FR",          "date_range": "yesterday"        }      }    ]  }'
{  "ok": true,  "message": "workflow updated successfully",  "data": {    "id": "wf-uuid-001",    "name": "Laporan Harian Face Recognition",    "is_active": false,    "trigger_node": {      "type": "schedule",      "config": {        "cron": "0 0 7 * * *"      }    },    "nodes": [],    "created_at": "2025-01-15T00:00:00Z",    "updated_at": "2025-04-30T09:00:00Z"  }}
{  "ok": false,  "message": "invalid request"}
DELETE
/api/workflows/{id}

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Path Parameters

id*string

ID Workflow (UUID).

Response Body

application/json

application/json

curl -X DELETE "https://lenz.example.com/api/workflows/wf-uuid-001"
{  "ok": true,  "message": "workflow deleted successfully"}
{  "ok": false,  "message": "invalid request"}

Eksekusi

Endpoint untuk memicu eksekusi Workflow secara manual, terlepas dari konfigurasi Trigger yang dikonfigurasi.

POST
/api/workflows/{id}/execute

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Path Parameters

id*string

ID Workflow yang akan dieksekusi.

Response Body

application/json

application/json

curl -X POST "https://lenz.example.com/api/workflows/wf-uuid-001/execute"
{  "ok": true,  "message": "workflow executed successfully",  "data": {    "id": "exec-uuid-001",    "workflow_id": "wf-uuid-001",    "trigger_type": "manual",    "status": "success",    "started_at": "2025-04-30T07:00:00Z",    "finished_at": "2025-04-30T07:00:05Z",    "node_results": [      {        "node_id": "node-export",        "node_type": "event_history_export",        "node_name": "Ekspor Riwayat FR Kemarin",        "status": "success",        "started_at": "2025-04-30T07:00:00Z",        "finished_at": "2025-04-30T07:00:03Z",        "output": {          "file_url": "/exports/fr/2025-04-29.csv",          "date": "2025-04-29"        },        "error": null      },      {        "node_id": "node-telegram",        "node_type": "telegram_send_attachment",        "node_name": "Kirim Laporan ke Telegram",        "status": "success",        "started_at": "2025-04-30T07:00:03Z",        "finished_at": "2025-04-30T07:00:05Z",        "output": {          "message_id": 42        },        "error": null      }    ],    "error": null,    "triggered_by": "user-alfin"  }}
{  "ok": false,  "message": "invalid request"}

Riwayat Eksekusi

Endpoint untuk mengambil log eksekusi Workflow beserta detail hasil setiap Action Node dalam pipeline.

GET
/api/workflows/{id}/logs

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Path Parameters

id*string

ID Workflow.

Query Parameters

page?integer

Nomor halaman, dimulai dari 1.

Default1
limit?integer

Jumlah data per halaman.

Default10

Response Body

application/json

application/json

curl -X GET "https://lenz.example.com/api/workflows/wf-uuid-001/logs"
{  "ok": true,  "message": "success",  "data": [    {      "id": "exec-uuid-001",      "workflow_id": "wf-uuid-001",      "trigger_type": "schedule",      "status": "success",      "started_at": "2025-04-30T07:00:00Z",      "finished_at": "2025-04-30T07:00:05Z",      "node_results": [        {          "node_id": "node-export",          "node_type": "event_history_export",          "node_name": "Ekspor Riwayat FR Kemarin",          "status": "success",          "started_at": "2025-04-30T07:00:00Z",          "finished_at": "2025-04-30T07:00:03Z",          "output": {            "file_url": "/exports/fr/2025-04-29.csv"          },          "error": null        }      ],      "error": null,      "triggered_by": "scheduler"    }  ],  "limit": 10,  "current_page": 1,  "total_data": 1,  "total_page": 1}
{  "ok": false,  "message": "invalid request"}

On this page