Skip to content
Connect an agent

Organisations

Restore a previous version of an organisation diagram

Makes the version the diagram's picture, with the checks and the answer of a save.

POST/orgs/{org}/diagrams/{id}/versions/{versionId}/restore

TL;DR

QuestionAnswer
What does it do?Restore a previous version of an organisation diagram.
What does it take?A JSON body of type RestoreDiagramVersionBody.
What does it return?Status 200 with a body of type EditedOrganisationDiagram.
What can go wrong?400 the body is not valid; 401 not signed in; 403 the role may not change this diagram (orgs.forbidden), the owner's plan does not include the editor (plan.editor_not_included), the picture does not fit the plan (hosting.quota_exceeded), or the request came from an origin that may not make changes; 404 no such organisation, diagram or version, or the caller is not a member; 409 locked (hosting.diagram_locked), saved since (diagram.version_conflict), or another diagram already has this picture (diagram.duplicate_content); 429 too many requests; 502 the diagram could not be stored; 503 organisations are not set up on this server. Every failure uses the one error envelope.

What it does

Makes the version the diagram's picture, with the checks and the answer of a save. The current picture becomes a version.

Path parameters

FieldTypeRequiredDescription
orgstringyesThe organisation's id or its slug.
idstringyes
versionIdstringyes

Request body

The body has the type RestoreDiagramVersionBody.

FieldTypeRequiredDescription
baseVersionintegeryesThe diagram's publishedAt (milliseconds since the epoch) when the editor loaded it. If the diagram was saved since, the answer is 409 diagram.version_conflict with details.currentVersion. minimum 0.

Responses

StatusMeaningBody
200The diagram as the list shows it.EditedOrganisationDiagram
400The body is not valid.ErrorResponse
401Not signed in.ErrorResponse
403The role may not change this diagram (orgs.forbidden), the owner's plan does not include the editor (plan.editor_not_included), the picture does not fit the plan (hosting.quota_exceeded), or the request came from an origin that may not make changes.ErrorResponse
404No such organisation, diagram or version, or the caller is not a member.ErrorResponse
409Locked (hosting.diagram_locked), saved since (diagram.version_conflict), or another diagram already has this picture (diagram.duplicate_content).ErrorResponse
429Too many requests.ErrorResponse
502The diagram could not be stored.ErrorResponse
503Organisations are not set up on this server.ErrorResponse

Response body

A 200 answer has the type EditedOrganisationDiagram.

