save_diagram_scene
Overwrite a diagram's scene with a complete Excalidraw elements array to save manual layout or precise edits. Missing elements are deleted, so include everything you want to keep.
Instructions
Overwrite a diagram's scene with a full Excalidraw elements array. Use this for manual layout and precise edits (moving, restyling, relabeling, adding or removing specific elements).
IMPORTANT: this REPLACES the entire scene. Always call get_diagram_scene first, modify that array, and send back EVERY element you want to keep. Any element missing from the array is deleted. To remove an element you may also set "isDeleted": true on it.
When changing an element, bump its "version" and set a new random "versionNonce" so open editors pick up the change. Text inside a shape is a separate text element with "containerId" set to the shape id; arrows reference shapes via startBinding/endBinding and shapes list them in boundElements.
Existing embedded images (files) and appState are kept unless you pass new ones. If the diagram is open in a browser tab, unsaved edits there may overwrite this save.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| files | No | Optional embedded files map. Omit to keep the current files. | |
| appState | No | Optional appState (e.g. viewBackgroundColor). Omit to keep the current one. | |
| elements | Yes | The complete Excalidraw elements array for the diagram (not a partial patch). | |
| diagram_id | Yes | The diagram UUID to write |