Skip to content
Connect an agent
Hosted diagrams and plans

Hosted diagrams

Publish a diagram and get a public link to its picture for a README, a pull request or a chat. It works over MCP (Model Context Protocol) and over REST.

For
  • Notion
  • Slack
  • Discord
  • Backstage
  • GitHub

TL;DR

QuestionAnswer
What is a hosted diagram?The SVG picture of a diagram, stored by Plotwork and served from a public link. Only pictures that Plotwork's own renderer drew are stored.
How do I publish one?Ask an agent connected to the hosted MCP server, which calls publish_diagram. Or send POST /v1/diagrams/publish with an API key.
Who can see the link?Anyone who has it. The link holds a long random token that cannot be guessed, and it does not name your account.
Can I keep a diagram private?Not with a personal link. Publish to an organisation instead: its diagrams have no public link, and only its members can open them.
Why did my publish go to an organisation?An organisation you belong to sends its members' diagrams to its private library. The answer names it and says why in routedBy. Send personal: true for a public link, unless the organisation requires its library. See Where members publish.
How long is it kept?On Free, 30 days after you last published it. On Pro, until you delete it. Publishing the same diagram again starts the time over.
What are the limits?Free hosts 25 diagrams and 10 MB. Pro hosts 2,000 diagrams and 1 GB. No single diagram may be larger than 2 MB.
How do I delete one?Press Delete on the Diagrams page of the portal, or ask an agent connected to the hosted MCP server, which lists your diagrams and calls delete_diagram once you name the one to delete. A deleted diagram can stay visible for up to an hour.
Can I protect a diagram from being deleted?Yes. Lock it in the portal. A locked diagram cannot be renamed, moved or deleted, by you, an agent or a script, until you unlock it. A lock does not stop the plan's expiry. See Lock a diagram.
Can I edit a diagram from its link later?Yes, if you published it with embedSource set to true. The source is then part of the picture, so anyone who has the link can read it. Without that option the source is not stored. See Editing an existing diagram.
Does an edit keep the link?The picture link does not: an edited diagram is a new picture with a new link. A stable link does: name it once, such as checkout-flow, publish each edit with that name, and the one address always shows the latest version. See Links that always show the latest version.
Can I embed a diagram in Notion or Backstage?Yes. Paste a stable link or a picture link into Notion as an image or an embed, and use the Backstage card for a service's page. See Embed a diagram in other tools.
Does the local server have this?No. The local server makes no network requests by default and stores no diagrams, so it has no publish_diagram tool. It has no list_diagrams or delete_diagram tool either.

1. How publishing works

StepWhat happens
1You send diagram source, and optionally a theme, a name, and a folder.
2Plotwork checks the source. Source with mistakes is refused with every mistake, its line, column and hint, as draw_diagram does.
3Plotwork draws the diagram with its own renderer.
4It stores the SVG and answers with the link.

There is no way to send SVG. The API refuses a field it does not know, so a request that carries an svg field fails with status 400 and nothing is stored.

A link looks like https://cdn.plotwork.dev/d/k3T9vQ1xZ0aB7cD2eF4gHw.svg. It serves the picture and nothing else.

Publishing the same source in the same theme again from the same account finds the diagram that is already stored. You get the same link, created is false, and the time it is kept starts over. Nothing is stored twice, so an agent that repeats a step does not use up your allowance. If Plotwork's renderer changes, the same source can draw differently and then gets a new link.

Each publish is one call toward your daily limit.

Embedded source

By default the diagram source is not stored: the hosted picture shows the text of the diagram, and Plotwork keeps nothing else of it. With embedSource set to true, the renderer writes the source into the picture's metadata, and the picture can then be read back by read_diagram, by POST /v1/diagrams/read, or by anyone who fetches the link. Three things follow:

  • The source is public. Anyone who has the link can read it, not only see the drawing. Do not set it for a diagram whose source must stay private.
  • The picture is bigger by about the size of the source, and the plan's size limit counts it.
  • The same diagram published with and without embedSource is two pictures, so it gets two links. Publishing it again with the same choice returns the same link.

Nothing sets embedSource for you. The privacy policy says the same. To change a diagram from its link, see Editing an existing diagram.

Folders

