Automation

Render API

Send Mermaid source and an optional Flowgraph Studio theme, and get back an SVG or PNG that matches the editor. Use it from build scripts, documentation sites, and internal tools.

Get an API key

  1. Sign in (a free account works).
  2. Open Account settings and find Render API.
  3. Create a key and copy it. It is shown once; revoke it there if it leaks.

Send the key with every request as Authorization: Bearer fg_…. Keep it on servers and in CI secrets, never in web pages.

Render endpoint

POSThttps://flowgraph.studio/v1/render

Send files with multipart form data or send a JSON body. The response body is the rendered image, with the matching image content type.

Upload Mermaid and a theme file

terminal
curl -X POST https://flowgraph.studio/v1/render \
  -H "Authorization: Bearer $FLOWGRAPH_API_KEY" \
  -F "diagram=@diagram.mmd;type=text/plain" \
  -F "theme=@theme.json;type=application/json" \
  -F "format=svg" \
  --output diagram.svg

Use the theme JSON exported from the editor (Export → Theme JSON), or leave out theme for the default style.

Send JSON from an application

request.json
{
  "code": "flowchart LR\n  A[Start] --> B[Review] --> C[Done]",
  "theme": { "presetId": "glass", "direction": "LR" },
  "format": "png",
  "scale": 2,
  "transparent": false
}

Post this object with Content-Type: application/json to the same endpoint.

Request fields

FieldValuesNotes
diagram / codeMermaid sourceRequired, up to 200,000 characters. Use diagram for a file upload or code in JSON.
themeTheme JSONOptional. An exported theme, or a partial one such as { "presetId": "midnight" }. Unknown keys and invalid values fall back to the preset. Code with its own %% flowgraph-theme: line (Export → Mermaid code keeps one) is drawn in that style instead.
formatsvg, pngOptional. The default is svg.
scale1 to 4Optional PNG detail multiplier. The default is 2.
transparenttrue, falseOptional. true leaves out the canvas background.
watermarkObject or nullOptional, Pro and Pro Max. Your own watermark over the diagram; see below. null or left out means none.

Your own watermark

On Pro and Pro Max, a render can carry your own watermark: a short text or a small PNG or SVG image, drawn over the diagram in SVG and PNG output, transparent ones included. The canvas size doesn’t change. Each request sets its own; there is no account default. On Free, a request with a watermark is refused with 403 and no render is used.

text watermark
{
  "code": "flowchart LR\n  A --> B",
  "format": "png",
  "watermark": {
    "text": "Confidential",
    "position": "bottom-right",
    "opacity": 0.6,
    "size": "small"
  }
}
image watermark, tiled
{
  "code": "flowchart LR\n  A --> B",
  "format": "svg",
  "watermark": {
    "image": "iVBORw0KGgoAAAANSUhEUgAA…",
    "tiled": true,
    "opacity": 0.2
  }
}

The image is the file’s bytes as base64 (shortened here), never a URL. In multipart requests, send watermark as JSON text, like theme.

Watermark fields

FieldValuesNotes
textUp to 100 charactersGive text or image, not both. Drawn in the theme’s node text colour.
imagePNG or SVG, as base64Up to 200 KB decoded. SVGs are cleaned first: scripts, event handlers, foreignObject and outside references are removed.
positionbottom-right, bottom-left, top-right, top-left, centreOptional. The default is bottom-right.
opacity0.1 to 1Optional. The default is 0.5, or 0.2 when tiled.
sizesmall, medium, largeOptional, relative to the diagram. The default is medium.
tiledtrue, falseOptional. true repeats it diagonally across the whole image, and position is ignored.

Bad values are answered with 400, and the JSON body lists every problem in problems.

Plans and limits

  • Free: 50 renders a month, with a small “Made with Flowgraph Studio” line below the diagram.
  • Pro: 5,000 renders a month, no watermark (or your own), and Gen AI icons.
  • Pro Max: 20,000 renders a month, plus everything in Pro.
  • Quotas reset on the first of each month (UTC). Failed renders are not counted.
  • Every response carries X-Quota-Limit, X-Quota-Remaining, and X-Quota-Reset.
  • Each key can send up to 30 requests a minute.
