Tools API Blog
Sign in Create account

JSON to chart

JSON to chart is an API that turns data into a chart image (bar, line, pie, doughnut or radar). Send your numbers as JSON and get back a ready-to-use image for an email, a report or a Slack message, with nothing to design by hand.

How it works

You send the chart type, the labels (X-axis categories, or the name of each slice) and one or more series of numbers, and get back the generated image: PNG by default, base64-encoded inside a JSON response.

Since the input is always a data structure, this tool only accepts a JSON body (there's no "paste the raw file" mode).

All you need

  • Your API key. Create it in your dashboard with "+ Create key". It's shown only once, so copy and save it.
  • In your automation platform, an "HTTP Request" step (n8n, Make, Zapier, Pipedream… all have one).
  • Your data as numbers: the tool does the rest.

How to use it in n8n (step by step)

In the HTTP Request node:

  • Method: POST
  • URL: https://api.cofferdock.com/chart
  • Send Headers: on → add two: x-api-key = your key, and Content-Type = application/json
  • Send Body: on → Body Content Type: JSON → { "type": "bar", "labels": ["Jan", "Feb", "Mar"], "series": [{ "name": "Sales", "data": [10, 20, 15] }] }

By default the response is already a JSON with the image as base64 inside the image field, so there's nothing else to change under Options → Response. If you'd rather get the image directly (to attach it as binary data), add "output": "binary" to the body and choose Response Format: File under Options → Response, same as other Cofferdock tools.

In Make (HTTP → Make a request module): same method and URL, Body type: Raw, Content type: JSON, with the same body.

Options (inside the JSON)

OptionDefaultWhat it does
type-Required. Chart type: bar, line, pie, doughnut or radar.
labels-Required. 1 to 50 strings: X-axis categories (bar/line) or the name of each slice/indicator (pie/radar).
series-Required. 1 to 10 series, each { "name": "...", "data": [...] } with as many numbers as labels. pie/doughnut only support 1 series.
title-Chart title (optional).
width / height800 / 500Size in pixels (between 200 and 2000).
formatpngpng or svg.
outputjsonjson (base64 image inside a JSON) or binary (the image directly).

What you get back

By default, a JSON with the image as base64: handy for using it right away in the next step of your flow (for example, embedding it in an email as data:image/png;base64,…) with no extra steps. With "output": "binary" you get the image directly, useful when the next step expects a binary file.