Skip to content
Connect an agent
Organisations

Publish a diagram to an organisation

Renders the source and stores the SVG in the organisation's private library; there is no public link, only a viewUrl for signed-in members.

POST/orgs/{org}/diagrams

TL;DR

QuestionAnswer
What does it do?Publish a diagram to an organisation.
What does it take?A JSON body of type PublishOrganisationDiagramBody.
What does it return?Status 200 with a body of type PublishedOrganisationDiagram.
What can go wrong?400 the body failed schema validation; 401 not signed in, or the key is not valid; 403 the caller's role may not publish (orgs.forbidden), the folder is restricted to others (orgs.folder_restricted), the organisation's plan has no room for another diagram (hosting.quota_exceeded), or the request came from an origin that may not make changes; 404 no such organisation, the caller is not a member of it, or the key belongs to another organisation; 409 the diagram is already in the library and locked, and the publish names it or files it elsewhere (hosting.diagram_locked). only the owner can unlock it; 413 the body is larger than the size cap, or the diagram renders larger than the plan hosts; 422 the diagram source has errors; the diagnostics are in details; 429 too many requests, or the daily limit is used up; 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

Renders the source and stores the SVG in the organisation's private library; there is no public link, only a viewUrl for signed-in members. The same diagram published again keeps its place (200, created false) and moves its expiry out. 403 hosting.quota_exceeded carries the organisation's numbers; 413 hosting.too_large says the diagram is larger than the plan hosts.

Path parameters

FieldTypeRequiredDescription
orgstringyesThe organisation's id or its slug.

Request body

The body has the type PublishOrganisationDiagramBody.

FieldTypeRequiredDescription
sourcestringyesDiagram source; the first line is the header, such as flow "Title" (draw_diagram lists every kind). at least 1 character; at most 50000 characters.
settingsobjectnoThe repo's plotwork.config.json, if any. Schema: https://docs.plotwork.dev/schemas/plotwork.config.json (opens in a new tab).
theme"light" | "dark" | "auto"noThe color scheme to draw it in: light, dark, or auto (one picture that follows the viewer's light or dark setting). default "light".
embedSourcebooleannoWrite the diagram source into the stored SVG, in its metadata, so the diagram can be edited later; every member who can open it can then read the source. The same diagram published with and without it is two pictures. Left out, the organisation's keepEditable setting decides (false unless the owner turned it on); false always leaves the source out.
namestringnoA label for the diagram in your list and in the Markdown snippet. Optional. at least 1 character; at most 80 characters; pattern ^[^\p{Cc}]+$/u.
folderstring | nullnoThe folder to file the diagram in. Left out, a new diagram goes to the top level and a diagram that is already hosted stays where it is. A path files a new diagram there, or moves the one that is already hosted and keeps its link. null puts it at the top level.

Responses

StatusMeaningBody
200The diagram was already in the library; it was kept.PublishedOrganisationDiagram
201The diagram was stored.PublishedOrganisationDiagram
400The body failed schema validation.ErrorResponse
401Not signed in, or the key is not valid.ErrorResponse
403The caller's role may not publish (orgs.forbidden), the folder is restricted to others (orgs.folder_restricted), the organisation's plan has no room for another diagram (hosting.quota_exceeded), or the request came from an origin that may not make changes.ErrorResponse
404No such organisation, the caller is not a member of it, or the key belongs to another organisation.ErrorResponse
409The diagram is already in the library and locked, and the publish names it or files it elsewhere (hosting.diagram_locked). Only the owner can unlock it.ErrorResponse
413The body is larger than the size cap, or the diagram renders larger than the plan hosts.ErrorResponse
422The diagram source has errors; the diagnostics are in details.ErrorResponse
429Too many requests, or the daily limit is used up.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 PublishedOrganisationDiagram.

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.
theme"light" | "dark" | "auto"yesThe color scheme it was drawn in: light, dark, or auto.
bytesintegeryesSize of the stored SVG in bytes.
createdBystring | nullyesThe account that published it, or null when that account has left or an organisation key published it.
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.
createdbooleanyesTrue when this call stored a new diagram; false when the same diagram was already in the library and was kept.
sourceEmbeddedbooleanyesTrue when the stored picture carries the diagram source: the call sent embedSource true, or left it out while the organisation's keepEditable is on.

See also

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