SankeyKit logo SankeyKit Docs

Render reference

POST /api/v1/render — full request and response reference.

#Request

POST https://sankeykit.com/api/v1/render
Authorization: Bearer sk_live_YOUR_KEY
Content-Type: application/json

The body is JSON. flows is the only required field in the payload.

#Minimal request

{
	"flows": [
		{ "source": "Visitors", "target": "Signups", "value": 120 },
		{ "source": "Signups", "target": "Paid", "value": 30 }
	]
}

#Full request

Every field the schema accepts, used at once:

{
	"flows": [
		{
			"source": "a",
			"target": "b",
			"value": 2,
			"previousValue": 4
		},
		{
			"source": "a",
			"target": "c",
			"value": 1,
			"previousValue": 2
		},
		{
			"source": "b",
			"target": "d",
			"value": 1,
			"previousValue": 2
		},
		{
			"source": "b",
			"target": "e",
			"value": 1,
			"previousValue": 2
		}
	],
	"options": {
		"width": 901,
		"height": 500,
		"nodeWidth": 21,
		"nodePadding": 48,
		"snapEndNodes": true,
		"canvasBackground": "#FFFFFF",
		"nodeHeightScale": 0.46,
		"labelStyle": {
			"fontFamily": "'JetBrains Mono', monospace",
			"position": "left",
			"background": "#000000",
			"backgroundOpacity": 0.75,
			"layout": "compact",
			"title": {
				"show": true,
				"color": "#FFFFFF",
				"size": 8
			},
			"subtitle": {
				"show": true,
				"color": "#FFFFFF",
				"size": 8
			},
			"value": {
				"show": true,
				"color": "#FFFFFF",
				"size": 8,
				"prefix": "$",
				"suffix": "M",
				"decimals": 0
			},
			"previousValue": {
				"show": true,
				"color": "#FFFFFF",
				"size": 8,
				"prefix": "$",
				"suffix": "Y/Y",
				"mode": "absolute"
			}
		},
		"chartTitle": {
			"text": "Title",
			"size": 46,
			"color": "#FF0000",
			"align": "right"
		},
		"chartSubtitle": {
			"text": "Subtitle",
			"size": 10,
			"color": "#FF0000",
			"align": "right"
		},
		"chartFooter": {
			"text": "Footer",
			"size": 11,
			"color": "#000000",
			"align": "left"
		},
		"theme": "pastel",
		"colorPalette": [
			"#f9a8d4",
			"#fca5a5",
			"#fdba74",
			"#fde68a",
			"#bbf7d0",
			"#a5f3fc",
			"#bfdbfe",
			"#ddd6fe",
			"#fbcfe8",
			"#d9f99d"
		]
	},
	"nodeOverrides": [
		{
			"id": "a",
			"label": "aa",
			"color": "#F163EE",
			"subtitle": "A"
		},
		{
			"id": "b",
			"label": "bb",
			"color": "#63F1E6",
			"subtitle": "B",
			"yOffset": 100.11190795898438
		},
		{
			"id": "c",
			"label": "cc",
			"color": "#F163A7",
			"subtitle": "C",
			"yOffset": -40.38221740722656
		},
		{
			"id": "d",
			"label": "dd",
			"color": "#F1D063",
			"subtitle": "D",
			"yOffset": 20.206024169921875,
			"column": 1.5
		},
		{
			"id": "e",
			"label": "ee",
			"color": "#65F163",
			"subtitle": "E"
		}
	],
	"linkOverrides": [
		{
			"source": "b",
			"target": "e",
			"color": "#8283B5",
			"gradient": true
		},
		{
			"source": "a",
			"target": "b",
			"color": "#0005F1"
		},
		{
			"source": "a",
			"target": "c",
			"color": "#C54CC2"
		},
		{
			"source": "b",
			"target": "d",
			"color": "#3EDC06"
		}
	]
}

#Response

FormatContent typeBody
PNGimage/pngRaw PNG bytes

Every successful response also includes:

X-RateLimit-Limit: <monthly quota>
X-RateLimit-Remaining: <renders left this period>
X-RateLimit-Reset: <unix timestamp when quota resets>

See Limits for what these mean.

#Saving the output

curl https://sankeykit.com/api/v1/render \
  -H "Authorization: Bearer sk_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d @request.json \
  -o chart.svg

Switch the output filename (and "format": "png" in the body) to save a PNG instead.

