diagrams

renderDiagram

Generate a diagram from its DSL/code and get the IMAGE back — WITHOUT inserting it into any document or whiteboard. For acting as a pure diagram generator. Provide diagramType (e.g. 'default', 'mermaid', 'd2', 'plantuml', 'graphviz', 'bpmn', 'vegalite'; call listDiagramTypes for the full set) and source (the diagram code). Choose format 'png' (default), 'jpeg', or 'svg'; for raster choose scale 1/2/3 for 1x/2x/3x; optional background (png only). Returns a TEMPORARY imageUrl that stays available for 1 hour (the render is then deleted), and for png/jpeg the image inline so you can see it. The link carries no signing token, so it survives being rendered as a citation. To render a diagram that already lives in a document/whiteboard use getDiagramImage; to persist a new one use insertDiagramInDocument or insertWhiteboardDiagram.

post/tools/renderDiagram

Request

  • Base URL: https://api.stablebaseline.io/functions/v1/cloud-serve/api/v1
  • URL: https://api.stablebaseline.io/functions/v1/cloud-serve/api/v1/tools/renderDiagram
  • Auth: HTTP bearer

Request body

diagramTypestring required

Diagram language, e.g. 'default', 'mermaid', 'd2', 'plantuml', 'graphviz', 'bpmn', 'vegalite'. For a diagram family, use its defaultRenderer from listDiagramTypes.

sourcestring required

The diagram DSL / code to render. For 'default', provide MDP JSON with stable IDs and omit entity x/y for automatic layout; fully positioned manual sources remain valid; icons must be exact iconKey values from listArchitectureIcons. For 'infographic', provide a plain-English description instead (the system designs the infographic from it).

format'png' | 'jpeg' | 'svg'

png (default) or jpeg = raster; svg is scalable. A platform default diagram's SVG contains a browser foreignObject scene, so use PNG/JPEG where foreignObject SVG is unsupported.

scale1 | 2 | 3

Raster resolution multiplier 1x/2x/3x (default 2). Ignored for svg.

backgroundstring

Background for png/jpeg, e.g. '#ffffff' or 'transparent' (png only).

applyBrandThemeboolean

Brand theming is ON BY DEFAULT: the effective BRAND KIT (colours only — typefaces are never injected) is baked into the diagram before rendering (cascade: brandKitId override → project default → workspace default → org default → the built-in Stable Baseline theme). Set false to render with the library's stock styling instead. Themable types: mermaid, plantuml, graphviz, d2, systemsarchitecture, vega, vegalite, infographic — other types always render unchanged. Author theming in the DSL wins (an existing mermaid %%{init}%%, plantuml !theme, d2 vars.d2-config, or a hand-written infographic palette is never overridden).

brandKitIdstring

Optional brand kit UUID (see listBrandKits) to theme with instead of the cascade default. Must belong to your organisation.

projectIdstring

Optional project UUID used to resolve the project → workspace → org brand-kit cascade. Without it the built-in Stable Baseline brand themes the render.

Response

Tool result (shape varies per tool — refer to the tool's docs for the exact return value).

object required

Changes

No recorded changes to this operation across all 1 revision of this API.