Workflow and voice
Replace a branch's workflow
Checks the workflow as the dashboard’s builder does, then publishes it as a new version of the branch. A branch changed since revision is refused with 409; read it again and retry. A protected branch is refused with 403. Needs a Full access key.
PUT
/
api
/
v2
/
agents
/
{agentId}
/
branches
/
{branchId}
/
workflow
Replace a branch's workflow
curl --request PUT \
--url https://app.cntillion.com/api/v2/agents/{agentId}/branches/{branchId}/workflow \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"revision": 1,
"workflow": {
"nodes": [
{
"id": "<string>",
"type": "start",
"label": "",
"position": {
"x": 0,
"y": 0
},
"parentId": "<string>",
"edgeOrder": []
}
],
"edges": [
{
"id": "<string>",
"source": "<string>",
"target": "<string>",
"forward": {
"type": "none",
"label": ""
},
"backward": {
"type": "none",
"label": ""
},
"sourceExitId": "<string>",
"targetEntryId": "<string>"
}
],
"format": 1,
"preventInfiniteLoops": false,
"sensitiveVariables": [],
"groups": [
{
"id": "<string>",
"label": "<string>",
"nodeIds": [
"<string>"
],
"collapsed": true
}
]
},
"message": "<string>"
}
'import requests
url = "https://app.cntillion.com/api/v2/agents/{agentId}/branches/{branchId}/workflow"
payload = {
"revision": 1,
"workflow": {
"nodes": [
{
"id": "<string>",
"type": "start",
"label": "",
"position": {
"x": 0,
"y": 0
},
"parentId": "<string>",
"edgeOrder": []
}
],
"edges": [
{
"id": "<string>",
"source": "<string>",
"target": "<string>",
"forward": {
"type": "none",
"label": ""
},
"backward": {
"type": "none",
"label": ""
},
"sourceExitId": "<string>",
"targetEntryId": "<string>"
}
],
"format": 1,
"preventInfiniteLoops": False,
"sensitiveVariables": [],
"groups": [
{
"id": "<string>",
"label": "<string>",
"nodeIds": ["<string>"],
"collapsed": True
}
]
},
"message": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
revision: 1,
workflow: {
nodes: [
{
id: '<string>',
type: 'start',
label: '',
position: {x: 0, y: 0},
parentId: '<string>',
edgeOrder: []
}
],
edges: [
{
id: '<string>',
source: '<string>',
target: '<string>',
forward: {type: 'none', label: ''},
backward: {type: 'none', label: ''},
sourceExitId: '<string>',
targetEntryId: '<string>'
}
],
format: 1,
preventInfiniteLoops: false,
sensitiveVariables: [],
groups: [{id: '<string>', label: '<string>', nodeIds: ['<string>'], collapsed: true}]
},
message: '<string>'
})
};
fetch('https://app.cntillion.com/api/v2/agents/{agentId}/branches/{branchId}/workflow', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.cntillion.com/api/v2/agents/{agentId}/branches/{branchId}/workflow",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'revision' => 1,
'workflow' => [
'nodes' => [
[
'id' => '<string>',
'type' => 'start',
'label' => '',
'position' => [
'x' => 0,
'y' => 0
],
'parentId' => '<string>',
'edgeOrder' => [
]
]
],
'edges' => [
[
'id' => '<string>',
'source' => '<string>',
'target' => '<string>',
'forward' => [
'type' => 'none',
'label' => ''
],
'backward' => [
'type' => 'none',
'label' => ''
],
'sourceExitId' => '<string>',
'targetEntryId' => '<string>'
]
],
'format' => 1,
'preventInfiniteLoops' => false,
'sensitiveVariables' => [
],
'groups' => [
[
'id' => '<string>',
'label' => '<string>',
'nodeIds' => [
'<string>'
],
'collapsed' => true
]
]
],
'message' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.cntillion.com/api/v2/agents/{agentId}/branches/{branchId}/workflow"
payload := strings.NewReader("{\n \"revision\": 1,\n \"workflow\": {\n \"nodes\": [\n {\n \"id\": \"<string>\",\n \"type\": \"start\",\n \"label\": \"\",\n \"position\": {\n \"x\": 0,\n \"y\": 0\n },\n \"parentId\": \"<string>\",\n \"edgeOrder\": []\n }\n ],\n \"edges\": [\n {\n \"id\": \"<string>\",\n \"source\": \"<string>\",\n \"target\": \"<string>\",\n \"forward\": {\n \"type\": \"none\",\n \"label\": \"\"\n },\n \"backward\": {\n \"type\": \"none\",\n \"label\": \"\"\n },\n \"sourceExitId\": \"<string>\",\n \"targetEntryId\": \"<string>\"\n }\n ],\n \"format\": 1,\n \"preventInfiniteLoops\": false,\n \"sensitiveVariables\": [],\n \"groups\": [\n {\n \"id\": \"<string>\",\n \"label\": \"<string>\",\n \"nodeIds\": [\n \"<string>\"\n ],\n \"collapsed\": true\n }\n ]\n },\n \"message\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://app.cntillion.com/api/v2/agents/{agentId}/branches/{branchId}/workflow")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"revision\": 1,\n \"workflow\": {\n \"nodes\": [\n {\n \"id\": \"<string>\",\n \"type\": \"start\",\n \"label\": \"\",\n \"position\": {\n \"x\": 0,\n \"y\": 0\n },\n \"parentId\": \"<string>\",\n \"edgeOrder\": []\n }\n ],\n \"edges\": [\n {\n \"id\": \"<string>\",\n \"source\": \"<string>\",\n \"target\": \"<string>\",\n \"forward\": {\n \"type\": \"none\",\n \"label\": \"\"\n },\n \"backward\": {\n \"type\": \"none\",\n \"label\": \"\"\n },\n \"sourceExitId\": \"<string>\",\n \"targetEntryId\": \"<string>\"\n }\n ],\n \"format\": 1,\n \"preventInfiniteLoops\": false,\n \"sensitiveVariables\": [],\n \"groups\": [\n {\n \"id\": \"<string>\",\n \"label\": \"<string>\",\n \"nodeIds\": [\n \"<string>\"\n ],\n \"collapsed\": true\n }\n ]\n },\n \"message\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.cntillion.com/api/v2/agents/{agentId}/branches/{branchId}/workflow")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"revision\": 1,\n \"workflow\": {\n \"nodes\": [\n {\n \"id\": \"<string>\",\n \"type\": \"start\",\n \"label\": \"\",\n \"position\": {\n \"x\": 0,\n \"y\": 0\n },\n \"parentId\": \"<string>\",\n \"edgeOrder\": []\n }\n ],\n \"edges\": [\n {\n \"id\": \"<string>\",\n \"source\": \"<string>\",\n \"target\": \"<string>\",\n \"forward\": {\n \"type\": \"none\",\n \"label\": \"\"\n },\n \"backward\": {\n \"type\": \"none\",\n \"label\": \"\"\n },\n \"sourceExitId\": \"<string>\",\n \"targetEntryId\": \"<string>\"\n }\n ],\n \"format\": 1,\n \"preventInfiniteLoops\": false,\n \"sensitiveVariables\": [],\n \"groups\": [\n {\n \"id\": \"<string>\",\n \"label\": \"<string>\",\n \"nodeIds\": [\n \"<string>\"\n ],\n \"collapsed\": true\n }\n ]\n },\n \"message\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"agentId": "<string>",
"branchId": "<string>",
"revision": 123,
"versionId": "<string>",
"workflow": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}Authorizations
workspaceApiKeyworkspaceApiKeyHeader
Path Parameters
Body
application/json
⌘I
Replace a branch's workflow
curl --request PUT \
--url https://app.cntillion.com/api/v2/agents/{agentId}/branches/{branchId}/workflow \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"revision": 1,
"workflow": {
"nodes": [
{
"id": "<string>",
"type": "start",
"label": "",
"position": {
"x": 0,
"y": 0
},
"parentId": "<string>",
"edgeOrder": []
}
],
"edges": [
{
"id": "<string>",
"source": "<string>",
"target": "<string>",
"forward": {
"type": "none",
"label": ""
},
"backward": {
"type": "none",
"label": ""
},
"sourceExitId": "<string>",
"targetEntryId": "<string>"
}
],
"format": 1,
"preventInfiniteLoops": false,
"sensitiveVariables": [],
"groups": [
{
"id": "<string>",
"label": "<string>",
"nodeIds": [
"<string>"
],
"collapsed": true
}
]
},
"message": "<string>"
}
'import requests
url = "https://app.cntillion.com/api/v2/agents/{agentId}/branches/{branchId}/workflow"
payload = {
"revision": 1,
"workflow": {
"nodes": [
{
"id": "<string>",
"type": "start",
"label": "",
"position": {
"x": 0,
"y": 0
},
"parentId": "<string>",
"edgeOrder": []
}
],
"edges": [
{
"id": "<string>",
"source": "<string>",
"target": "<string>",
"forward": {
"type": "none",
"label": ""
},
"backward": {
"type": "none",
"label": ""
},
"sourceExitId": "<string>",
"targetEntryId": "<string>"
}
],
"format": 1,
"preventInfiniteLoops": False,
"sensitiveVariables": [],
"groups": [
{
"id": "<string>",
"label": "<string>",
"nodeIds": ["<string>"],
"collapsed": True
}
]
},
"message": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
revision: 1,
workflow: {
nodes: [
{
id: '<string>',
type: 'start',
label: '',
position: {x: 0, y: 0},
parentId: '<string>',
edgeOrder: []
}
],
edges: [
{
id: '<string>',
source: '<string>',
target: '<string>',
forward: {type: 'none', label: ''},
backward: {type: 'none', label: ''},
sourceExitId: '<string>',
targetEntryId: '<string>'
}
],
format: 1,
preventInfiniteLoops: false,
sensitiveVariables: [],
groups: [{id: '<string>', label: '<string>', nodeIds: ['<string>'], collapsed: true}]
},
message: '<string>'
})
};
fetch('https://app.cntillion.com/api/v2/agents/{agentId}/branches/{branchId}/workflow', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.cntillion.com/api/v2/agents/{agentId}/branches/{branchId}/workflow",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'revision' => 1,
'workflow' => [
'nodes' => [
[
'id' => '<string>',
'type' => 'start',
'label' => '',
'position' => [
'x' => 0,
'y' => 0
],
'parentId' => '<string>',
'edgeOrder' => [
]
]
],
'edges' => [
[
'id' => '<string>',
'source' => '<string>',
'target' => '<string>',
'forward' => [
'type' => 'none',
'label' => ''
],
'backward' => [
'type' => 'none',
'label' => ''
],
'sourceExitId' => '<string>',
'targetEntryId' => '<string>'
]
],
'format' => 1,
'preventInfiniteLoops' => false,
'sensitiveVariables' => [
],
'groups' => [
[
'id' => '<string>',
'label' => '<string>',
'nodeIds' => [
'<string>'
],
'collapsed' => true
]
]
],
'message' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.cntillion.com/api/v2/agents/{agentId}/branches/{branchId}/workflow"
payload := strings.NewReader("{\n \"revision\": 1,\n \"workflow\": {\n \"nodes\": [\n {\n \"id\": \"<string>\",\n \"type\": \"start\",\n \"label\": \"\",\n \"position\": {\n \"x\": 0,\n \"y\": 0\n },\n \"parentId\": \"<string>\",\n \"edgeOrder\": []\n }\n ],\n \"edges\": [\n {\n \"id\": \"<string>\",\n \"source\": \"<string>\",\n \"target\": \"<string>\",\n \"forward\": {\n \"type\": \"none\",\n \"label\": \"\"\n },\n \"backward\": {\n \"type\": \"none\",\n \"label\": \"\"\n },\n \"sourceExitId\": \"<string>\",\n \"targetEntryId\": \"<string>\"\n }\n ],\n \"format\": 1,\n \"preventInfiniteLoops\": false,\n \"sensitiveVariables\": [],\n \"groups\": [\n {\n \"id\": \"<string>\",\n \"label\": \"<string>\",\n \"nodeIds\": [\n \"<string>\"\n ],\n \"collapsed\": true\n }\n ]\n },\n \"message\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://app.cntillion.com/api/v2/agents/{agentId}/branches/{branchId}/workflow")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"revision\": 1,\n \"workflow\": {\n \"nodes\": [\n {\n \"id\": \"<string>\",\n \"type\": \"start\",\n \"label\": \"\",\n \"position\": {\n \"x\": 0,\n \"y\": 0\n },\n \"parentId\": \"<string>\",\n \"edgeOrder\": []\n }\n ],\n \"edges\": [\n {\n \"id\": \"<string>\",\n \"source\": \"<string>\",\n \"target\": \"<string>\",\n \"forward\": {\n \"type\": \"none\",\n \"label\": \"\"\n },\n \"backward\": {\n \"type\": \"none\",\n \"label\": \"\"\n },\n \"sourceExitId\": \"<string>\",\n \"targetEntryId\": \"<string>\"\n }\n ],\n \"format\": 1,\n \"preventInfiniteLoops\": false,\n \"sensitiveVariables\": [],\n \"groups\": [\n {\n \"id\": \"<string>\",\n \"label\": \"<string>\",\n \"nodeIds\": [\n \"<string>\"\n ],\n \"collapsed\": true\n }\n ]\n },\n \"message\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.cntillion.com/api/v2/agents/{agentId}/branches/{branchId}/workflow")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"revision\": 1,\n \"workflow\": {\n \"nodes\": [\n {\n \"id\": \"<string>\",\n \"type\": \"start\",\n \"label\": \"\",\n \"position\": {\n \"x\": 0,\n \"y\": 0\n },\n \"parentId\": \"<string>\",\n \"edgeOrder\": []\n }\n ],\n \"edges\": [\n {\n \"id\": \"<string>\",\n \"source\": \"<string>\",\n \"target\": \"<string>\",\n \"forward\": {\n \"type\": \"none\",\n \"label\": \"\"\n },\n \"backward\": {\n \"type\": \"none\",\n \"label\": \"\"\n },\n \"sourceExitId\": \"<string>\",\n \"targetEntryId\": \"<string>\"\n }\n ],\n \"format\": 1,\n \"preventInfiniteLoops\": false,\n \"sensitiveVariables\": [],\n \"groups\": [\n {\n \"id\": \"<string>\",\n \"label\": \"<string>\",\n \"nodeIds\": [\n \"<string>\"\n ],\n \"collapsed\": true\n }\n ]\n },\n \"message\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"agentId": "<string>",
"branchId": "<string>",
"revision": 123,
"versionId": "<string>",
"workflow": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}