canonical: https://jentic.com/apis/chartquery.com/chartquery

# ChartQuery API Reference

The ChartQuery API renders charts, diagrams, QR codes, barcodes, and thermal printer labels as PNG, SVG, JPEG, or PDF images from a JSON config or a plain-English prompt. Charts use Chart.js types such as bar, line, pie, radar, and scatter, and diagrams accept source in languages including Mermaid, D2, PlantUML, and Graphviz. Label endpoints compile, preview, parse, validate, and convert printer commands across languages such as ZPL, TSC, EPL, and CPCL. Any render can be saved with share to return view, render, and embed URLs that are public.

## For AI agents

Render Chart.js charts, Mermaid or PlantUML diagrams, QR codes, barcodes, and thermal printer labels as images, or generate a chart or diagram from a plain-English prompt.

## Scope

Does not store datasets, host dashboards, or send jobs to physical printers. Use for rendering charts, diagrams, QR codes, barcodes, and label commands only.

## Capabilities

- Render a Chart.js chart such as bar, line, pie, radar, or scatter from labels and datasets as a PNG or SVG
- Generate a chart or diagram from a plain-English prompt with the AI endpoints
- Render a diagram from Mermaid, D2, PlantUML, Graphviz, BPMN, or other diagram source
- Generate styled QR codes for URLs, text, vCards, or WiFi with colors, dot styles, and custom corners
- Create barcodes in formats such as code128, ean13, upca, itf14, and gs1-128
- Compile, preview, parse, validate, and convert thermal printer labels in ZPL, TSC, EPL, CPCL, and other languages
- Save a render with share and get public view, render, and embed URLs for it

## Use cases

### Agent-generated charts through Jentic

An AI agent summarising data for a user wants to show a chart, not a table. Through Jentic the agent searches for 'render a bar chart', receives the ChartQuery POST `/v1/chart` operation with its input schema, and sends type 'bar' with data labels and datasets and format 'png'. The image comes back ready to display, or with share set to true the agent gets a public URL to embed.

Example prompt: Call POST `/v1/chart` with type 'bar', title 'Q1 revenue', format 'png', and data with labels ['Jan','Feb','Mar'] and one dataset [12,15,9], then return the image

### Diagrams from source or prompt

A developer documenting a system wants diagrams rendered without installing Mermaid or PlantUML locally. POST `/v1/diagram` takes diagram_type and diagram_source and returns PNG, SVG, JPEG, or PDF via output_format. When only a description exists, POST `/v1/diagram/ai` takes a prompt and an optional diagram_type such as mermaid or d2 and returns the rendered diagram.

Example prompt: Call POST `/v1/diagram` with diagram_type 'mermaid', diagram_source 'graph TD; Start-->Review-->Done', and output_format 'png', then return the image

### QR codes and barcodes for products

A shop preparing packaging needs scannable codes. POST `/v1/barcode` takes data and a type such as ean13 or code128 and returns SVG or PNG, with options for bar_width, height, colors, and text position. POST `/v1/qrcode` encodes URLs, text, vCards, or WiFi credentials with colors, dot_type, and margin controls.

Example prompt: Call POST `/v1/barcode` with data '4006381333931', type 'ean13', and format 'png', then call POST `/v1/qrcode` with data 'https://example.com/product' and format 'png'

### Thermal label printing workflows

A warehouse moving between printer brands needs labels in a different command language. POST `/v1/label/convert` translates printer commands from one language to another (for example zpl to tsc), POST `/v1/label/validate` checks source before printing, and POST `/v1/label/compile` turns width and elements into printer commands for a chosen language. POST `/v1/label` previews the label as an image first.

Example prompt: Call POST `/v1/label/validate` with the ZPL source and language 'zpl', then POST `/v1/label/convert` with the same source, from 'zpl', and to 'tsc', and return the converted commands

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| POST | `/v1/chart` | Render a Chart.js image |
| POST | `/v1/chart/ai` | Generate a chart from a prompt |
| POST | `/v1/diagram` | Render a diagram from source |
| POST | `/v1/diagram/ai` | Generate a diagram from a prompt |
| POST | `/v1/qrcode` | Generate a QR code |
| POST | `/v1/barcode` | Generate a barcode |
| POST | `/v1/label/convert` | Convert printer commands between languages |
| GET | `/v1/chart/view/{id}` | View a saved chart |

## Key resources

- **Charts** — Chart.js renders from config or prompt, plus saved chart views and renders
- **Diagrams** — Diagram renders from Mermaid, D2, PlantUML, Graphviz, and other sources, or from a prompt
- **QR codes and barcodes** — Styled QR codes and barcodes in retail, logistics, and postal formats
- **Labels** — Thermal label compile, preview, parse, validate, and convert across printer languages

## AI readiness

