ChartQuery

Diagram

GET
/v1/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

Parámetros de consulta

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

Use png so ChatGPT can display the image. svg is for download or infinite scale.

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

If true, persist the result and return share URLs instead of an image. Leave false to get the image.

fields?string

Comma-separated list of response fields to return, with dot notation for nested fields (e.g. name,location.city).

is_async?boolean

Run the request as a background job: the API answers 202 with a job_id to poll on GET /v1/jobs/{id}.

Defaultfalse
soft_fail?boolean

Return HTTP 200 even when the request fails; the error is in the error field of the body.

Defaultfalse
diagram_type*string

Diagram language. POST field is diagram_type, not type. Example: mermaid.

Default"blockdiag"
Value in"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*string

Diagram source code. POST field is diagram_source, not query. Example: graph TD; A-->B

output_format?string

Use png so ChatGPT can display the image. POST field is output_format, not format.

Default"svg"
Value in"png""svg""jpeg""pdf"

Cuerpo de la respuesta

Successful response

response?file
Formatbinary
Example Request
curl -X GET 'https://api.chartquery.com/v1/diagram?type=mermaid&query=string&diagram_type=blockdiag&diagram_source=string'
Example Response
"string"