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
- Sign in (a free account works).
- Open Account settings and find Render API.
- 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
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.svgUse the theme JSON exported from the editor (Export → Theme JSON), or leave out theme for the default style.
Send JSON from an application
{
"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
| Field | Values | Notes |
|---|---|---|
| diagram / code | Mermaid source | Required, up to 200,000 characters. Use diagram for a file upload or code in JSON. |
| theme | Theme JSON | Optional. 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. |
| format | svg, png | Optional. The default is svg. |
| scale | 1 to 4 | Optional PNG detail multiplier. The default is 2. |
| transparent | true, false | Optional. true leaves out the canvas background. |
| watermark | Object or null | Optional, 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.
{
"code": "flowchart LR\n A --> B",
"format": "png",
"watermark": {
"text": "Confidential",
"position": "bottom-right",
"opacity": 0.6,
"size": "small"
}
}{
"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
| Field | Values | Notes |
|---|---|---|
| text | Up to 100 characters | Give text or image, not both. Drawn in the theme’s node text colour. |
| image | PNG or SVG, as base64 | Up to 200 KB decoded. SVGs are cleaned first: scripts, event handlers, foreignObject and outside references are removed. |
| position | bottom-right, bottom-left, top-right, top-left, centre | Optional. The default is bottom-right. |
| opacity | 0.1 to 1 | Optional. The default is 0.5, or 0.2 when tiled. |
| size | small, medium, large | Optional, relative to the diagram. The default is medium. |
| tiled | true, false | Optional. 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, andX-Quota-Reset. - Each key can send up to 30 requests a minute.
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
200The rendered SVG or PNG.400/415The request is malformed, the watermark isn’t valid, or the content type isn’t supported.401The API key is missing, wrong, or revoked.403The diagram uses Gen AI icons, or the request has a custom watermark; both need Pro.413The request is over 2 MB or the diagram over 200,000 characters.422Mermaid could not read the diagram. The JSON body explains why.429Too many requests, or this month’s renders are used up. Check the quota headers.502Rendering failed on our side. Retry shortly.
More endpoints (same key)
| Endpoint | What it does | Notes |
|---|---|---|
POST /v1/validate | Checks Mermaid code: { "valid": false, "error": "…", "line": 3 } | JSON body { "code": "…" }. Uses one render when the code is valid. |
GET /v1/icons?q=postgres | Icon ids for rich nodes | Not counted against the quota. |
GET /v1/diagrams | Your projects and saved diagrams (no code) | Pro, with a key that may change saved diagrams. ?projectId= filters. |
GET /v1/diagrams/:id | One 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/diagrams | Saves 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/:id | Changes 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/account | The key’s plan, whether it includes Pro icons and saved diagrams, and this month’s renders and clean exports | Not 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.json | The Gen AI icon set, as Iconify JSON | Pro 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 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.
npx flowgraph-cli render docs --out-dir build/diagrams --theme theme.json
npx flowgraph-cli check docsOn 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.