POST /api/v1/diagrams/:id/edits makes exact changes directly, as the canvas editor makes them: retype a label, recolour a box, a line or its text, change a font or size, hide or show a part, move a part, put it beside another, swap two, line parts up or space them evenly. It does not use the AI, answers in a few seconds, costs no credits, saves the result as the next version, and does not count as a new AI diagram. For anything else (new content, a different layout) ask for a change instead.
Wording is matched by the text itself. Everything else names parts by their ids, from the parts list:
id comes from what it is, so it stays the same through edits, and through a change from the AI that keeps the part:
Two parts with the same name are told apart in the order the diagram draws them:
text:total, text:total#2. A part’s position (0/2/1, its path) is accepted too.
By default the list has what a person points at: nodes (with their words), links, notes, cells, chart marks, titles and labels. Each has its kind (node, cell or note for parts diagramkit placed; link; mark; text, line, shape or box), a one-line summary, its first 40 characters of text, inner (how many parts sit inside it), and its box [left, top, width, height] in pixels in the wide layout (desktop, 900 px wide, as image.png draws it) and, where it shows, the compact layout (phone, 390 px). movable marks the parts that move; hidden marks a hidden part; offset is a moved part’s current offset per layout. detail=true lists what sits inside them too, each with its tag, its path and moves_with, the placed part it moves with. A large diagram lists its first 400 parts and says truncated.
layout is wide (desktop, the default), compact (phone) or both (each layout the part has). Lines follow a part that moves. Send at least one edit. Moves apply in this order: move, nudge, place, swap, align, distribute, each measuring the parts where the earlier ones left them, and the result’s moved gives each moved part’s new box per layout, so there is no need to list the parts again. A layout a diagram does not have (one drawn the same on desktop and phone has only wide) is refused with a message saying which to use.
Edits apply to the latest version, and wording is matched exactly, case included. Text the diagram works out from data, such as a chart’s axis values or a computed total, cannot be retyped: change the data with a revision. An unknown part id (the message lists ids of that kind), a part that cannot move, a part placed beside itself, or a change that would break the diagram answers 422 not_applied naming the part and the reason, and the diagram is left as it was. A diagram being made or changed answers 409 conflict.