szum

Language Patterns

Call szum from any language that can make an HTTP request.

No SDK required. Here's how to render a chart from common languages.

Node / TypeScript

const config = {
  version: "2026-03-20",
  theme: "editorial",
  marks: [{ type: "barY", data: [{ x: "Q1", y: 42 }, { x: "Q2", y: 58 }] }],
};

const res = await fetch("https://szum.io/chart", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify(config),
});

const svg = await res.text();

Save to a file:

import { writeFile } from "node:fs/promises";

await writeFile("chart.svg", svg);

Python

import requests

config = {
    "version": "2026-03-20",
    "theme": "editorial",
    "marks": [{"type": "barY", "data": [{"x": "Q1", "y": 42}, {"x": "Q2", "y": 58}]}],
}

res = requests.post(
    "https://szum.io/chart",
    json=config,
    headers={"Authorization": "Bearer YOUR_API_KEY"},
)

with open("chart.svg", "wb") as f:
    f.write(res.content)

For PNG output, add "format": "png" to the config.

Go

package main

import (
	"bytes"
	"encoding/json"
	"io"
	"net/http"
	"os"
)

func main() {
	config := map[string]any{
		"version": "2026-03-20",
		"theme":   "editorial",
		"marks": []map[string]any{{
			"type": "barY",
			"data": []map[string]any{
				{"x": "Q1", "y": 42},
				{"x": "Q2", "y": 58},
			},
		}},
	}

	body, _ := json.Marshal(config)
	req, _ := http.NewRequest("POST", "https://szum.io/chart", bytes.NewReader(body))
	req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
	req.Header.Set("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)
	defer res.Body.Close()

	f, _ := os.Create("chart.svg")
	defer f.Close()
	io.Copy(f, res.Body)
}

Ruby

require "net/http"
require "json"
require "uri"

config = {
  version: "2026-03-20",
  theme: "editorial",
  marks: [{ type: "barY", data: [{ x: "Q1", y: 42 }, { x: "Q2", y: 58 }] }],
}

uri = URI("https://szum.io/chart")
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer YOUR_API_KEY"
req["Content-Type"] = "application/json"
req.body = JSON.generate(config)

res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }

File.write("chart.svg", res.body)

curl

curl -X POST https://szum.io/chart \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"version":"2026-03-20","marks":[{"type":"barY","data":[{"x":"Q1","y":42},{"x":"Q2","y":58}]}]}' \
  -o chart.svg

Embedding as an image

GET embeds are always keyless and follow the free tier path. Construct the URL directly – works anywhere images render:

<!-- HTML / Email -->
<img src='https://szum.io/chart?config={"version":"2026-03-20","marks":[{"type":"barY","data":[{"x":"Q1","y":42}]}]}' />
<!-- Markdown / GitHub README -->
![Chart](https://szum.io/chart?config=...)

On this page