A diagram can be filed in a folder, such as Payments/Checkout. Pass folder when you publish, or move a diagram later with Move on the Diagrams page of the portal. A slash nests folders, up to five levels, and each name can be forty characters or fewer. A folder exists while it holds a diagram, so there is nothing to make or delete first. Folders are for your own tidiness: a folder is not part of the link, and nobody who has the link can see it.

Publishing the same diagram again with a different folder moves it and keeps its link. Leaving folder out keeps the diagram where it is.

2. Publish from an agent

The hosted MCP server has three tools that the local server does not: publish_diagram, list_diagrams and delete_diagram. This section is about publishing; List and delete from an agent covers the other two. Connect the hosted server with an API key or a browser sign-in, then ask in plain words:

text
Publish this diagram and give me the link.

The agent calls publish_diagram with the source it already has. It is told to publish only when you ask, because anyone who has the link can see the picture.

ArgumentRequiredMeaning
sourceyesDiagram source in the line format, the same as for draw_diagram. At most 50,000 characters.
themenolight or dark. Light when left out.
embedSourcenotrue writes the diagram source into the picture so it can be edited later with read_diagram. Off when left out. The source is then readable by anyone who has the link, so an agent sets it only when someone may want to edit the diagram, and the answer says it was set. See Embedded source.
namenoA label of at most 80 characters. It appears in your list and is the alt text of the Markdown image.
foldernoA folder to file the diagram in, such as Payments/Checkout. See Folders.
aliasnoThe name of a stable link, such as checkout-flow, which then shows this diagram and every later one published with the same name. Not with organization. See Links that always show the latest version.
organizationnoThe handle or id of an organisation. The diagram goes to that organisation's private library instead of a public link. An agent sets it only when you name an organisation. See Organisations.

