Diagram AI
Describe a diagram in plain English via GET and get a rendered image back. Powered by AI.
Credit cost: 10 credits per call
Authorization
ApiKeyAuth x-api-key<token>
Your API key. Include it in the x-api-key header for every request.
In: header
Query Parameters
prompt*string
Describe your diagram in plain English (max 1000 chars). Be specific: mention the diagram type, key entities, and relationships.
diagram_type?string
Preferred diagram language. AI chooses if omitted. Examples: "mermaid", "d2", "plantuml", "graphviz".
Default
"mermaid"Value in
"mermaid" | "d2" | "plantuml" | "graphviz"output_format?string
Output format. Default: "svg".
Default
"svg"Value in
"svg" | "png" | "jpeg" | "pdf"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. Paid plan: 6-month expiry.
Default
"false"Value in
"false" | "true"Response Body
application/json
application/json
application/json
application/json
application/json
application/json
curl -X GET "https://api.chartquery.com/v1/diagram/ai?prompt=string""<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"600\" height=\"400\"> <!-- AI-generated diagram SVG --> </svg>"{
"error": "Bad Request"
}{
"error": "Invalid API Key"
}{
"error": "Payment required"
}{
"error": "Rate limit exceeded for the API key: quota monthly"
}{
"error": "Internal Error"
}