ChartQuery

Chart

Credit cost: 5 credits per call

GET
/v1/chart

Query Parameters

query*string

Full chart config as URL-encoded JSON. Pass ?version= or ?v= separately to pin the chart version.

Bar chart (copy & paste as ?query=): {"type":"bar","title":"Monthly Sales","legend":"bottom","width":1200,"height":600,"device_pixel_ratio":1,"data":{"labels":["Jan","Feb","Mar","Apr","May","Jun"],"datasets":[{"label":"2025","data":[42,58,37,65,49,72],"backgroundColor":"rgba(99,102,241,0.85)"},{"label":"2026","data":[51,67,44,71,58,85],"backgroundColor":"rgba(249,115,22,0.85)"}]},"scales":{"y":{"beginAtZero":true}}}

Line chart (dual Y-axis): {"type":"line","title":"Revenue vs Conversion","legend":"top","width":1200,"height":600,"device_pixel_ratio":1,"data":{"labels":["Jan","Feb","Mar","Apr","May","Jun"],"datasets":[{"label":"Revenue (€)","data":[12000,18500,15200,21800,9300,17400],"borderColor":"#6366f1","tension":0.4,"fill":false,"yAxisID":"y"},{"label":"Conversion (%)","data":[3.2,4.1,2.8,5.0,1.9,3.7],"borderColor":"#f97316","tension":0.4,"fill":false,"yAxisID":"y2"}]},"scales":{"y":{"position":"left"},"y2":{"position":"right","grid":{"display":false}}}}

Stacked area chart: {"type":"area","title":"API Usage by Brand","legend":"top","width":1200,"height":600,"device_pixel_ratio":1,"data":{"labels":["Jan","Feb","Mar","Apr","May","Jun"],"datasets":[{"label":"CaptureKit","data":[12400,18900,14300,21500,9800,16200],"borderColor":"#6366f1","backgroundColor":"rgba(99,102,241,0.35)","tension":0.4,"stack":"total"},{"label":"ChartQuery","data":[3200,6900,11500,8300,14700,9800],"borderColor":"#22c55e","backgroundColor":"rgba(34,197,94,0.35)","tension":0.4,"stack":"total"}]},"scales":{"y":{"stacked":true,"beginAtZero":true}}}

Doughnut chart: {"type":"doughnut","title":"Traffic Sources","legend":"right","width":800,"height":500,"device_pixel_ratio":1,"data":{"labels":["Organic","Paid","Direct","Referral","Social"],"datasets":[{"data":[38,24,18,12,8],"backgroundColor":["#6366f1","#f97316","#22c55e","#ef4444","#eab308"],"borderWidth":2,"borderColor":"#ffffff"}]}}

Radar chart: {"type":"radar","title":"Performance v1 vs v2","legend":"top","width":800,"height":700,"device_pixel_ratio":1,"data":{"labels":["Speed","Reliability","Security","UX","Scalability"],"datasets":[{"label":"v1","data":[65,70,80,60,75],"borderColor":"#6366f1","backgroundColor":"rgba(99,102,241,0.25)"},{"label":"v2","data":[88,92,90,85,95],"borderColor":"#f97316","backgroundColor":"rgba(249,115,22,0.25)"}]}}

SVG output (add "format":"svg" to any example above for infinitely scalable output).

version?string

Chart.js version to use. Alias: ?v=. Only v4.x is supported. Defaults to the installed version (4.5.1). Example: "4", "4.5", "4.5.1". The installed version is always returned in the X-ChartJS-Version response header.

Default"4.5.1"
share?boolean

Set share: true to persist the chart and receive a JSON response with render_url and view_url instead of the image. render_url is a public direct image URL (embeddable in emails, iframes, Markdown). view_url is a shareable interactive HTML page. Free plan: expires after 3 days with watermark. Paid plan: expires after 6 months, no branding.

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/chart?query=string"
Empty
{
  "error": "Bad Request"
}
{
  "error": "Internal Error"
}