Skip to content
Connect an agent
HTTP API

API reference

Check, render, and describe diagrams written in a small line-oriented language (flow, sequence, schema, git, gantt, class, state, timeline, journey, mindmap, treemap, pie, quadrant, layers, c4, matrix, sankey, xychart, tree, swimlane). Built for AI agents: every error carries a line, column, and fix hint, and the language reference is served as data. The same operations are available as MCP tools.

TL;DR

QuestionAnswer
What format?JSON in, JSON out. Every body is described by a schema, and each endpoint page links the ones it uses.
Where is the live spec?GET /openapi.json returns OpenAPI 3.1; GET /docs serves an interactive page.
What does an error look like?One envelope for every failure; see "Error envelope". A diagram with mistakes is a normal result from the validate route and a 422 from the render and outline routes.
Where does it run?The hosted API is at https://api.plotwork.dev, and every path below is relative to that address. Calling the drawing and checking routes needs an API key and the Pro plan.
Which endpoints draw diagrams?The ones under /v1: each serves a tool of the tool reference, and its page names the tool.

Endpoints

130 endpoints, each with a page of its own. They are grouped by what they do.

Diagrams

MethodPathWhat it does
POST/v1/diagrams/drawCheck, describe, and draw a diagram.
POST/v1/diagrams/editChange diagram source with small typed operations.
POST/v1/diagrams/convert-mermaidConvert one Mermaid diagram.
POST/v1/diagrams/validateCheck diagram source.
POST/v1/diagrams/renderRender diagram source to SVG.
POST/v1/diagrams/outlineDescribe diagram source as text.
POST/v1/diagrams/readRead the source back out of a Plotwork SVG.
POST/v1/diagrams/compareSay what changed between two versions of a diagram.
POST/v1/diagrams/suggestChoose the kind of diagram for a request.
POST/v1/importTurn a file of another format into a diagram.

Icons

MethodPathWhat it does
POST/v1/icons/mapChoose icons for many names at once.
GET/v1/iconsFind bundled icon names.

Markdown

MethodPathWhat it does
POST/v1/markdown/syncTurn a document's diagram fences into pictures.
POST/v1/markdown/planFind the sections of a document a picture would help.

Patterns

MethodPathWhat it does
POST/v1/patterns/findFind a ready-made architecture diagram.
POST/v1/patterns/getRead a pattern filled for a flavour.
POST/v1/patterns/drawFill a pattern and draw it.

Vocabulary

MethodPathWhat it does
GET/v1/vocabularyGet the diagram language reference.

Auth

MethodPathWhat it does
POST/auth/codeEmail a sign-in code.
POST/auth/verifySign in with a code.
POST/auth/logoutSign out.
POST/auth/sso/discoverAsk whether an address signs in with single sign-on.
POST/auth/sso/startStart signing in through an organisation's identity provider.
GET/auth/sso/callbackFinish signing in through an identity provider.
GET/auth/sso/saml/{org}/metadataRead an organisation's SAML service provider metadata.
POST/auth/sso/saml/{org}/acsFinish signing in through a SAML identity provider.

Keys

MethodPathWhat it does
GET/user/meRead the signed-in account.
GET/user/api-keysList your API keys.
POST/user/api-keysCreate an API key.
POST/user/api-keys/{id}/revealReveal an API key.
DELETE/user/api-keys/{id}Revoke an API key.
GET/user/usageRead the account's usage.

Connections

MethodPathWhat it does
POST/user/mcp/approveApprove a request to connect an agent.
GET/user/mcp/connectionsList the agents you have connected.
DELETE/user/mcp/connections/{keyId}Disconnect an agent.

Hosting

MethodPathWhat it does
POST/v1/diagrams/publishPublish a diagram and get a link.
GET/user/diagramsList your hosted diagrams.
PATCH/user/diagrams/{id}File a hosted diagram in a folder.
DELETE/user/diagrams/{id}Delete a hosted diagram.
PUT/user/diagrams/{id}/lockLock a hosted diagram.
DELETE/user/diagrams/{id}/lockUnlock a hosted diagram.
PUT/user/diagrams/{id}/sourceSave edited source over a hosted diagram.
GET/user/diagrams/{id}/versionsList a hosted diagram's previous versions.
POST/user/diagrams/{id}/versions/{versionId}/restoreRestore a previous version of a hosted diagram.
POST/user/stable-linksPoint a stable link at one of your diagrams.
DELETE/user/stable-links/{id}Delete a stable link.
GET/oembedDescribe a diagram link for an embedder (oEmbed).

Organisations

