SankeyKit logo SankeyKit Docs

Examples

curl, Node and Python examples for common tasks.

# Render and save a PNG

Render a small funnel and write the PNG to disk.

curl https://sankeykit.com/api/v1/render \
  -H "Authorization: Bearer sk_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "flows": [
      { "source": "Visitors", "target": "Signups", "value": 120 },
      { "source": "Signups", "target": "Paid", "value": 30 }
    ],
    "options": { "format": "png" }
  }' \
  -o chart.png

# Handling 429 and retrying

Read the Retry-After header (seconds) and wait before retrying, instead of hammering the endpoint.

# -i shows headers so you can read Retry-After on a 429
curl -i https://sankeykit.com/api/v1/render \
  -H "Authorization: Bearer sk_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "flows": [{ "source": "a", "target": "b", "value": 1 }] }'

# Reading remaining quota

Every response — success or error — includes the X-RateLimit-* headers.

curl -s -D - https://sankeykit.com/api/v1/render \
  -H "Authorization: Bearer sk_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "flows": [{ "source": "a", "target": "b", "value": 1 }] }' \
  -o /dev/null | grep -i x-ratelimit