The result starts with the link, then a Markdown image to paste, such as ![Login flow](https://cdn.plotwork.dev/d/k3T9vQ1xZ0aB7cD2eF4gHw.svg). It carries the same fields as the REST answer below, including locked and lockedAt, and adds markdown. When the diagram is locked, the result also says so and that only the time it is kept was refreshed. A refusal says which limit was reached, lists every mistake in the source, or says the diagram is locked.

With organization, the answer has no public link and no Markdown image, because an organisation diagram has none. It has private: true and a viewUrl, a page of the portal that needs a sign-in, and the same id, name, folder, bytes and expiresAt. Your own library's answer does not change.

With alias, the answer also has stableLink with the link's alias and url, and the Markdown image uses the stable link, so the image you paste keeps showing the latest version.

With embedSource, the answer also has sourceEmbedded: true and a line saying the source is part of the picture. Without it the answer is what it always was.

Every other tool of the hosted server only reads, except delete_diagram. publish_diagram stores a file, so your client may ask for your approval before it runs.

3. Publish over REST

Send the source in a JSON body, with your API key in the X-API-Key header. The command reads the key from the environment variable PLOTWORK_API_KEY, so replace nothing in it.

sh
curl -s -X POST https://api.plotwork.dev/v1/diagrams/publish \  -H "X-API-Key: $PLOTWORK_API_KEY" \  -H "content-type: application/json" \  -d '{"source":"flow \"Login\"\nnode user person \"User\"\nnode api service \"Auth API\"\nuser -> api : \"POST /login\"","theme":"light","name":"Login flow"}'

A new diagram answers 201. One that was already stored answers 200 with the same link. Add "embedSource":true to the body to write the source into the picture.

json
{  "id": "0b6f9a52-4d1e-4c7a-9f3e-6d2a1b8c5e70",  "url": "https://cdn.plotwork.dev/d/k3T9vQ1xZ0aB7cD2eF4gHw.svg",  "name": "Login flow",  "theme": "light",  "bytes": 8412,  "createdAt": 1791515700000,  "publishedAt": 1791515700000,  "expiresAt": 1794107700000,  "created": true,  "locked": false,  "lockedAt": null}
FieldTypeMeaning
idstringThe handle of the diagram in your list. It is not part of the link.
urlstringThe public link to the SVG.
namestring or nullThe label you gave, or null.
themelight or darkThe color scheme it was drawn in.
bytesintegerSize of the stored SVG.
createdAtintegerWhen it was first published, in milliseconds since the Unix epoch.
publishedAtintegerWhen it was last published. Publishing it again moves this.
expiresAtinteger or nullWhen it will be deleted, or null on a plan that keeps diagrams until you delete them.
createdbooleanTrue when this call stored a new diagram. False when it was already there.
lockedbooleanTrue while you have the diagram locked. See Lock a diagram.
lockedAtinteger or nullWhen it was locked, in milliseconds since the Unix epoch, or null when it is not locked.

These are the failures a client should expect. Every one uses the error envelope, and the errorCode is the field to branch on.

StatuserrorCodeWhat it means and what to do
400validation.failedThe body did not match: source is missing, a field is unknown, name is longer than 80 characters, or alias is not lower-case words joined by hyphens. Fix the body.
401auth.missing or auth.invalidThere is no API key, or it is wrong or revoked. Create a key in the portal.
403hosting.quota_exceededThe plan holds no more diagrams, or no more stable links. details says reason (count, bytes or stableLinks), the plan, the limit and what is used. Delete a diagram or a stable link, or upgrade.
413hosting.too_largeThe diagram draws larger than the plan hosts. details has its bytes and the limit. Simplify the diagram.
422diagram.invalidThe source has mistakes. details lists each with its line, column and hint.
429usage.daily_limit or rate_limitedThe daily limit is spent, or the per-minute limit is. See the daily call limit.
502upstreamThe diagram could not be stored. Try again.
503hosting.unavailableHosting is not set up on this server.

The publish endpoint page lists the request and the answer as the API describes them.

4. Limits

The limits are per account. They are the same numbers the API holds your account to.

LimitFreePro
Hosted diagrams252,000
Hosted storage10 MB1 GB
Largest hosted diagram2 MB2 MB
Kept after you last publish30 daysUntil you delete it
Links that always show the latest version3500

A refusal for a full allowance is checked at the moment you publish, so two publishes that arrive together cannot both pass. Plans and billing covers the other limits, and the Diagrams page of the portal shows how much of your allowance you have used.

5. How long a diagram is kept

PlanWhat happens
FreeA diagram is deleted 30 days after you last published it. Publishing the same diagram again moves that date out by a full 30 days.
ProA diagram stays until you delete it, and expiresAt is null.
You upgradeEvery diagram you already host stops expiring at once.
You move to FreeNothing is deleted at once. Each diagram that had no expiry gets a full 30 days from the change.

An expired diagram is removed by a clean-up that runs once a day, so a link can keep working a little past its expiry date.

Anyone who has the link can see the picture. Treat it as you would a public address: do not publish a diagram that must stay private, and do not paste the link where you would not paste the diagram itself.

The link cannot be guessed, and it does not name your account. The picture itself carries the diagram's id in a data-plotwork-id attribute on its root element. It is the same id the Diagrams page shows with Copy ID, and the one the API lists, moves and deletes a diagram by, so a copy of the file can be traced back to its diagram. The id is not your account id and it is not a secret: using it takes you, signed in, and for anyone else the API answers as if the diagram did not exist. Only you can list your diagrams: from the portal while you are signed in, or through an agent connected to your account with your key or your sign-in. The picture holds the text of the diagram, such as its node labels, so check what a diagram says before you share it.

A diagram published to an organisation is different. It has no public link, and only the organisation's signed-in members, and API keys that belong to the organisation or to a member, can open it.

7. Delete a diagram

Delete in the portal

  1. Sign in at app.plotwork.dev (opens in a new tab) and open the Diagrams page.
  2. Press Delete on the diagram, then confirm.

The link stops working. Anyone who has it sees a missing picture, and so does any README or page that embeds it. A copy can stay visible for up to an hour, because the picture is cached and Plotwork does not clear that cache for each delete.

The Diagrams page also lists every diagram with its size, when it was created, when it expires, and buttons that copy its link or its Markdown.

Deleting over REST needs your signed-in session, so a REST call with an API key cannot delete a diagram. An agent connected to the hosted MCP server can, with the tool described next, and only after you have named the diagram.

List and delete from an agent

Connect the hosted server with an API key or a browser sign-in, then ask in plain words:

text
Show me the diagrams I have published.

The agent calls list_diagrams, which reads and changes nothing, and tells you what is stored. Then name the one to remove:

text
Delete the Login flow diagram.

The agent calls delete_diagram with the id it got from the list. It deletes only the diagram you named, and tells you which one it deleted.

ToolArgumentRequiredMeaning
list_diagramsorganizationnoThe handle or id of an organisation, to list its private library. An agent sets it only when you name an organisation. Left out, your own library is listed.
list_diagramsfoldernoList only the diagrams filed in this folder and the folders inside it, such as Payments/Checkout.
list_diagramslimitnoHow many to list, from 1 to 50. The default is 20.
delete_diagramidyesThe id of the diagram, exactly as list_diagrams gave it. It is the same id that Copy ID shows on the Diagrams page.
delete_diagramorganizationnoThe handle or id of the organisation whose library holds the diagram. Left out, your own library is used.
delete_diagramconfirmyesMust be true. The agent sets it only after you have said, in the conversation, to delete that diagram by name.

The result of list_diagrams says whether the library is yours or an organisation's, how many diagrams it holds in all, and where the account stands against its plan. It lists each diagram with its id, name, folder, bytes, createdAt, publishedAt and expiresAt, whether the owner locked it (locked and lockedAt), and whether you may delete it (canDelete). A diagram in your own library has its public url; one in an organisation has its viewUrl and no public link. The result of delete_diagram has the id, deleted: true, private (true for an organisation's library) and how many diagrams remaining in that library.

