Chart API
Chart API · Guide

Add a chart to an HTML email

Email apps don't run JavaScript, so chart libraries can't draw inside an email. What works everywhere is an image: render the chart once, then put its URL in an <img> tag.

Orders this weekBar chart titled "Orders this week". Values: Mon: 42, Tue: 51, Wed: 47, Thu: 63, Fri: 70, Sat: 38, Sun: 29.Orders this week020406080MonTueWedThuFriSatSun42514763703829

1. Render the chart and get its link

Send your numbers to the API with your key. The JSON answer contains url: a signed, public link to exactly this chart that needs no key.

POST JSON · curl
curl -X POST "https://kitforge-chart-api.kitforgelabs.workers.dev/v1/chart?response=json" \
  -H "Authorization: Bearer YOUR_KEY" -H "content-type: application/json" \
  -d '{"type":"bar","title":"Orders this week","values":true,
       "labels":["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],
       "data":[42,51,47,63,70,38,29]}'
# -> {"url":"https://kitforge-chart-api.kitforgelabs.workers.dev/v1/chart?type=bar&…&sig=…", "svg":"<svg …", "charged":true, …}

2. Put the link in your email template

HTML email
<img src="{{chart_url}}" width="600" height="360"
     alt="Orders this week: Mon 42, Tue 51, Wed 47, Thu 63, Fri 70, Sat 38, Sun 29"
     style="display:block;max-width:100%;height:auto;border:0">
  • Always set width and height (600 × 360 is the default chart size) so the layout doesn't jump while images load.
  • Write the numbers into the alt text. Many people read email with images off; they still get the data.
  • Never put your API key in the email. The signed URL works without it, and the API refuses keys in URLs.

Which email apps show it

The chart is an SVG image. According to caniemail.com's tests, Apple Mail, Outlook (Windows, Mac, Outlook.com, iOS, Android), Yahoo, Samsung Email, Thunderbird, Proton Mail and Fastmail show SVG images; Gmail shows them too, after converting them to PNG on its side. Test with the email apps your readers use before a big send.

Good to know

  • Cost: one credit per new chart. Sending the same URL to 10,000 people costs nothing more: views are free and the image is cached for a year.
  • Dark mode: charts have their own light background by default, so they stay readable when an email app darkens the message. Add "theme":"dark" for dark templates.
  • Privacy: the numbers are part of the signed URL, like any image link. Don't chart data you wouldn't put in the email itself.
Try it free. Draw any chart in the playground (runs in your browser, no key), then get a free key for 50 charts. One Kitforge key also works for the Tech Stack API. Packs from $5 for 2,000 charts, pricing.

More guides: Charts in a README · Charts from AI assistants (MCP) · Charts in n8n