ChartQuery

Diagram

Generate a diagram (SVG, PNG…) via GET using ?type=mermaid&query=...&format=svg.

Credit cost: 5 credits per call

GET
/v1/diagram

Query Parameters

type*string

Diagram language.

Default"mermaid"
Value in"mermaid" | "graphviz" | "plantuml" | "d2" | "svgbob" | "nomnoml" | "blockdiag" | "seqdiag" | "actdiag" | "nwdiag" | "bpmn" | "erd" | "excalidraw" | "ditaa" | "vega" | "vegalite" | "wavedrom" | "wireviz" | "c4plantuml" | "structurizr" | "tikz" | "pikchr" | "umlet" | "symbolator" | "packetdiag" | "rackdiag" | "bytefield" | "dbml"
query*string

Diagram source code (URL-encoded).

mermaid — flowchart: graph TD\n A[Start] --> B{OK?}\n B -->|yes| C[End]\n B -->|no| D[Error]

mermaid — sequence: sequenceDiagram\n Client->>API: GET /v1/diagram\n API-->>Client: 200 SVG

mermaid — ER: erDiagram\n USER ||--o{ ORDER : places\n ORDER ||--|{ ITEM : contains

graphviz: digraph G { rankdir=LR; A -> B -> C }

plantuml: @startuml\nA -> B: request\nB --> A: response\n@enduml

d2: Client -> API: POST /v1/diagram\nAPI -> SVG

svgbob: +-------+ +-------+\n| Box A |-->| Box B |\n+-------+ +-------+

nomnoml: [Client] -> [API]\n[API] -> [Handler]

format?string

Output format. Default: "svg".

Default"svg"
Value in"svg" | "png" | "jpeg" | "pdf"
share?boolean

Set share: true to persist the diagram and receive a JSON response with render_url and view_url instead of the image. render_url is a public direct image URL (no auth required, supports ?format= override). view_url is a shareable HTML page embeddable as an iframe. Free plan: expires after 3 days. Paid plan: expires after 6 months.

share?boolean

Set share=true to persist the config and receive JSON instead of an image: { id, render_url, view_url, embed_url, expires_in }. Free plan: 3-day expiry with watermark. Paid plan: 6-month expiry, no branding.

Default"false"
Value in"false" | "true"

Response Body

application/json

application/json

curl -X GET "https://api.chartquery.com/v1/diagram?type=mermaid&query=string"
Empty
{
  "error": "Bad Request"
}
{
  "error": "Internal Error"
}