QuestionAnswer
When does an agent delete a diagram?Only after you have said, in the conversation, which diagram to delete, by name. The tool tells the agent never to delete on a guess, in bulk, or to make room for a new diagram unless you asked.
What happens if my library is full?A publish is refused with hosting.quota_exceeded. The agent tells you, and offers three choices: delete a diagram you name, delete diagrams in the portal, or upgrade. It does not delete anything on its own to make room.
What does confirm do?It must be true, and a call without it is refused before anything is deleted. It is a check that the agent meant the call, in addition to your client's own approval for a tool that destroys something.
Who may delete a diagram?In your own library, you. In an organisation, the member who published it, an admin and the owner, and no reader. See Organisations. Plotwork decides, not the agent.
Can I undo a delete?No. The diagram, its file and its link are gone. Publish the diagram again to get a new picture and a new link.
What if I ask twice?The second call finds nothing to delete and is refused as not found.
Can an agent lock or unlock a diagram?No. A lock is set and lifted by you, in the portal.

Lock a diagram

A lock protects a diagram you want to keep. Lock it in the portal, and it cannot be renamed, moved or deleted, by you, by an agent acting for you, or by a script, until you unlock it. A delete is refused with hosting.diagram_locked, and the agent is told that nobody can delete the diagram until its owner unlocks it, and not to work around the lock. list_diagrams shows a locked diagram as locked.

QuestionAnswer
Who can lock or unlock a diagram in my own library?You, in the portal. An agent and an API key cannot.
Does publishing the same diagram again still work?Yes, when you give it no new name and no new folder, because that changes nothing a lock protects. A publish that would rename the diagram or file it in another folder is refused.
Does a lock keep a diagram past its expiry?No. A lock does not stop the plan's expiry, so a diagram that expires is still removed when its time is up. See How long a diagram is kept.
Does a lock keep my account from being deleted?No. Deleting your account deletes your diagrams, locked or not.

A picture link is per drawing: change the diagram and publish it, and you get a new picture at a new link. A stable link is a name you choose, such as checkout-flow, with an address of its own that always shows the diagram you last published under that name. Paste the stable link into a README, a wiki or a Notion page once, and every later version shows there by itself.

QuestionAnswer
How do I make one?Publish with alias set to a name: "alias": "checkout-flow" in the REST body, or ask an agent to publish with that alias. The answer has a stableLink with its url. In the portal, open Share on a diagram and point a link at it by name.
How do I update what it shows?Publish the edited diagram with the same alias. The link moves to the new picture and its address does not change. Pages that embed it show the new version within a minute.
What does the address look like?https://cdn.plotwork.dev/l/q3Zr8J1x0bWcVvKm2hT9pA.svg, beside the pictures. The part before .svg is a random token made for the link. It does not hold the name you chose, your account, or the token of any picture, so the address cannot be guessed and says nothing about you.
What does opening it do?It serves the picture the link shows now, as an SVG, with no redirect: Plotwork keeps a copy of that picture at the link's address and replaces it when you move the link. The copy may be cached for 60 seconds. An image tag, a README, Notion and curl get the SVG. A browser that opens it as a page shows the picture itself, not the viewer a picture link opens.
Does the copy count against my storage?No. It repeats a picture you already host and that is already counted.
What names are allowed?Lower-case letters and digits, in words joined by single hyphens, up to 60 characters. A name that breaks the rule is refused, never changed. Each name is yours alone: another account can use the same name for its own link.
Who can see the name?Only you. It is listed in your Diagrams, in the Share box and by list_diagrams, and is not part of the address or the picture.
What if the diagram it shows is deleted or expires?The link stays, its copy is removed, and its address answers "not found" until you publish with the name again, which brings the same address back, or delete the link. An expired diagram's copy is removed by the daily clean-up, like the picture.
How do I delete one?Press Remove beside it in the Share box, or call DELETE /user/stable-links/{id} with your session. The copy is deleted, and its address stops working once a cached copy runs out, within a minute. The diagram is not touched.
How many can I keep?Free keeps 3 and Pro keeps 500. Moving a link you already have never counts again. A new name past the limit is refused with hosting.quota_exceeded and reason stableLinks, and nothing is published.
Do organisation diagrams have them?No. An organisation's diagrams have no public address at all, so there is nothing for a stable link to point at. Share the diagram's page in the portal with members instead.

