Render diagram code to svg, png or pdf
Renders the diagram code with Mermaid. By default the response body is the rendered bytes with the format's content type, for writing straight to disk; when the Accept header names application/json the body is an envelope with the same bytes as base64 and the metadata the headers carry, for an LLM tool call. Every answer that reached the Mermaid config, rendered or failed, carries x-mermaid-version and x-render-cache (hit when the render cache served it, miss when it was consulted, bypass when cache is false or the cache is disabled for the key); a rendered one x-diagram-type too. A request refused before that, for its key, a limit, or a body too large, not JSON or not the schema, carries neither. Invalid diagram code is 400 with the error object validate returns, position included, so one handler covers both endpoints; the effective config is not echoed. Costs 1 API credit (call class basic).
Request
- Base URL: https://api.mermaid.ai
- URL: https://api.mermaid.ai/v1/render
- Auth: HTTP bearer
Request body
Response
The rendered diagram: the bytes with the content type of the format, or the JSON envelope when the request accepts application/json.
Changes
No recorded changes to this operation across all 1 revision of this API.