ChartQuery

Chart AI

GET
/v1/chart/ai

Describe a chart in plain English via GET and get a rendered image back. Powered by AI.

Credit cost: 10 credits per call

Authorization

ApiKeyAuth
headerx-api-key<token>

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

Query Parameters

prompt*string

Describe your chart in plain English (max 1000 chars). Be specific: mention chart type, data topic, colors, style.

raw_data?string

Raw data for the chart. URL-encoded string, CSV, or JSON. AI will parse and structure it.

Examples:

  • String: Jan: 12400, Feb: 18900, Mar: 15200
  • JSON array: [{"month":"Jan","a":120,"b":85},{"month":"Feb","a":145,"b":102}]
  • JSON object: {"Organic":38,"Paid":24,"Direct":18}

Limit: 10 000 characters / 500 items. Need more? Open a support ticket.

title?string

Override the chart title generated by AI.

subtitle?string

Override the chart subtitle.

legend?string

Legend position or visibility. Use "false" to hide.

Default"top"
Value in"top""bottom""left""right""chartArea""false"
format?string

Output format. Default: "png".

Default"png"
Value in"png""svg"
width?number

Image width in pixels (50–4000). Default: 1200.

height?number

Image height in pixels (50–4000). Default: 600.

background?string

Background color as a hex value. Default: #ffffff.

device_pixel_ratio?number

Device pixel ratio for the rendered image. Default: 1.

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.

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
labels?array<string>

Structured X-axis labels. Used as-is by the model.

datasets?array<>

Structured Chart.js datasets. Used as-is by the model.

Response Body

Successful response

response?stringapplication/json
Example Request
curl -X GET 'https://api.chartquery.com/v1/chart/ai?prompt=string'
Example Response
"(binary image/png: use directly in <img src=\"...\"> or download)"