Publish over REST with an alias:

sh
curl -s -X POST https://api.plotwork.dev/v1/diagrams/publish \  -H "X-API-Key: $PLOTWORK_API_KEY" \  -H "content-type: application/json" \  -d '{"source":"flow \"Checkout\"\nnode cart service \"Cart\"\nnode pay service \"Payments\"\ncart -> pay","alias":"checkout-flow"}'

The answer is the usual one with a stableLink added:

json
{  "stableLink": {    "id": "8f3c2a10-5b7e-4d21-9c64-1a2b3c4d5e6f",    "alias": "checkout-flow",    "url": "https://cdn.plotwork.dev/l/q3Zr8J1x0bWcVvKm2hT9pA.svg",    "diagramId": "0b6f9a52-4d1e-4c7a-9f3e-6d2a1b8c5e70",    "createdAt": 1791515700000,    "updatedAt": 1791515700000  }}

From an agent, ask for the name in plain words, and ask for the same name every time you update the diagram:

text
Publish this diagram with the alias checkout-flow and give me the stable link.

GET /user/diagrams lists every stable link you keep under stableLinks, with the diagram each one shows, and list_diagrams shows each diagram's stable links beside its picture link.

9. Embed a diagram in other tools

ToolHow
NotionType /image, choose Embed link, and paste a stable link or a picture link. Notion shows the SVG, and a stable link shows each new version the next time the page loads. Pasting the link on its own line and choosing Embed works too.
Slack, Discord, wikisPaste the link. A tool that reads oEmbed asks Plotwork's oEmbed endpoint (below) and shows the picture; one that does not shows the link, and an image block that takes an address shows the picture.
BackstageIn TechDocs, use the Markdown image with a stable link, as in a README. For a card on a service's page, Plotwork's Backstage card shows a stable link, a picture link, or an SVG committed in the service's repository, named in the service's plotwork.dev/diagrams annotation. The card is not published as a package yet.
GitHub, a READMEUse the Markdown image the publish answer gives, with the stable link in it when you named one.

The oEmbed endpoint is GET https://api.plotwork.dev/oembed?url=<link>&format=json. It takes a stable link, a picture link, or a viewer page, and answers a photo with the picture's address, its width and height (scaled down to maxwidth and maxheight when you send them), the title "Diagram", and no author: a diagram's name is shown only to you. For a stable link the picture's address is the stable link itself, so an embed made from it keeps showing the latest version. Only format=json is answered, and a link that is not a Plotwork diagram, or shows nothing now, is a 404. The viewer page names the endpoint in its head, for tools that look there.

See also

DocWhy
Editing an existing diagramRead the source back from a link or a file, change it, and publish again
OrganisationsShare a private library of diagrams with a team, with no public link, and who may delete or lock a diagram there
Plans and billingWhat Free and Pro include, the daily limit and how to upgrade
Connecting an agentHow to connect the hosted server that has publish_diagram, list_diagrams and delete_diagram
MCP serverWhich tools the local and the hosted server offer
API referenceEvery endpoint, and the error envelope
Publish a diagram and get a linkThe publish endpoint as the API describes it
Point a stable link at one of your diagramsMake or move a stable link from your session
Describe a diagram link for an embedderThe oEmbed endpoint
Slack, email, Confluence, and NotionA PNG for a chat, and paste-ready text for a wiki