Create a Node - Cognigy Documentation
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Create a Node
POST /v2.0/flows/{flowId}/chart/nodes
Try it
curl --request POST \
--url https://api-trial.cognigy.ai/new/v2.0/flows/{flowId}/chart/nodes \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data @- <<EOF
{
"type": "if",
"target": "63c6c16a7e1ef09c81f6075d",
"extension": "@cognigy/basic-nodes",
"label": "A new Node",
"comment": "this is a very important node",
"commentColor": "#ff8a80",
"isEntryPoint": false,
"isDisabled": false,
"config": {
"condition": {
"type": "rule",
"condition": "",
"rule": {
"left": "1",
"operand": "gt",
"right": "2"
}
}
},
"localeReference": "63bd8ebb648e6e739f1bbd82",
"analyticsLabel": "condition",
"mock": {
"isEnabled": false,
"code": "console.log('Hello, world!');"
},
"position": 42
}
EOF
import requests
url = "https://api-trial.cognigy.ai/new/v2.0/flows/{flowId}/chart/nodes"
payload = {
"type": "if",
"target": "63c6c16a7e1ef09c81f6075d",
"extension": "@cognigy/basic-nodes",
"label": "A new Node",
"comment": "this is a very important node",
"commentColor": "#ff8a80",
"isEntryPoint": False,
"isDisabled": False,
"config": { "condition": {
"type": "rule",
"condition": "",
"rule": {
"left": "1",
"operand": "gt",
"right": "2"
}
} },
"localeReference": "63bd8ebb648e6e739f1bbd82",
"analyticsLabel": "condition",
"mock": {
"isEnabled": False,
"code": "console.log('Hello, world!');"
},
"position": 42
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'if',
target: '63c6c16a7e1ef09c81f6075d',
extension: '@cognigy/basic-nodes',
label: 'A new Node',
comment: 'this is a very important node',
commentColor: '#ff8a80',
isEntryPoint: false,
isDisabled: false,
config: {
condition: {type: 'rule', condition: '', rule: {left: '1', operand: 'gt', right: '2'}}
},
localeReference: '63bd8ebb648e6e739f1bbd82',
analyticsLabel: 'condition',
mock: {isEnabled: false, code: 'console.log('Hello, world!');'},
position: 42
})
};
fetch('https://api-trial.cognigy.ai/new/v2.0/flows/{flowId}/chart/nodes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
JSON Payload
{
"type": "if",
"target": "63c6c16a7e1ef09c81f6075d",
"extension": "@cognigy/basic-nodes",
"label": "A new Node",
"comment": "this is a very important node",
"commentColor": "#ff8a80",
"isEntryPoint": false,
"isDisabled": false,
"config": {
"condition": {
"type": "rule",
"condition": "",
"rule": {
"left": "1",
"operand": "gt",
"right": "2"
}
}
},
"localeReference": "63bd8ebb648e6e739f1bbd82",
"analyticsLabel": "condition",
"mock": {
"isEnabled": false,
"code": "console.log('Hello, world!');"
},
"position": 42
}
Response Codes
- 201: Created
- 400: Bad Request
- 401: Unauthorized
- 403: Forbidden
- 404: Not Found
- 500: Internal Server Error
Path Parameters
- flowId (string): The unique identifier for the Flow. Required string length:
24.