Scope ai-flows:read for reads · ai-flows:write for changes
Operations
| GET | /v1/ai-flows | List — see list |
| POST | /v1/ai-flows | Create — see create |
| GET | /v1/ai-flows/{id} | Read — see get |
| PATCH | /v1/ai-flows/{id} | Update — see update |
| DELETE | /v1/ai-flows/{id} | Delete — see delete |
Minimal create
curl -X POST https://api2.djcsystem.com/v1/ai-flows \
-H "Authorization: Bearer $DJC_TOKEN" -H "Content-Type: application/json" \
-d '{ "name": "…" }'Fields
Fields you may send on create. Updatable marks fields accepted by PATCH. Anything not listed is server-owned or hidden.
| Field | Type | On create | Updatable |
|---|---|---|---|
name | string | required | yes |
status | enum(active|inactive) | optional | yes |
keywords | array<string> | optional | yes |
system | string | optional | yes |
flowDesign | string | optional | yes |
disableAI | boolean | optional | yes |
collectDataOneAtATime | boolean | optional | yes |
dataFields | array<object> | optional | yes |
roundRobin | boolean | optional | yes |
autoAssignmentIds | array<string> | optional | yes |
forwardNumbers | string | optional | yes |
forwardMessage | string | optional | yes |
pinned | boolean | optional | yes |
whoCanEdit | enum(everyone|only me) | optional | yes |
Filters & sorting
| Filterable | statuspinnedtype |
| Sortable | date |
| Default order | date:desc |
Child: blocks
Nodes of the follow-up sequence (Sequences Design canvas). Connect them with `relations`.
| GET | /v1/ai-flows/{id}/blocks |
| POST | /v1/ai-flows/{id}/blocks |
| GET | /v1/ai-flows/{id}/blocks/{childId} |
| PATCH | /v1/ai-flows/{id}/blocks/{childId} |
| DELETE | /v1/ai-flows/{id}/blocks/{childId} |
| Field | Type | On create | Updatable |
|---|---|---|---|
name | string | required | yes |
blockType | enum(sequential|textNode|questionNode|labelNode|assignLeadNode|stopFlowNode|telegramNotificationNode|whatsappNotificationNode) | required | no |
message | string | optional | yes |
description | string | optional | yes |
position | object | optional | yes |
orderId | number | optional | yes |
time | number | optional | yes |
timeUnit | enum(seconds|minutes|hours|days) | optional | yes |
status | enum(active|inactive) | optional | yes |
waitForReply | boolean | optional | yes |
replyTime | number | optional | yes |
replyTimeUnit | enum(seconds|minutes|hours|days) | optional | yes |
dataFields | array<object> | optional | yes |
questionNoReplyReask | boolean | optional | yes |
questionNoReplyTime | number | optional | yes |
questionNoReplyTimeUnit | enum(seconds|minutes|hours|days) | optional | yes |
questionNoReplyRetryCount | number | optional | yes |
questionIrrelevantReplyReask | boolean | optional | yes |
questionIrrelevantReplyRetryCount | number | optional | yes |
questionAskOneAtATime | boolean | optional | yes |
labels | array<object> | optional | yes |
selectedMembers | array<string> | optional | yes |
roundRobin | boolean | optional | yes |
overrideAssignment | boolean | optional | yes |
whatsappNotificationPhones | array<string> | optional | yes |
whatsappNotificationAssignedUsers | boolean | optional | yes |
Filterable: blockTypeorderIdstatus
- Set `orderId: 0` on exactly one block — that is where the sequence starts. Other blocks default to 999.
- `position` is canvas coordinates; space nodes ~350px apart horizontally so they do not overlap.
- `sequential` sends `message` then waits `time`/`timeUnit` before following its outgoing relation; `textNode` is the same with reply handling; `questionNode` collects `dataFields` from the customer.
Child: relations
Edges between blocks. Creating one also records the target on the source block's `targetNodeId`, as the canvas does.
| GET | /v1/ai-flows/{id}/relations |
| POST | /v1/ai-flows/{id}/relations |
| GET | /v1/ai-flows/{id}/relations/{childId} |
| DELETE | /v1/ai-flows/{id}/relations/{childId} |
| Field | Type | On create | Updatable |
|---|---|---|---|
sourceNodeId | string | required | no |
targetNodeId | string | required | no |
sourceHandleId | string | optional | no |
Filterable: sourceNodeIdtargetNodeId
- Create blocks first, then relations. One outgoing relation per handle is typical for a linear sequence.
- `sourceHandleId` must be an output of the SOURCE block type: sequential/notification → SEQUENTIAL; questionNode → SEQUENTIAL (data collected) | NO_REPLY | IRRELEVANT; textNode → SEQUENCE (immediately) | REPLIED | NO_REPLY. assignLeadNode, labelNode and stopFlowNode are terminal.
- Omit `sourceHandleId` to use the type's default (textNode defaults to REPLIED). A wrong handle is rejected with 400 and `details.allowedHandles`.
Good to know
- `system` is the chatbot personality prompt; `flowDesign` is free-text knowledge the bot answers from.
- Deleting a flow does not delete its knowledge records — remove them via `knowledge-records` with `filter[flowId]`.