This API is usable in Jentic One now. Its AI-readiness score against Jentic's framework shows where it stands today and where improvements would make it even easier for agents to use.

- **Score:** 58 / 100
- **Maturity:** Foundational
- **Dimensions:**
  - Foundational Compliance: 51 / 100
  - Developer Experience & Jentic Compatibility: 68 / 100
  - AI-Readiness & Agent Experience: 43 / 100
  - Agent Usability: 94 / 100
  - Security: 50 / 100
  - AI Discoverability: 66 / 100
- **View full report:** https://jentic.com/apis/chartquery.com/chartquery/scorecard
- **How the score is calculated:** https://docs.jentic.com/reference/api-readiness-framework/overview/
- **More about the dimensions:** https://docs.jentic.com/reference/api-readiness-framework/specification/#dimensional-model-overview

### Score it yourself

Every API in the directory is allowlisted, so you can re-score it with no key required.

- **Score your own API:** https://jentic.com/scorecard.md
- **Scoring CLI agent skill:** https://github.com/jentic/jentic-api-scorecard/blob/main/skills/jentic-api-scorecard/SKILL.md

```sh
npx @jentic/api-scorecard-cli score <openapi-url>
```

## Why Jentic

- **Setup:** Wiring ChartQuery by hand means knowing which operations take the x-api-key header, which fields go in a POST body versus a GET query (diagram_type versus type, output_format versus format), and polling jobs for slow renders. Through Jentic you install once, import ChartQuery from the API Directory, store the key once, and your agent calls it.
- **Permission scoping:** ChartQuery puts each tool in its own URL path (`/v1/chart`, `/v1/diagram`, `/v1/label/convert`), and saved renders sit under an id in the path, so a rule can limit your agent to the tools it needs. You choose the operations it may call, so higher-cost AI endpoints like POST `/v1/chart/ai` are not included unless you add them.
- **Credential handling:** Your ChartQuery API key is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'render a bar chart' or 'generate an EAN-13 barcode', and Jentic returns the matching ChartQuery operation with its input schema so the agent sends the right fields without browsing the reference docs.

## Related APIs

- **QuickChart API** — Chart.js chart images and QR codes from a URL or JSON config
- **Mermaid Chart API** — Mermaid diagram editing and rendering
- **QR Code API** — Simple QR code generation
- **CaptureKit API** — Screenshot webpages and extract their content

## FAQ

### What authentication does the ChartQuery API use?

The ChartQuery API declares one scheme, an API key in the `x-api-key` header (ApiKeyAuth). Per its OpenAPI spec the key is attached to the AI endpoints (GET and POST `/v1/chart/ai` and `/v1/diagram/ai`), GET `/v1/usage`, GET `/v1/stats`, and GET `/v1/jobs/{id}.` The chart, diagram, QR code, barcode, label, and saved-view operations are marked public in the spec, though their descriptions list credit costs, so check the ChartQuery docs for how those are billed.

### Which diagram languages does the ChartQuery API support?

POST `/v1/diagram` accepts a diagram_type including mermaid, d2, plantuml, graphviz, bpmn, c4plantuml, dbml, excalidraw, nomnoml, structurizr, and svgbob, among others in its enum. The AI endpoint POST `/v1/diagram/ai` picks between mermaid, d2, plantuml, and graphviz, or uses the one you set.

### Can I convert ZPL labels to another printer language with the ChartQuery API?

Yes. POST `/v1/label/convert` takes source, from, and to. The from language can be tsc, zpl, epl, cpcl, dpl, sbpl, or ipl, and the to language adds escpos and starprnt. Use POST `/v1/label/validate` first to check the source, and POST `/v1/label` to preview the result as an image.

### What are the rate limits for the ChartQuery API?

The OpenAPI spec does not specify rate limits; it lists credit costs per endpoint instead. Check the ChartQuery documentation at https://chartquery.com for current limits and plan details.

### How do I render a Mermaid diagram through Jentic?

Search Jentic for 'render a Mermaid diagram', load the POST `/v1/diagram` operation, and execute it with diagram_type 'mermaid', your diagram_source, and output_format 'png'. Set share to true if you want public view and embed URLs instead of the image. To run it on your own infrastructure, install Jentic One from its GitHub repo.

### Is there a ChartQuery MCP server?

You don't need an MCP server to give your agent ChartQuery. Jentic connects it directly from the API Directory: import it, store your API key once, and your agent finds the chart, diagram, QR, barcode, or label operation it needs on demand instead of carrying every tool definition in its context.

### Can I limit what my agent is allowed to do with the ChartQuery API?

Yes. For an agent that only draws charts and diagrams from data you give it, write a rule that allows POST `/v1/chart` and POST `/v1/diagram.` It can render those images, but the AI generation endpoints, which cost more credits, and the label tools stay outside its reach, and every call it makes is logged.
