Skip to content
Connect an agent
Diagrams

Compare diagrams

Say what changed between two versions of a diagram.

POST/v1/diagrams/compare

TL;DR

QuestionAnswer
What does it do?Say what changed between two versions of a diagram.
Which tool does the same?compare_diagrams
What does it take?A JSON body of type CompareDiagramsInput.
What does it return?Status 200 with a body of type CompareDiagramsResponse.
What can go wrong?400 the body failed schema validation; 401 the api key is missing or not valid; 403 the account is on the free plan, which does not include the rest drawing and checking routes (plan.rest_not_included); 413 the body is larger than the size cap; 429 too many requests. Every failure uses the one error envelope.

What it does

Each side is diagram source, the text of a Plotwork SVG that carries its source, or a hosted link on the picture hosts. Answers with every statement added, removed, renamed, moved to another block, or changed, matched by id rather than by line, with counts, a plain-language summary for a pull request review, and with markdown true a block ready to paste as a comment. A side that gives no source is an answer, not an error. Lays nothing out.

Request body

The body has the type CompareDiagramsInput.

FieldTypeRequiredDescription
beforestringyesThe old diagram: source, the text of a Plotwork SVG that carries its source, or a cdn.plotwork.dev link. at least 1 character; at most 1000000 characters.
afterstringyesThe new diagram, in any of the same three forms. at least 1 character; at most 1000000 characters.
markdownbooleannoAlso return a Markdown block ready to paste as a pull request comment. default false.

Responses

StatusMeaningBody
200The changes, their counts, and the summary.CompareDiagramsResponse
400The body failed schema validation.ErrorResponse
401The API key is missing or not valid.ErrorResponse
403The account is on the Free plan, which does not include the REST drawing and checking routes (plan.rest_not_included).ErrorResponse
413The body is larger than the size cap.ErrorResponse
429Too many requests.ErrorResponse

Response body

A 200 answer has the type CompareDiagramsResponse.

FieldTypeRequiredDescription
samebooleanyes
beforeobjectyes
before.from"source" | "svg" | "url"yes
before.readbooleanyesFalse when no source could be read from it; message says why.
before.kindstring | nullyesA diagram kind: flow, sequence, schema, git, gantt, class, state, timeline, journey, mindmap, treemap, pie, quadrant, layers, c4, matrix, sankey, xychart, tree, or swimlane today. Later versions add kinds, so expect others.
before.validbooleanyes
before.messagestring | nullyes
afterobjectyes
after.from"source" | "svg" | "url"yes
after.readbooleanyesFalse when no source could be read from it; message says why.
after.kindstring | nullyesA diagram kind: flow, sequence, schema, git, gantt, class, state, timeline, journey, mindmap, treemap, pie, quadrant, layers, c4, matrix, sankey, xychart, tree, or swimlane today. Later versions add kinds, so expect others.
after.validbooleanyes
after.messagestring | nullyes
countsobjectyes
counts.addedintegeryes
counts.removedintegeryes
counts.renamedintegeryes
counts.movedintegeryes
counts.changedintegeryes
changesobject[]yes
changes[].change"added" | "removed" | "renamed" | "moved" | "changed"yes
changes[].subject"header" | "node" | "group" | "edge" | "row" | "series" | "line"yes
changes[].namestringyesThe id, the label in quotes, or for an edge its ends.
changes[].lineinteger | nullyesThe line in after, or in before for a removal.
changes[].detailstringyes
truncatedbooleanyesTrue when more changes were found than are listed; counts covers all of them.
summarystringyesThe changes in plain words, for a pull request review.
markdownstring | nullyes
nextstringyes

See also

DocWhy
API referenceEvery endpoint, and the error envelope
SchemasEvery request and response type
compare_diagramsThe same operation as an MCP tool
Tool referenceThe operations as callable tools