Skip to content

Workflow

Automation workflows: read, edit, enable/disable, run, trigger.api events. · 16 endpoints

List workflows

GET/api/v1/workflowsScope: workflow:read

Parameters

account_id
query · optional
string
max 200
Only workflows that apply to this account

Example request

bash
curl "http://127.0.0.1:9900/api/v1/workflows" \
  -H "Authorization: Bearer dpk_xxx"

Create a workflow

POST/api/v1/workflowsScope: workflow:write

Request body (JSON)

name
required
string
max 200
description
optional
string
max 2000 · default ""
enabled
optional
boolean
default false
channel
optional
"zalo" | "facebook" | "telegram_user" | "telegram_bot"
default "zalo"
account_ids
optional
string[]
max 200 items · default []
Accounts it applies to; empty = all accounts
nodes
required
object[]
max 500 items
Nodes in the workflow editor's format (see GET /workflows/node-types)
edges
required
object[]
max 2000 items

Example request

bash
curl -X POST "http://127.0.0.1:9900/api/v1/workflows" \
  -H "Authorization: Bearer dpk_xxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"string","nodes":[],"edges":[]}'

Node catalog (like the editor's palette) and default configurations

GET/api/v1/workflows/node-typesScope: workflow:read

Example request

bash
curl "http://127.0.0.1:9900/api/v1/workflows/node-types" \
  -H "Authorization: Bearer dpk_xxx"

Get a workflow (with nodes, edges)

GET/api/v1/workflows/{workflowId}Scope: workflow:read

Parameters

workflowId
path · required
string
max 200

Example request

bash
curl "http://127.0.0.1:9900/api/v1/workflows/{workflowId}" \
  -H "Authorization: Bearer dpk_xxx"

Overwrite a workflow (keeps its id and creation date)

PUT/api/v1/workflows/{workflowId}Scope: workflow:write

Parameters

workflowId
path · required
string
max 200

Request body (JSON)

name
required
string
max 200
description
optional
string
max 2000 · default ""
enabled
optional
boolean
default false
channel
optional
"zalo" | "facebook" | "telegram_user" | "telegram_bot"
default "zalo"
account_ids
optional
string[]
max 200 items · default []
Accounts it applies to; empty = all accounts
nodes
required
object[]
max 500 items
Nodes in the workflow editor's format (see GET /workflows/node-types)
edges
required
object[]
max 2000 items

Example request

bash
curl -X PUT "http://127.0.0.1:9900/api/v1/workflows/{workflowId}" \
  -H "Authorization: Bearer dpk_xxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"string","nodes":[],"edges":[]}'

Enable / disable a workflow

PATCH/api/v1/workflows/{workflowId}Scope: workflow:write

Parameters

workflowId
path · required
string
max 200

Request body (JSON)

enabled
required
boolean

Example request

bash
curl -X PATCH "http://127.0.0.1:9900/api/v1/workflows/{workflowId}" \
  -H "Authorization: Bearer dpk_xxx" \
  -H "Content-Type: application/json" \
  -d '{"enabled":false}'

Delete a workflow

DELETE/api/v1/workflows/{workflowId}Scope: workflow:write

Parameters

workflowId
path · required
string
max 200

Example request

bash
curl -X DELETE "http://127.0.0.1:9900/api/v1/workflows/{workflowId}" \
  -H "Authorization: Bearer dpk_xxx"

Duplicate a workflow to another account

POST/api/v1/workflows/{workflowId}/cloneScope: workflow:write

Parameters

workflowId
path · required
string
max 200

Request body (JSON)

target_account_id
required
string
max 200

Example request

bash
curl -X POST "http://127.0.0.1:9900/api/v1/workflows/{workflowId}/clone" \
  -H "Authorization: Bearer dpk_xxx" \
  -H "Content-Type: application/json" \
  -d '{"target_account_id":"string"}'

Run the workflow now with arbitrary trigger data (like the "Test run" button, "Chạy thử")

POST/api/v1/workflows/{workflowId}/runScope: workflow:run

Parameters

workflowId
path · required
string
max 200

Request body (JSON)

trigger_data
optional
object
default {}

Example request

bash
curl -X POST "http://127.0.0.1:9900/api/v1/workflows/{workflowId}/run" \
  -H "Authorization: Bearer dpk_xxx" \
  -H "Content-Type: application/json" \
  -d '{"trigger_data":{}}'

Simulated run (no real messages are sent)

POST/api/v1/workflows/{workflowId}/simulateScope: workflow:run

Parameters

workflowId
path · required
string
max 200

Request body (JSON)

trigger_data
optional
object
default {}

Example request

bash
curl -X POST "http://127.0.0.1:9900/api/v1/workflows/{workflowId}/simulate" \
  -H "Authorization: Bearer dpk_xxx" \
  -H "Content-Type: application/json" \
  -d '{"trigger_data":{}}'

Fire an event for workflows that have a "When called by API/plugin" node ("Khi API/plugin gọi", trigger.api)

POST/api/v1/workflows/events/{eventName}Scope: workflow:run

Workflows matching the event name run asynchronously (like any trigger). Inside the workflow, use {{ $trigger.payload.<field> }}.

Parameters

eventName
path · required
string
max 100

Request body (JSON)

payload
optional
object
default {}
account_id
optional
string
max 200
Only run workflows that apply to this account

Example request

bash
curl -X POST "http://127.0.0.1:9900/api/v1/workflows/events/{eventName}" \
  -H "Authorization: Bearer dpk_xxx" \
  -H "Content-Type: application/json" \
  -d '{"payload":{"order_id":"DH2291","phone":"0901234567"}}'

Example response

json
{
  "success": true,
  "data": {
    "matched": 1,
    "workflow_ids": [
      "8c1f…"
    ]
  },
  "request_id": "3f0c0b6e-6d0a-4b8e-9d1a-1d2f3a4b5c6d"
}

Recent run history

GET/api/v1/workflows/{workflowId}/runsScope: workflow:read

Parameters

workflowId
path · required
string
max 200
limit
query · optional
integer
≥ 1 · ≤ 200 · default 50

Example request

bash
curl "http://127.0.0.1:9900/api/v1/workflows/{workflowId}/runs" \
  -H "Authorization: Bearer dpk_xxx"

Clear the workflow's run history

DELETE/api/v1/workflows/{workflowId}/runsScope: workflow:write

Parameters

workflowId
path · required
string
max 200

Example request

bash
curl -X DELETE "http://127.0.0.1:9900/api/v1/workflows/{workflowId}/runs" \
  -H "Authorization: Bearer dpk_xxx"

Public webhook URL of the "External webhook" node ("Webhook bên ngoài")

GET/api/v1/workflows/{workflowId}/webhook-urlScope: workflow:read

Parameters

workflowId
path · required
string
max 200

Example request

bash
curl "http://127.0.0.1:9900/api/v1/workflows/{workflowId}/webhook-url" \
  -H "Authorization: Bearer dpk_xxx"

Regenerate the webhook token (the old link stops working immediately)

POST/api/v1/workflows/{workflowId}/webhook-url/regenerateScope: workflow:write

Parameters

workflowId
path · required
string
max 200

Example request

bash
curl -X POST "http://127.0.0.1:9900/api/v1/workflows/{workflowId}/webhook-url/regenerate" \
  -H "Authorization: Bearer dpk_xxx"

Copy all of this account's workflows to another account

POST/api/v1/accounts/{accountId}/workflows/cloneScope: workflow:write

Same as "Copy workflows to account" (Sao chép workflow sang tài khoản) in the app: the copies apply to the target account and keep their on/off state.

Parameters

accountId
path · required
string
max 200

Request body (JSON)

to_account_id
required
string
max 200

Example request

bash
curl -X POST "http://127.0.0.1:9900/api/v1/accounts/{accountId}/workflows/clone" \
  -H "Authorization: Bearer dpk_xxx" \
  -H "Content-Type: application/json" \
  -d '{"to_account_id":"string"}'