ChartQuery

Chart

GET
/v1/chart

Render a Chart.js image via GET. Pass the full chart object as URL-encoded JSON in query. Prefer format png for ChatGPT. POST sends the same object as a JSON body, not query.

Credit cost: 5 credits per call

Abfrageparameter

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

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
type*string

Chart.js type. Required. Example: bar, line, pie. This is not a diagram type.

Default"area"
Value in"area""bar""bubble""doughnut""pie""line""mixed""polarArea""radar""scatter"
data*

Chart.js data. Required. Must include datasets (array of {label, data}). Optional labels.

title?string

Chart title.

subtitle?string

Chart subtitle.

legend?string

Legend position, or false to hide.

Default"top"
Value in"top""bottom""left""right""chartArea""false"
scales?

Chart.js scales keyed by axis id (y, y2, x, …).

options?

Raw Chart.js options. Merged on top of defaults.

width?number

Output width in pixels, 50-4000.

height?number

Output height in pixels, 50-4000.

format?string

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

Default"png"
Value in"png""svg"
background?string

Background color.

device_pixel_ratio?number

Device pixel ratio, 0.5-4.

Antworttext

Successful response

response?unknown*/*
Example Request
curl -X GET 'https://api.chartquery.com/v1/chart?query=string&type=area&labels=string&datasets=%5Bobject+Object%5D'
Example Response
null