MethodPathWhat it does
GET/orgsList your organisations.
POST/orgsCreate an organisation.
GET/orgs/{org}Read an organisation.
PATCH/orgs/{org}Rename an organisation.
DELETE/orgs/{org}Delete an organisation.
GET/orgs/{org}/membersList an organisation's members.
PATCH/orgs/{org}/members/{userId}Change a member's role.
DELETE/orgs/{org}/members/{userId}Remove a member, or leave.
GET/orgs/{org}/invitesList an organisation's pending invitations.
POST/orgs/{org}/invitesInvite an address to an organisation.
DELETE/orgs/{org}/invites/{id}Revoke an invitation.
POST/orgs/invites/acceptAccept an invitation.
GET/orgs/{org}/diagramsList an organisation's diagrams.
POST/orgs/{org}/diagramsPublish a diagram to an organisation.
GET/orgs/{org}/diagrams/{id}/svgDownload an organisation diagram's SVG.
PATCH/orgs/{org}/diagrams/{id}File or rename an organisation diagram.
DELETE/orgs/{org}/diagrams/{id}Delete an organisation diagram.
PUT/orgs/{org}/diagrams/{id}/lockLock an organisation diagram.
DELETE/orgs/{org}/diagrams/{id}/lockUnlock an organisation diagram.
PUT/orgs/{org}/diagrams/{id}/sourceSave edited source over an organisation diagram.
GET/orgs/{org}/diagrams/{id}/versionsList an organisation diagram's previous versions.
POST/orgs/{org}/diagrams/{id}/versions/{versionId}/restoreRestore a previous version of an organisation diagram.
PUT/orgs/{org}/editableKeep an organisation's diagrams editable.
PUT/orgs/{org}/publishingChoose where an organisation's members publish.
GET/orgs/{org}/publishing/public-diagramsList members' public diagrams for review.
POST/orgs/{org}/publishing/public-diagrams/{id}/moveMove a member's public diagram into the library.
DELETE/orgs/{org}/publishing/public-diagrams/{id}Unpublish a member's public diagram.
GET/user/publishingRead where your publishes go.
PUT/user/publishingChoose your default organisation for publishing.
GET/orgs/{org}/folder-rulesList an organisation's folder rules.
PUT/orgs/{org}/folder-rulesRestrict a folder.
DELETE/orgs/{org}/folder-rulesRemove a folder's rule.
GET/orgs/{org}/keysList an organisation's API keys.
POST/orgs/{org}/keysCreate an organisation API key.
POST/orgs/{org}/keys/{id}/revealReveal an organisation API key.
DELETE/orgs/{org}/keys/{id}Revoke an organisation API key.
GET/orgs/{org}/brandRead an organisation's brand theme.
PUT/orgs/{org}/brandSave an organisation's brand theme.
DELETE/orgs/{org}/brandRemove an organisation's brand theme.
POST/orgs/{org}/brand/previewPreview brand colors.
GET/user/brandRead the brand of your own calls.
PUT/user/brandChoose the brand of your own calls.
GET/orgs/{org}/style-rulesRead an organisation's style rules.
PUT/orgs/{org}/style-rulesSave an organisation's style rules.
DELETE/orgs/{org}/style-rulesRemove an organisation's style rules.
GET/orgs/{org}/iconsList an organisation's custom icons.
PUT/orgs/{org}/icons/{name}Upload or replace a custom icon.
DELETE/orgs/{org}/icons/{name}Delete a custom icon.
GET/orgs/{org}/icons/{name}/previewPreview a custom icon in a diagram.
GET/orgs/{org}/avatarRead an organisation's avatar.
PUT/orgs/{org}/avatarUpload or replace an organisation's avatar.
DELETE/orgs/{org}/avatarRemove an organisation's avatar.
POST/orgs/{org}/drift/runsReport a drift run from CI.
GET/orgs/{org}/driftRead an organisation's drift dashboard.
GET/orgs/{org}/auditRead an organisation's audit log.
GET/orgs/{org}/audit/exportExport an organisation's audit log.
GET/orgs/{org}/ssoRead an organisation's single sign-on settings.
PUT/orgs/{org}/sso/connectionSet up an OpenID Connect identity provider.
PATCH/orgs/{org}/sso/connectionTurn single sign-on on or off, and set Require SSO and who joins on first sign-in.
DELETE/orgs/{org}/sso/connectionRemove the identity provider.
PUT/orgs/{org}/sso/samlSet up a SAML identity provider.
POST/orgs/{org}/sso/domainsAdd an email domain.
POST/orgs/{org}/sso/domains/{domain}/verifyCheck a domain's DNS record.
DELETE/orgs/{org}/sso/domains/{domain}Remove an email domain.
GET/orgs/{org}/scimRead an organisation's SCIM settings.
POST/orgs/{org}/scim/tokenMake or rotate the SCIM token.
DELETE/orgs/{org}/scim/tokenRevoke the SCIM token.
PATCH/orgs/{org}/scim/groups/{group}Choose the role a SCIM group gives.
GET/orgs/{org}/supportRead what priority support is for an organisation.
POST/orgs/{org}/support/requestsAsk the organisation's named contact for help.

Billing

MethodPathWhat it does
GET/user/billingRead the account's plan.
POST/user/billing/checkoutStart a checkout for a paid plan.
POST/user/billing/verify-checkoutRead a finished checkout back.
POST/user/billing/cancelCancel the plan at the end of the period.
POST/user/billing/resumeTake back a cancellation.
POST/user/billing/portalOpen the Stripe billing portal.
GET/user/billing/documentsList your invoices and receipts.
GET/user/billing/documents/{id}Read one invoice or receipt.
GET/user/billing/documents/{id}/pdfDownload an invoice or receipt as a PDF.
POST/billing/webhookReceive a Stripe event. Called by Stripe, not by clients.

Enterprise

MethodPathWhat it does
POST/enterprise/enquiriesSend an Enterprise enquiry.

Telemetry

MethodPathWhat it does
POST/telemetry/usageReceive the opt-in daily totals of the local npm package.

Health

MethodPathWhat it does
GET/healthCheck the service is up.

Error envelope

Every failure uses the same shape, so a client needs one error handler.

FieldTypeRequiredDescription
errortrueyesAlways true, so clients can branch without reading the status.
errorCodestringyesStable snake_case key such as validation.failed or diagram.invalid.
messagestringyesSafe, human-readable summary.
detailsanynoValidation issues or diagnostics, JSON-safe.
requestIdstringnoTrace id for correlating with logs.

See also

DocWhy
SchemasEvery request and response type
Tool referenceThe same operations as callable tools
Language referenceWhat the diagram source may contain
Writing diagramsThe language by example