FieldTypeRequiredDescription
idstringyesThe handle for the diagram in the routes below.
namestring | nullyesThe label given at publish, or null.
folderstring | nullyesThe folder it is filed in, such as Payments/Checkout, or null for the top level.
scheme"light" | "dark" | "auto"yesThe color scheme it was drawn in: light, dark, or auto.
bytesintegeryesSize of the stored SVG in bytes.
createdBystring | nullyesThe person it belongs to: the member who published it, or the person who connected the agent that did. Null when that account has left or an organisation key published it.
publishedVia"person" | "connection" | "key" | nullyesHow it was published: person (signed in, or with a key the person made), connection (an agent connected to the organisation, whose person is createdBy), or key (an organisation key from Keys and CI). Null for a diagram published before this was recorded.
publishedKeyobject | nullyesThe key behind a connection or an organisation key. Null for a person, and once the key no longer exists.
publishedKey.idstringyesThe key's id, as Keys and CI lists it. Never the key itself.
publishedKey.namestring | nullyesThe key's name, or null once the key is revoked.
publishedClientstring | nullyesThe client name the agent gave when it connected, such as Claude Code, for a connection only. at most 100 characters.
createdAtintegeryesWhen it was first published, in milliseconds since the epoch.
publishedAtintegeryesWhen it was last published, in milliseconds since the epoch. Publishing the same diagram again moves it.
expiresAtinteger | nullyesWhen it will be deleted, in milliseconds since the epoch, or null when the owner's plan keeps diagrams until they are deleted.
viewUrlstringyesA page in the portal that shows the diagram to a signed-in member. It is not a link anyone can open: an organisation's diagrams have no public address.
lockedbooleanyesTrue while the owner has the diagram locked: nobody can delete, rename or move it, its publisher and the owner included, until the owner unlocks it. A lock does not stop it expiring on a plan that expires diagrams.
lockedAtinteger | nullyesWhen the owner locked it, in milliseconds since the epoch, or null when it is not locked.
restrictedtruenoPresent, and true, when the owner has restricted this diagram's folder and the caller is allowed in it, so the portal can show it as locked. Absent otherwise. A diagram in a folder the caller may not use is not listed at all.
keepInsidetruenoPresent, and true, when the folder rule over this diagram keeps its diagrams inside: the svg route refuses ?download=1 and the copy route refuses a copy (403 orgs.folder_restricted). Absent otherwise.
shareOrganisationDiagramShareyesIts public link while the organisation shares it, or null. Only a diagram someone chose to share has one.
share.urlstringyesThe public address, {CDN_URL}/l/<token>.svg. Anyone with it can see the picture, without its source. It keeps showing the latest version when the diagram is edited, and never changes.
share.sharedAtintegeryesWhen the diagram was first shared, in milliseconds since the epoch.
keptbooleanyes"Keep": true when an owner or admin keeps it from the library retention. The plan's own retention still applies.
deletesAtinteger | nullyesWhen the retention deletes it, in milliseconds since the epoch: the nearer of the plan's expiry and "Delete library diagrams not updated for". Null when nothing will, and always null under a legal hold.
classificationClassificationyesA diagram's classification label: public, internal (the default, and what a diagram published before labels reads as) or confidential. Confidential is never shared publicly; under "Share only diagrams labelled Public" only public is.
pendingbooleanyesTrue while it is held for approval ("Publishing needs approval"): only its publisher and the approvers see it.
changePendingbooleanyesTrue while a new version of it waits for approval. The library shows this version until then.
seriesDiagramSeriesyesIts place in a series (the parts of one split import), or null when it is in none.
series.idstringyesThe series id the parts were published with.
series.indexintegeryesIts place in the series, from 1; 0 is the whole import combined into one diagram.
series.totalinteger | nullyesHow many parts the publisher said the series has, or null.
warningsDiagnostic[]yesQuality warnings from drawing the source, as draw_diagram gives them. Empty for a restore.
warnings[].code"E100" | "E101" | "E110" | "E111" | "E120" | "E121" | "E123" | "E124" | "E125" | "E130" | "E131" | "E132" | "E133" | "E134" | "E135" | "E136" | "E137" | "E138" | "E139" | "E140" | "W200" | "W201" | "W202" | "W203" | "W204" | "W205" | "W206" | "W207" | "W208" | "W209" | "W500" | "W600" | "W601" | "W700" | "W701" | "W702" | "W703" | "W704" | "W705" | "W706" | "W707" | "W708" | "W709" | "W710" | "M100" | "M101" | "M102" | "M103" | "M104" | "M110" | "M200" | "M201" | "M202" | "M203" | "M204" | "M205" | "M206" | "M207" | "M208" | "M209" | "M210" | "M211" | "M212" | "M213" | "M214" | "M215" | "M216" | "M217" | "M218" | "E300" | "E301" | "E302" | "E303" | "E304" | "W300" | "W301" | "W302" | "W303" | "M120" | "M220" | "M221" | "M222" | "E340" | "E341" | "E342" | "E343" | "E344" | "E345" | "W320" | "W321" | "W322" | "W323" | "M240" | "M241" | "M242" | "E360" | "E361" | "E362" | "E363" | "E364" | "E365" | "E366" | "E367" | "W330" | "W331" | "W332" | "W333" | "W334" | "M250" | "M251" | "E400" | "E401" | "E402" | "E403" | "W350" | "W351" | "W352" | "W353" | "M270" | "M271" | "E420" | "E421" | "E422" | "E423" | "E424" | "W360" | "W361" | "W362" | "W363" | "W364" | "M180" | "M280" | "M281" | "M282" | "E320" | "E321" | "E322" | "E323" | "E324" | "E325" | "E326" | "E327" | "E328" | "E329" | "E330" | "W310" | "W311" | "W312" | "W313" | "W314" | "M130" | "M131" | "M132" | "M230" | "M231" | "M232" | "M233" | "M234" | "M235" | "M236" | "M237" | "M238" | "E380" | "E381" | "E382" | "E383" | "W340" | "W341" | "W342" | "W343" | "M260" | "I100" | "I101" | "I102" | "I103" | "I104" | "I105" | "I200" | "I201" | "I202" | "I203" | "I204" | "I206" | "I207" | "R100" | "R101" | "R200" | "R201" | "R202" | "R203" | "R204" | "R205" | "R206" | "R207" | "S100" | "S200" | "S101" | "S102" | "S103" | "S104" | "S201" | "S202" | "S203" | "S204" | "S205"yesStable code to branch on; E-codes are errors, W-codes are warnings.
warnings[].severity"error" | "warning"yesErrors stop rendering; warnings never do.
warnings[].messagestringyesWhat is wrong, in one sentence.
warnings[].lineintegeryes1-based line in the submitted source. minimum 1.
warnings[].columnintegeryes1-based column in that line. minimum 1.
warnings[].lengthintegeryesNumber of characters the problem covers. minimum 1.
warnings[].hintstring | nullyesA concrete suggestion for fixing it, or null.
warnings[].fixobjectnoThe one certain fix, to apply as it is. Present only when exactly one fix is certain.
warnings[].fix.labelstringyesWhat the fix does, in a few words, for a button.
warnings[].fix.editsFixEdit[]yesThe edits, all against the source the diagnostic was found in.
changedbooleanyesFalse when the source draws the picture the diagram already has: nothing was stored and no version was kept.

See also

DocWhy
API referenceEvery endpoint, and the error envelope
SchemasEvery request and response type
Tool referenceThe operations as callable tools