Replace the draft diagram
Replaces the whole diagram. This is the autosave path, so a diagram that breaks rules is stored
anyway and comes back with save_state and violations. You never lose work, and publishing is
what refuses.
The one exception is a bot_link block naming its bot by uuid. We swap that uuid for the number
the runtime reads, so a uuid naming none of the brand's bots cannot be stored and the whole write
is refused with linked_bot_not_found. A jump that names its bot by number is stored as it comes.
Kept as you sent it, keys and all. Two things are added: isTarget: true, on any node that does
not already say whether a connection may end at it, and the number, channel family and name of
the bot each bot_link names by uuid.
Path Parameters
- Type: stringFormat: uuidbot
_id required
Body·
Either a
diagramto store, or asourceto take the diagram from — one or the other, not both. Only thediagrambranch is served: a body carryingsourceanswers400, sincediagramis required.Either a
diagramto store, or asourceto take the diagram from — one or the other, not both. Only thediagrambranch is served: a body carryingsourceanswers400, sincediagramis required.- Type:diagramrequiredProperties: 3
Your diagram, kept as you sent it: keys we do not model — notes, embedded bricks — come back untouched. The one thing we add is
isTarget: true, on any node that does not already say whether a connection may end at it.We read
nodesandconnectionsto check it. A diagram missing either is stored anyway and reported as breaking rules. When present, each must be an object keyed by id whose entries are objects: a list, or an entry that is not an object, is answered400keyed bydiagram.
Responses
- application/json
- application/json
- application/json
- application/json
- application/json
- application/json
- application/json
curl https://api.landbot.io/v0-alpha/bots/123e4567-e89b-12d3-a456-426614174000/draft \
--request PUT \
--header 'Content-Type: application/json' \
--header 'Authorization: Token YOUR_AGENT_TOKEN' \
--data '{
"diagram": {
"nodes": {
"hidden": {
"id": "hidden",
"path": "hidden",
"template": "hidden",
"params": {}
},
"welcome": {
"id": "welcome",
"path": "welcome",
"template": "var_text",
"params": {
"version": 3,
"text": "Hi! What is your name?",
"destination": "name"
}
}
},
"connections": {
"hidden.success--welcome": {
"id": "hidden.success--welcome",
"type": "success",
"sourcePath": "hidden",
"targetPath": "welcome"
}
}
}
}'
{
"data": {
"bot_id": "123e4567-e89b-12d3-a456-426614174000",
"diagram": {
"nodes": {
"hidden": {
"id": "hidden",
"path": "hidden",
"template": "hidden",
"params": {}
},
"welcome": {
"id": "welcome",
"path": "welcome",
"template": "var_text",
"params": {
"version": 3,
"text": "Hi! What is your name?",
"destination": "name"
}
}
},
"connections": {
"hidden.success--welcome": {
"id": "hidden.success--welcome",
"type": "success",
"sourcePath": "hidden",
"targetPath": "welcome"
}
}
},
"save_state": "IS_PRESAVED",
"has_unpublished_changes": true,
"violations": [
{
"code": "string",
"message": "string",
"block_id": null,
"param": null,
"connections": [
{
"source_path": "string",
"type": "string"
}
]
}
],
"required_tier": "sandbox",
"edited_at": "2026-09-16T09:18:19"
}
}