QuickChart API Documentation

website·Indexed 41 days ago

https://quickchart.io/documentation/

An HTTP API for generating static images of Chart.js charts, QR codes, and barcodes, commonly used for embedding in email and production workflows.

Tokens
588
Snippets
3
Records
5
Agent score
25%

What's inside QuickChart

  1. Generate static images using the QuickChart API

    QuickChart is an HTTP API that generates static images of Chart.js charts, QR codes, and barcodes. It is ideal for environments where client-side rendering is unavailable, such as email, SMS, PDFs, and chatbots. For chart generation, send the Chart.js configuration in the chart field. If the configuration contains JavaScript functions, the chart field must be sent as a string. Use Authorization: Bearer YOUR_API_KEY or the key field for authenticated requests.
  2. Validate QR code payloads

    Use the /api/validate-qr endpoint to validate QR code parameters and receive structured JSON errors. After validation, send the same request body to /qr to receive the image bytes.
    POST https://quickchart.io/api/validate-qr
    {
      "text": "https://example.com",
      "format": "png",
      "size": 300,
      "margin": 4
    }
  3. Validate Chart.js configurations

    Before embedding a chart in a production workflow, use the /api/validate-chart endpoint to receive structured JSON errors and ensure the configuration is valid. Once validated, the same request body can be sent to /chart to receive the image bytes.
    POST https://quickchart.io/api/validate-chart
    {
      "version": "4",
      "width": 700,
      "height": 360,
      "format": "png",
      "chart": {
        "type": "bar",
        "data": {
          "labels": ["Jan", "Feb", "Mar"],
          "datasets": [{ "label": "Revenue", "data": [120, 150, 180] }]
        }
      }
    }
  4. Generate chart configurations from natural language

    The /natural/config endpoint allows you to generate a Chart.js configuration using a text description. The response provides a generated Chart.js config string, a saved chart image URL, and a chart editor URL. Generated configurations should be treated as drafts and validated via /api/validate-chart before production use.
    POST https://quickchart.io/natural/config
    {
      "description": "bar chart showing revenue Jan-Mar with values 120, 150, 180",
      "width": 700,
      "height": 360,
      "backgroundColor": "white"
    }
  5. Configure QuickChart API requests

    When making requests to QuickChart, follow these configuration guidelines:

    • Method: Prefer POST JSON over GET to avoid URL length limits and encoding issues.
    • Chart.js Version: Set version to "4" for Chart.js v4 syntax (defaults to v2).
    • Format: Set format to png by default. Other supported formats include svg, webp, jpg, pdf, and base64.
    • Dimensions: Explicitly include width and height when specific output dimensions are required.