# Parameter reference

Generated from the live request schema in src/lib/server/render.ts — this table always matches what the API actually accepts.

FieldTypeRequiredDefaultConstraintsDescription
flowsobject[]Required——The list of source-to-target flows that make up the chart. At least one is required.
flows[].sourcestringRequired—min length 1Source node id.
flows[].targetstringRequired—min length 1Target node id.
flows[].valuenumberRequired—min 0Flow magnitude. Determines link/node thickness.
flows[].previousValuenumberOptional——Optional prior-period value, used for period-over-period change labels.
metaobjectOptional——Optional metadata about the render request, not rendered on the chart itself.
meta.titlestringOptional——Internal title for this render, not displayed on the chart.
meta.descriptionstringOptional——Internal description for this render, not displayed on the chart.
optionsobjectOptional{"width":960,"height":540,"format":"svg"}—Layout, styling and output options for the chart.
options.widthnumberOptional960integer, min 1, max 7680Output canvas width in pixels.
options.heightnumberOptional540integer, min 1, max 7680Output canvas height in pixels.
options.paddingobjectOptional——Padding around the chart area, in pixels per side.
options.padding.topnumberOptional——Top padding in pixels.
options.padding.rightnumberOptional——Right padding in pixels.
options.padding.bottomnumberOptional——Bottom padding in pixels.
options.padding.leftnumberOptional——Left padding in pixels.
options.nodeWidthnumberOptional—integer, min 4, max 100Width of node rectangles in pixels.
options.nodePaddingnumberOptional—integer, min 0, max 100Vertical gap between nodes in the same column, in pixels.
options.iterationsnumberOptional—integer, min 0, max 500Number of layout relaxation iterations used to reduce link crossings.
options.align"justify" | "left" | "right" | "center"Optional——Horizontal alignment strategy for node columns.
options.snapEndNodesbooleanOptional——Snap source/sink nodes with no incoming or outgoing links to the outer columns.
options.mergeParallelLinksbooleanOptional——Combine multiple links between the same source/target pair into one.
options.nodeHeightScalenumberOptional—min 0.01, max 1Scales node rectangle height relative to its flow value (0-1).
options.canvasBackgroundstringOptional——CSS color for the chart background.
options.themestringOptional——Named built-in color theme to apply.
options.colorPalettestring[]Optional——Custom ordered list of CSS colors used to color nodes/links.
options.linkColorMode"source" | "target" | "gradient" | "fixed"Optional——How link color is derived: from the source node, target node, a gradient between them, or a fixed color.
options.linkColorstringOptional——CSS color used for all links when linkColorMode is "fixed".
options.linkOpacitynumberOptional—min 0, max 1Opacity applied to all links (0-1).
options.labelStyleobjectOptional——Styling for node labels.
options.labelStyle.position"outward" | "left" | "right" | "above" | "below" | "inside"Optional——Where node labels are placed relative to their node.
options.labelStyle.fontFamilystringOptional——Font family for all labels.
options.labelStyle.fontSizenumberOptional——Base font size in pixels for labels.
options.labelStyle.colorstringOptional——Default label text color.
options.labelStyle.backgroundstringOptional——Label background color (behind the text).
options.labelStyle.backgroundOpacitynumberOptional—min 0, max 1Opacity of the label background (0-1).
options.labelStyle.layout"stacked" | "compact" | "semi-compact"Optional——How title/subtitle/value lines are arranged within a label.
options.labelStyle.titleobjectOptional——Style overrides for the title line of a label.
options.labelStyle.title.showbooleanOptional——Whether to show this label element.
options.labelStyle.title.colorstringOptional——CSS color for this label element.
options.labelStyle.title.sizenumberOptional——Font size in pixels for this label element.
options.labelStyle.subtitleobjectOptional——Style overrides for the subtitle line of a label.
options.labelStyle.subtitle.showbooleanOptional——Whether to show this label element.
options.labelStyle.subtitle.colorstringOptional——CSS color for this label element.
options.labelStyle.subtitle.sizenumberOptional——Font size in pixels for this label element.
options.labelStyle.valueobjectOptional——Style and formatting for the value line of a label.
options.labelStyle.value.showbooleanOptional——Whether to show this label element.
options.labelStyle.value.colorstringOptional——CSS color for this label element.
options.labelStyle.value.sizenumberOptional——Font size in pixels for this label element.
options.labelStyle.value.prefixstringOptional——Text prepended to the formatted value, e.g. "$".
options.labelStyle.value.suffixstringOptional——Text appended to the formatted value, e.g. "%".
options.labelStyle.value.decimalsnumberOptional—integerNumber of decimal places to round the value to.
options.labelStyle.value.localestringOptional——BCP 47 locale used for number formatting, e.g. "en-US".
options.labelStyle.previousValueobjectOptional——Style and formatting for the period-over-period change line of a label.
options.labelStyle.previousValue.showbooleanOptional——Whether to show this label element.
options.labelStyle.previousValue.colorstringOptional——CSS color for this label element.
options.labelStyle.previousValue.sizenumberOptional——Font size in pixels for this label element.
options.labelStyle.previousValue.prefixstringOptional——Text prepended to the change value.
options.labelStyle.previousValue.suffixstringOptional——Text appended to the change value.
options.labelStyle.previousValue.mode"percentage" | "absolute" | "raw"Optional——How to express the change versus previousValue: percentage, absolute difference, or raw value.
options.labelStyle.showSubtitlebooleanOptional——Whether to show the subtitle line at all.
options.labelStyle.subtitleScalenumberOptional——Scale factor applied to subtitle font size relative to the title.
options.chartTitleobjectOptional——Chart title text shown above the chart.
options.chartTitle.textstringOptional——The text content to display.
options.chartTitle.sizenumberOptional——Font size in pixels.
options.chartTitle.colorstringOptional——CSS text color.
options.chartTitle.align"left" | "center" | "right"Optional——Horizontal text alignment.
options.chartSubtitleobjectOptional——Chart subtitle text shown under the title.
options.chartSubtitle.textstringOptional——The text content to display.
options.chartSubtitle.sizenumberOptional——Font size in pixels.
options.chartSubtitle.colorstringOptional——CSS text color.
options.chartSubtitle.align"left" | "center" | "right"Optional——Horizontal text alignment.
options.chartFooterobjectOptional——Footer text shown below the chart.
options.chartFooter.textstringOptional——The text content to display.
options.chartFooter.sizenumberOptional——Font size in pixels.
options.chartFooter.colorstringOptional——CSS text color.
options.chartFooter.align"left" | "center" | "right"Optional——Horizontal text alignment.
options.format"svg" | "png"Optionalsvg—Output image format.
options.scalenumberOptional—min 1, max 3Pixel density multiplier applied when rendering PNG output, from 1 to 3. Has no effect on SVG output. Free/non-paid accounts are always forced to 1x regardless of what's requested here.
options.showAttributionbooleanOptional——Whether to show the "Made with SankeyKit.com" attribution link on the rendered chart. Defaults to true.
nodeOverridesobject[]Optional——Per-node style and layout overrides, keyed by node id.
nodeOverrides[].idstringRequired—min length 1Node id to override (must match a source/target used in flows).
nodeOverrides[].labelstringOptional——Display label shown instead of the node id.
nodeOverrides[].subtitlestringOptional——Secondary line of text shown under the label.
nodeOverrides[].tagstringOptional——Free-form tag, not rendered; used for grouping/color lookups.
nodeOverrides[].colorstringOptional——CSS color for this node, overriding the palette.
nodeOverrides[].hiddenbooleanOptional——Hide this node (and its links) from the output.
nodeOverrides[].pinnedbooleanOptional——Pin the node position so layout iterations do not move it.
nodeOverrides[].columnnumberOptional——Force the node into a specific column position. Fractional values place the node between columns.
nodeOverrides[].ordernumberOptional—integerVertical ordering hint within its column.
nodeOverrides[].yOffsetnumberOptional——Manual vertical pixel offset applied after layout.
nodeOverrides[].previousValuenumberOptional——Optional prior-period value for this node, used for change labels.
linkOverridesobject[]Optional——Per-link style overrides, keyed by source/target pair.
linkOverrides[].sourcestringRequired—min length 1Source node id of the link to style.
linkOverrides[].targetstringRequired—min length 1Target node id of the link to style.
linkOverrides[].colorstringOptional——CSS color override for this specific link.
linkOverrides[].opacitynumberOptional—min 0, max 1Opacity override for this specific link (0-1).
linkOverrides[].gradientbooleanOptional——Blend this link's color from its source node to its target node. When true, "color" is ignored.