check your quota
curl https://flowgraph.studio/v1/usage -H "Authorization: Bearer $FLOWGRAPH_API_KEY"
# {"period":"2026-10","used":12,"limit":50,"resetsAt":"2026-11-01T00:00:00.000Z"}

Responses

  • 200 The rendered SVG or PNG.
  • 400 / 415 The request is malformed, the watermark isn’t valid, or the content type isn’t supported.
  • 401 The API key is missing, wrong, or revoked.
  • 403 The diagram uses Gen AI icons, or the request has a custom watermark; both need Pro.
  • 413 The request is over 2 MB or the diagram over 200,000 characters.
  • 422 Mermaid could not read the diagram. The JSON body explains why.
  • 429 Too many requests, or this month’s renders are used up. Check the quota headers.
  • 502 Rendering failed on our side. Retry shortly.

More endpoints (same key)

EndpointWhat it doesNotes
POST /v1/validateChecks Mermaid code: { "valid": false, "error": "…", "line": 3 }JSON body { "code": "…" }. Uses one render when the code is valid.
GET /v1/icons?q=postgresIcon ids for rich nodesNot counted against the quota.
GET /v1/diagramsYour projects and saved diagrams (no code)Pro, with a key that may change saved diagrams. ?projectId= filters.
GET /v1/diagrams/:idOne diagram with its code, theme, version, and kind (diagram for Mermaid; explainers, design documents and whiteboards have their own)Pro, same key. Diagrams in the Bin aren’t listed or returned.
POST /v1/diagramsSaves a new diagram: { "title", "code", "projectId"?, "theme"? }. A %% flowgraph-theme: line in the code becomes the diagram's theme and leaves the code, here and in PUT.Appears in the app within a minute.
PUT /v1/diagrams/:idChanges a diagram: { "baseVersion", "code"?, "title"?, "theme"? }baseVersion is the version you read. If the diagram changed since, the answer is 409 with the current version and nothing changes. The previous state stays in version history.
GET /v1/accountThe key’s plan, whether it includes Pro icons and saved diagrams, and this month’s renders and clean exportsNot counted against the quota. The owner’s name and email are included only for a key that may change saved diagrams.
GET /v1/exports/clean?content=Whether an image export of this content would carry the watermark, as in the app. content is the SHA-256 (hex) of the diagram’s code and style.POST with { "content" } uses one of the month’s clean exports, from the same allowance as the app; the same content counts once a month.
GET /v1/icons/advanced/genai.jsonThe Gen AI icon set, as Iconify JSONPro and Pro Max. Not counted against the quota.

Coding assistants (MCP)

Claude Code, Cursor, VS Code, and other MCP clients can use Flowgraph Studio at https://flowgraph.studio/mcp with the same key, or add that address with no key and sign in: the client opens an approval page, and the connection is then listed with your keys, where you can revoke it. Tools: validate_mermaid, render_diagram, search_icons, and, with a key that may change saved diagrams on Pro, list_diagrams, get_diagram, create_diagram, and update_diagram. The rich-node syntax is the resource flowgraph://guide/rich-nodes. render_diagram takes the same optional watermark object as the render endpoint.

Claude Code
claude mcp add --transport http flowgraph https://flowgraph.studio/mcp \
  --header "Authorization: Bearer $FLOWGRAPH_API_KEY"

Command line and CI

flowgraph-cli renders or checks every .mmd file and ```mermaid block in Markdown under a folder, and exits with an error naming the file and line when one fails. It reads the key from FLOWGRAPH_API_KEY, has no dependencies, and needs Node.js 20 or later. A full GitHub Actions example.

terminal
npx flowgraph-cli render docs --out-dir build/diagrams --theme theme.json
npx flowgraph-cli check docs

On Pro, render can add your own watermark: --watermark-text or --watermark-image logo.png, with --watermark-position, --watermark-opacity, --watermark-size, and --watermark-tiled (from flowgraph-cli 0.2.0).

flowgraph-cli code draws diagrams from source code on disk, with no key and no request: map, deps, routes, classes, calls and flow, for example npx flowgraph-cli code deps --out deps.mmd (from 0.2.0). In CI.