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

Body·

required
application/json

Responses

  • application/json
  • application/json
  • application/json
  • application/json
  • application/json
  • application/json
  • application/json
Request Example for put/bots/{bot_id}/draft
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"
  }
}