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}/diagramsTL;DR
| Question | Answer |
|---|---|
| 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
| Field | Type | Required | Description |
|---|---|---|---|
org | string | yes | The organisation's id or its slug. |
Request body
The body has the type PublishOrganisationDiagramBody.
| Field | Type | Required | Description |
|---|---|---|---|
source | string | yes | Diagram source; the first line is the header, such as flow "Title" (draw_diagram lists every kind). at least 1 character; at most 120000 characters. |
settings | object | no | The repo's plotwork.config.json, if any. Schema: https://docs.plotwork.dev/schemas/plotwork.config.json (opens in a new tab). |
scheme | "light" | "dark" | "auto" | no | The color scheme to draw it in: light, dark, or auto (one picture that follows the viewer's light or dark setting). Light when left out. |
theme | "light" | "dark" | "auto" | no | The old name of scheme, still taken from callers that send it: light, dark, or auto. Send scheme instead; refused when both are sent and differ. |
embedSource | boolean | no | Write 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 (on unless the owner turned it off); false always leaves the source out. |
name | string | no | A 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. |
folder | string | null | no | The 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. at most 204 characters; pattern ^[A-Za-z0-9_-]+(?: [A-Za-z0-9_-]+)*(?:/[A-Za-z0-9_-]+(?: [A-Za-z0-9_-]+)*){0,4}$. |
classification | any | no | |
series | SeriesInput | no | Publish the diagram as one part of a series: the parts of one big import, such as an overview and one diagram per group, each published with the same id and its place, the overview first. The portal shows a series as tabs of one diagram and can open it on one board. A part published at a place another diagram of the series holds takes the place. Left out, a diagram's series is left as it is. Optional. |
series.id | string | yes | The series id, the same for every part: letters, digits, - and _, up to 64 characters. It names nothing outside your library or the organisation's. at least 1 character; at most 64 characters; pattern ^[A-Za-z0-9_-]+$. |
series.index | integer | yes | The part's place in the series, from 1 (the overview); 0 is the whole import combined into one diagram, at most one a series. minimum 0; maximum 1000. |
series.total | integer | no | How many parts the series has. Optional. minimum 1; maximum 1000. |
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | The diagram was already in the library; it was kept. | PublishedOrganisationDiagram |
| 201 | The diagram was stored. | PublishedOrganisationDiagram |
| 400 | The body failed schema validation. | ErrorResponse |
| 401 | Not signed in, or the key is not valid. | ErrorResponse |
| 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. | ErrorResponse |
| 404 | No such organisation, the caller is not a member of it, or the key belongs to another organisation. | ErrorResponse |
| 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. | ErrorResponse |
| 413 | The body is larger than the size cap, or the diagram renders larger than the plan hosts. | ErrorResponse |
| 422 | The diagram source has errors; the diagnostics are in details. | ErrorResponse |
| 429 | Too many requests, or the daily limit is used up. | ErrorResponse |
| 502 | The diagram could not be stored. | ErrorResponse |
| 503 | Organisations are not set up on this server. | ErrorResponse |
Response body
A 200 answer has the type PublishedOrganisationDiagram.
| Field | Type | Required | Description |
|---|---|---|---|
id | string | yes | The handle for the diagram in the routes below. |
name | string | null | yes | The label given at publish, or null. |
folder | string | null | yes | The folder it is filed in, such as Payments/Checkout, or null for the top level. |
scheme | "light" | "dark" | "auto" | yes | The color scheme it was drawn in: light, dark, or auto. |
bytes | integer | yes | Size of the stored SVG in bytes. |
createdBy | string | null | yes | The 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" | null | yes | How 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. |
publishedKey | object | null | yes | The key behind a connection or an organisation key. Null for a person, and once the key no longer exists. |
publishedKey.id | string | yes | The key's id, as Keys and CI lists it. Never the key itself. |
publishedKey.name | string | null | yes | The key's name, or null once the key is revoked. |
publishedClient | string | null | yes | The client name the agent gave when it connected, such as Claude Code, for a connection only. at most 100 characters. |
createdAt | integer | yes | When it was first published, in milliseconds since the epoch. |
publishedAt | integer | yes | When it was last published, in milliseconds since the epoch. Publishing the same diagram again moves it. |
expiresAt | integer | null | yes | When it will be deleted, in milliseconds since the epoch, or null when the owner's plan keeps diagrams until they are deleted. |
viewUrl | string | yes | A 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. |
locked | boolean | yes | True 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. |
lockedAt | integer | null | yes | When the owner locked it, in milliseconds since the epoch, or null when it is not locked. |
restricted | true | no | Present, 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. |
keepInside | true | no | Present, 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. |
share | OrganisationDiagramShare | yes | Its public link while the organisation shares it, or null. Only a diagram someone chose to share has one. |
share.url | string | yes | The 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.sharedAt | integer | yes | When the diagram was first shared, in milliseconds since the epoch. |
kept | boolean | yes | "Keep": true when an owner or admin keeps it from the library retention. The plan's own retention still applies. |
deletesAt | integer | null | yes | When 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. |
classification | Classification | yes | A 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. |
pending | boolean | yes | True while it is held for approval ("Publishing needs approval"): only its publisher and the approvers see it. |
changePending | boolean | yes | True while a new version of it waits for approval. The library shows this version until then. |
series | DiagramSeries | yes | Its place in a series (the parts of one split import), or null when it is in none. |
series.id | string | yes | The series id the parts were published with. |
series.index | integer | yes | Its place in the series, from 1; 0 is the whole import combined into one diagram. |
series.total | integer | null | yes | How many parts the publisher said the series has, or null. |
created | boolean | yes | True when this call stored a new diagram; false when the same diagram was already in the library and was kept. |
sourceEmbedded | boolean | yes | True when the stored picture carries the diagram source: the call sent embedSource true, or left it out while the organisation's keepEditable is on. |
approval | ApprovalHold | no | Present when the organisation's "Publishing needs approval" or "Public sharing needs approval" held this. It is data, not an error: the diagram is stored, and only its publisher and the approvers can see it until an approver approves. |
approval.state | "pending" | yes | |
approval.requestId | string | yes | The request, as the Approvals queue lists it. |
approval.kind | "publish" | "change" | "share" | yes | publish (a new diagram), change (a new version of one the library shows) or share (a public link). |
approval.expiresAt | integer | yes | When the daily sweep ends the request if nobody decides it, in milliseconds since the epoch: thirty days after it was made. |
approval.message | string | yes | One sentence to tell the person: held for approval by the organisation, and what happens next. |
approval.code | string | yes | The warning code a tool answer carries for it: W601. |
See also
| Doc | Why |
|---|---|
| API reference | Every endpoint, and the error envelope |
| Schemas | Every request and response type |
| Tool reference | The operations as callable tools |