Diagram Renderer: Mermaid & Graphviz to SVG, PNG, PDF
Pricing
from $8.00 / 1,000 diagram rendereds
Diagram Renderer: Mermaid & Graphviz to SVG, PNG, PDF
Turn Mermaid or Graphviz (DOT) code into SVG, PNG or PDF files with a hosted link. Batch up to 100 diagrams per run. Built for AI agents, docs pipelines and n8n/Make/Zapier flows. Pay only for diagrams that render.
Pricing
from $8.00 / 1,000 diagram rendereds
Rating
0.0
(0)
Developer
Mike Golay
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
12 days ago
Last modified
Categories
Share
Turn Mermaid or Graphviz (DOT) code into clean SVG, PNG or PDF files, each with a link you can share. Send one diagram or a batch of up to 100. Diagrams that fail to render are not charged, and the parser's error message comes back so you (or your AI agent) can fix the code and retry.
Made for:
- AI agents and MCP clients. LLMs write Mermaid well but can't display it. This Actor gives them an image URL.
- Docs and reporting pipelines that keep diagrams as code.
- n8n, Make, Zapier and Apify integrations that need a picture of a workflow, an architecture, or a data flow.
What it does
- You send diagram code, for example a Mermaid
flowchart, asequenceDiagram, or a Graphvizdigraph { ... }. - The Actor renders it in a locked-down renderer with no network access.
- Each file is saved to the run's key-value store. You get one dataset row per diagram containing the file
url,format,width,height,bytes, and anerrorCodeanderrorif it failed.
Supported diagram types
- Mermaid: flowchart/graph, sequence, class, state, entity-relationship, Gantt, pie, mindmap, timeline, user journey, Git graph, quadrant, XY chart, Sankey, block, packet, requirement, C4, architecture, kanban, radar, treemap, and the other diagram types Mermaid supports.
- Graphviz: the DOT language, with the
dot,neato,fdp,sfdp,circo,twopi,osageandpatchworklayout engines.
Engine auto-detection: code that starts with digraph { or graph { (including strict and named graphs) is treated as Graphviz. Everything else is treated as Mermaid. You can also set engine explicitly.
Input
One diagram
{"source": "flowchart LR\n A[Request] --> B{Cached?}\n B -->|yes| C[Return]\n B -->|no| D[Fetch] --> C","format": "png"}
A batch of diagrams
Top-level options act as defaults for every item, and each item can override them.
{"format": "svg","theme": "neutral","diagrams": [{ "id": "login-flow", "source": "sequenceDiagram\n User->>App: Log in\n App->>API: POST /session\n API-->>App: 200 OK" },{ "id": "deps", "source": "digraph { rankdir=LR; app -> api -> db; app -> cache }", "format": "png", "scale": 3 },{ "id": "schema", "source": "erDiagram\n CUSTOMER ||--o{ ORDER : places", "format": "pdf" }]}
| Field | Type | Default | Notes |
|---|---|---|---|
source | string | example flowchart | Code for one diagram. Ignored when diagrams is set. Max 50,000 characters. |
diagrams | array | — | Up to 100 items. Each item is an object or a plain string (treated as its source). |
id (item) | string | position (1, 2, …) | Used in the file name: diagram-<id>.<format>. |
engine | auto · mermaid · graphviz | auto | |
format | png · svg · pdf | png | PDF is one page, sized to the diagram. |
theme | default · neutral · dark · forest · base | default | Mermaid only. |
background | CSS color | white (dark grey for the dark theme) | e.g. transparent, #f5f5f5, rgb(0,0,0). |
scale | 0.5–4 | 2 | PNG pixel density. 2 gives sharp, retina-quality images. |
width | 16–8000 px | natural size | The height follows the aspect ratio. |
layout | dot · neato · fdp · sfdp · circo · twopi · osage · patchwork | dot | Graphviz only. |
Output
One dataset item per diagram:
{"id": "login-flow","index": 0,"ok": true,"engine": "mermaid","format": "svg","url": "https://api.apify.com/v2/key-value-stores/<storeId>/records/diagram-login-flow.svg","key": "diagram-login-flow.svg","contentType": "image/svg+xml","bytes": 24117,"width": 450,"height": 297,"renderMs": 182,"charged": true,"errorCode": null,"error": null,"warnings": []}
A failed diagram looks like this. It is not charged, and the rest of the batch keeps going:
{"id": "bad-one","ok": false,"url": null,"errorCode": "SYNTAX_ERROR","error": "Mermaid: Parse error on line 2:\n...A --> (((\n-------^\nExpecting 'SQS', 'DOUBLECIRCLESTART', ... got 'PS'","charged": false}
Error codes: SYNTAX_ERROR (fix the diagram code), INVALID_INPUT (a bad option value, or a remote image), LIMIT_EXCEEDED (input or output too large), TIMEOUT, RENDER_FAILED, STORAGE_FAILED.
The files are in the run's key-value store (Storage → Key-value store → Diagrams). A RUN_SUMMARY record holds the counts, charges and timings for the run.
Use it from the API
Call the synchronous endpoint to get the dataset rows (with file URLs) in a single request:
curl -X POST "https://api.apify.com/v2/acts/DryBoneslabs~diagram-renderer/run-sync-get-dataset-items?token=<YOUR_TOKEN>" \-H "Content-Type: application/json" \-d '{"source": "graph TD; A-->B; B-->C", "format": "png"}'
AI agents can also find and call the Actor through the Apify MCP server.
Pricing
Pay per event. You only pay for diagrams that render successfully.
| Event | Price |
|---|---|
| Diagram rendered (one SVG, PNG or PDF file) | $0.008 ($8 per 1,000) |
| Actor start | $0.00005 per run per GB of memory (one event at the default 1 GB; Apify's standard start fee) |
- Failed diagrams (syntax errors, invalid options, timeouts) are not charged.
- No platform usage fees on top: compute is included in the price.
- Max cost per run is respected. When your limit is reached, the Actor stops cleanly after the last paid diagram, and the remaining items are listed as skipped in the run summary.
Example: a batch of 50 PNG diagrams costs 50 × $0.008 = $0.40 (plus $0.00005 for the start).
Limits
| Limit | Value |
|---|---|
| Diagrams per run | 100 |
| Source size | 50,000 characters per diagram |
| PNG size | 16 megapixels, 8,000 px per side. Larger diagrams are scaled down automatically, with a warning. |
| Diagram size (PNG/PDF) | 16,000 px per side before scaling |
| File size | 20 MB |
| Time per diagram | 20 s. After 3 timeouts in a run, the remaining items are skipped (not charged). |
Security and privacy
- No network access while rendering. Diagram code cannot fetch URLs, call internal services or load remote images, fonts or stylesheets. Every request from the renderer is blocked.
- Mermaid runs with
securityLevel: "strict": HTML in labels is sanitized and click callbacks are disabled.%%{init}%%directives cannot change security settings. - Links are stripped from output files. External links, images, scripts and
@importrules are removed from SVG output, so the files are safe to embed. If a file had any removed, the item'swarningssay so. - Graphviz runs as WebAssembly with no access to the file system.
- Your diagram code is not logged or stored anywhere except your own run's storage.
FAQ
My Mermaid diagram fails with a syntax error, but it works on the Mermaid website.
This Actor uses Mermaid 12. Check the error text: it shows the line and the token the parser expected. Newer syntax may need a newer Mermaid version than the one you used elsewhere.
Can I use images or icons from URLs inside diagrams?
No. The renderer has no internet access, for security. Embed small images as data:image/png;base64,... URIs instead.
Why does my SVG look different in Inkscape, Word or PowerPoint?
Mermaid flowchart labels use HTML (foreignObject), which browsers display perfectly but some desktop apps don't. Use PNG or PDF for Office documents.
Do theme and background apply to Graphviz?
background does. theme is Mermaid-only, so style Graphviz with DOT attributes (node [style=filled, fillcolor="#e8f0fe"]).
How long do files stay available? As long as the run's storage is retained under your Apify plan's data retention. Download or copy files you want to keep.
Is this an official Mermaid or Graphviz product?
No. This Actor is an independent tool. It is not affiliated with or endorsed by the Mermaid or Graphviz projects. It uses the open-source Mermaid (MIT) and Graphviz (EPL, via the Apache-2.0 @hpcc-js/wasm-graphviz build) libraries.
Changelog
- 1.0: First release. Mermaid and Graphviz input; SVG, PNG and PDF output; batches of up to 100 diagrams; pay-per-event pricing.
