- Published on
Your SQL Results Now Come with Charts
Getting data out of a database has always been the first step. The harder part, the part that actually changes decisions, is making sense of what that data is telling you. A table of numbers is technically correct, but a chart that shows revenue climbing over the last six months tells a story that no spreadsheet row ever could. We have been thinking about this gap for a while, and today we are closing it.
Starting today, the Text2SQL external API can generate charts alongside your query results. When you send a natural language question to our API and the query comes back with results, you can now ask for a visualization in the same request. There is no second call to make, no charting library to install on your end, and no data to reshape. You add a single flag to your existing API call, and an SVG chart comes back in the response body, ready to embed, save, or display however you see fit.
The way it works under the hood is straightforward. Once your query runs and we have the result rows, an AI model looks at the columns and figures out what kind of chart makes sense. If you have dates on one axis and a numeric value on the other, it will probably pick a line chart. Categories with counts tend to become bar charts. Proportional breakdowns turn into pie charts. You can also tell it what you want — pass along a hint like "show this as an area chart" and it will follow your lead. The chart is then rendered entirely on the server using Apache ECharts in SSR mode. No DOM, no canvas element, no headless browser. Just a pure SVG string that comes back in the JSON payload.
We chose SVG deliberately. SVGs are resolution-independent, so they look sharp on a Retina display, in a PDF report, or on a dashboard projected onto a conference room screen. They are also lightweight and can be embedded directly into HTML without any additional requests. If you are building an internal tool or an automated report that runs on a cron job, this means you can go from a natural language question to a finished chart in a single HTTP call.
There are three ways to use charts depending on your workflow. The simplest is the new standalone endpoint at /api/external/generate-chart, where you pass in SQL or even pre-computed results and get back a chart. If you are already using our generate-sql endpoint, just add generateChart: true to your request and the chart will appear alongside the SQL output and results you already receive. The same flag works on generate-sql-multi for teams querying across multiple databases at once, with each connection getting its own independent chart.
We have been using this internally for the past few weeks and the thing that surprised us most is how much faster it makes the feedback loop. You ask a question, you see the answer, and you see the shape of the answer — all at once. There is no context-switching to another tool. We think it will make the API significantly more useful for anyone embedding Text2SQL into dashboards, Slack bots, scheduled reports, or any workflow where a picture genuinely is worth a thousand rows.
The charts API is available now on all plans that include API access. Each chart generation consumes one additional API credit on top of the base request, so you always know exactly what you are spending. Check out the full documentation to get started.