Update Flow
/api/v1/ai-agents/{id}/flowReplaces the agent's whole draft flow. Customers are not affected until you Publish.
Because this is a full replace, send every node and edge. To change one prompt, Get Flow first, edit it, and send everything back. Builder-only settings (integration tools, layout) are kept for nodes whose id and type are unchanged.
Takes about 4 seconds.
Flow rules. Exactly one startingPoint, and it must connect to another node. Node and edge IDs must be unique, and every edge must point at existing nodes. Also follow the builder's wiring rules, which the API does not check: a humanAgentNode may only be reached from a conditionNode; a conditionNode has exactly one outgoing edge and never leads to another conditionNode; an agentNode never connects directly to a knowledgeBaseNode. Typical shape: startingPoint → agentNode → conditionNode → humanAgentNode.
Request
Authorization
Bearer Token
Provide your API token in the Authorization header. See Authentication to issue one.
Example:Authorization: Bearer ********************
idstringrequiredAI agent ID.
Example:6ad97ee52845b4f2c8daca55
modelstringrequiredA
slugfrom AI Agent → List Models that is notlegacy. Anything else is422.nodesarray[object]requiredEvery node of the flow (up to 200).
Child attributes
idstringrequiredYour own unique ID, e.g.
agent-main. Keep it stable across saves: settings added in the dashboard are kept per node ID.typestringrequiredstartingPointentry (exactly one per flow) ·agentNodethe AI that replies,instructionis its prompt ·conditionNodea decision,instructionis the condition in plain language ·humanAgentNodehands the chat to human agents (may only follow aconditionNode) ·knowledgeBaseNodeanswers fromknowledgeSourceIds.endingPoint,waitNodeandreplyCheckerNodeare best configured in the dashboard builder.Allowed values:"startingPoint", "agentNode", "conditionNode", "humanAgentNode", "knowledgeBaseNode", "endingPoint", "waitNode", "replyCheckerNode"
labelstringrequiredName shown in the dashboard builder.
positionobjectoptionalCanvas position. Optional; nodes are laid out left to right when omitted.
Child attributes
xnumberrequiredynumberrequired
instructionstringoptionalPlain text, newlines allowed. Prompt for
agentNode, condition forconditionNode, handoff note forhumanAgentNode. Use[contact name]for the customer's name.toolIdsarray[string]optionalIDs of tools already set up in this workspace (copy them from an existing flow). Unknown IDs are rejected with
422.knowledgeSourceIdsarray[string]optionalKnowledge base source IDs already set up in this workspace.
vectorStoreIdsarray[string]optionalOpenAI vector store IDs (
vs_...) attached in this workspace.correctionbooleanoptionalApply saved corrections.
correctionGroupIdsarray[string]optionalLimit corrections to these groups. Empty = all.
waitSecondsintegeroptionalwaitNodeonly: how long to wait.
edgesarray[object]requiredEvery edge of the flow (up to 500).
Child attributes
idstringrequiredUnique edge ID.
sourcestringrequiredNode ID the edge leaves.
targetstringrequiredNode ID the edge enters.
sourceHandlestring | nulloptionalReply-checker branch:
repliedortimeout. Otherwise omit.targetHandlestring | nulloptional
Responses
200The saved draft flow.
The saved draft flow.
requestIdstringrequiredUnique ID for this request. Quote it when reporting a problem.
dataobjectrequiredChild attributes
idstringrequiredFlow version ID.
statusstringrequiredAllowed values:"draft", "live"
versionstringrequireddraft, or the label given at publish.modelstringrequiredsavedAtstring | nulloptionalISO 8601.
nodesarray[object]requiredChild attributes
idstringrequiredYour own unique ID, e.g.
agent-main. Keep it stable across saves: settings added in the dashboard are kept per node ID.typestringrequiredstartingPointentry (exactly one per flow) ·agentNodethe AI that replies,instructionis its prompt ·conditionNodea decision,instructionis the condition in plain language ·humanAgentNodehands the chat to human agents (may only follow aconditionNode) ·knowledgeBaseNodeanswers fromknowledgeSourceIds.endingPoint,waitNodeandreplyCheckerNodeare best configured in the dashboard builder.Allowed values:"startingPoint", "agentNode", "conditionNode", "humanAgentNode", "knowledgeBaseNode", "endingPoint", "waitNode", "replyCheckerNode"
labelstringrequiredName shown in the dashboard builder.
positionobject | nulloptionalChild attributes
xnumberoptionalynumberoptional
instructionstringrequiredPlain text, newlines allowed. Prompt for
agentNode, condition forconditionNode, handoff note forhumanAgentNode. Use[contact name]for the customer's name.toolIdsarray[string]requiredIDs of tools already set up in this workspace (copy them from an existing flow). Unknown IDs are rejected with
422.toolsarray[object]requiredNames of the attached tools, read only. Send
toolIdswhen saving.Child attributes
idstringoptionalnamestring | nulloptionaldescriptionstring | nulloptional
providerToolsarray[object]requiredIntegration tools, read only. Attached in the dashboard and kept when you save, as long as the node
idandtypeare unchanged.Child attributes
idstring | nulloptionalnamestring | nulloptional
knowledgeSourceIdsarray[string]requiredKnowledge base source IDs already set up in this workspace.
vectorStoreIdsarray[string]requiredOpenAI vector store IDs (
vs_...) attached in this workspace.correctionbooleanrequiredApply saved corrections.
correctionGroupIdsarray[string]requiredLimit corrections to these groups. Empty = all.
waitSecondsinteger | nulloptional
edgesarray[object]requiredChild attributes
idstringrequiredUnique edge ID.
sourcestringrequiredNode ID the edge leaves.
targetstringrequiredNode ID the edge enters.
sourceHandlestring | nulloptionalReply-checker branch:
repliedortimeout. Otherwise omit.targetHandlestring | nulloptional
400Invalid body or parameters, e.g. an empty name, an unknown node type or a malformed ID.
Invalid body or parameters, e.g. an empty name, an unknown node type or a malformed ID.
messagestringrequired
401API key missing, invalid, revoked or expired.
API key missing, invalid, revoked or expired.
messagestringrequired
404No AI agent with this ID in your workspace.
No AI agent with this ID in your workspace.
messagestringrequired
422Flow rejected: problems lists graph errors, supportedModels is returned for an unknown or legacy model, and toolIds lists tools that are not in your workspace.
Flow rejected: problems lists graph errors, supportedModels is returned for an unknown or legacy model, and toolIds lists tools that are not in your workspace.
messagestringrequired
429Rate limit reached. Retry after a short pause.
Rate limit reached. Retry after a short pause.
messagestringrequired
502The AI agent service is temporarily unavailable. Retry shortly.
The AI agent service is temporarily unavailable. Retry shortly.
messagestringrequired