Diagram
Render a diagram via GET. Use type (mermaid, d2, …), query (source code), and format=png for ChatGPT. POST uses diagram_type and diagram_source instead.
Credit cost: 5 credits per call
type*stringDiagram language.
"mermaid""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*stringDiagram 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?stringUse png so ChatGPT can display the image. svg is for download or infinite scale.
"svg""svg""png""jpeg""pdf"fields?stringComma-separated list of response fields to return, with dot notation for nested fields (e.g. name,location.city).
is_async?booleanRun the request as a background job: the API answers 202 with a job_id to poll on GET /v1/jobs/{id}.
falsesoft_fail?booleanReturn HTTP 200 even when the request fails; the error is in the error field of the body.
falsediagram_type*stringDiagram language. POST field is diagram_type, not type. Example: mermaid.
"blockdiag""blockdiag""bpmn""bytefield""seqdiag""actdiag""nwdiag""packetdiag""rackdiag""c4plantuml""d2""dbml""ditaa""erd""excalidraw""graphviz""mermaid""nomnoml""pikchr""plantuml""structurizr""svgbob""symbolator""tikz""umlet""vega""vegalite""wavedrom""wireviz"diagram_source*stringDiagram source code. POST field is diagram_source, not query. Example: graph TD; A-->B
output_format?stringUse png so ChatGPT can display the image. POST field is output_format, not format.
"svg""png""svg""jpeg""pdf"Successful response
response?filebinarycurl -X GET 'https://api.chartquery.com/v1/diagram?type=mermaid&query=string&diagram_type=blockdiag&diagram_source=string'"string"