ChartQuery

Diagram AI

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

Autorización

ApiKeyAuth
headerx-api-key<token>

Your API key. Include it in the x-api-key header for every request.

Parámetros de consulta

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.

Defaultfalse
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

Cuerpo de la respuesta

Successful response

response?stringapplication/json
Example Request
curl -X GET 'https://api.chartquery.com/v1/diagram/ai?prompt=string'
Example Response
"<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"600\" height=\"400\"> <!-- AI-generated diagram SVG --> </svg>"