POST a small JSON description and get back a deck-ready PNG (or SVG). The endpoint is open and CORS-enabled, so it works from browsers, scripts, CI and anywhere else you can make an HTTP call. The same JSON opens in the builder.
| Field | Type | Description |
|---|---|---|
| title | string | Heading shown top-left of the chart at 22px bold. Every chart has one title row; an empty string hides it. max 140 chars · default "Decision tree" |
| rootrequired | node | The first decision or question, on the left (e.g. "Launch strategy for Atlas" or "Does the laptop power on?"), with its branches nested in `children`. Limits: 5 levels in total including the root, up to 5 branches per node and 40 nodes; extras are dropped with a warning, deepest levels and last-listed nodes first. |
| prefix | string | Text before every payoff and expected value, e.g. "$", "€" or "£". Default none. max 6 chars · default "" |
| suffix | string | Text after every payoff and expected value, e.g. "m", "k", "bn" or " pts". Default none. max 6 chars · default "" |
| showEV | boolean | Roll back expected values: print "EV" on every decision and chance node, draw each decision's best option in the accent colour and mark the rejected options with a ‖ prune mark. When omitted it is on as soon as the tree has both payoffs and probabilities; set false to hide it, true to show it for decision-only trees with payoffs. |
| width | integer | Chart width in pixels (640–2400). Omit it (recommended) and the chart sizes itself to its content with comfortable margins, between 880 and 1280px wide. PNG output renders at 2x. 640–2400 |
| palette | string[] | Hex colours: the first marks decisions and the best options, the second chance events, the third end outcomes. Pass the user's brand colours here when they name them. Default: indigo, sky, emerald. max 12 items · default ["#4f46e5","#0ea5e9","#10b981","#f59e0b","#ef4444","#6b7280"] |
| Field | Type | Description |
|---|---|---|
| namerequired | string | The text in the node's box: the decision or question ("Launch Atlas?", "Is the router on?"), the option or event it stands for ("Launch now", "Strong demand"), or the end result ("Replace the cable"). Wraps onto three lines, then truncates; keep it to a few words. max 80 chars |
| type | string | Optional node type, drawn in the decision-analysis convention: "decision" (a square: the decision maker picks a branch), "chance" (a circle: chance picks a branch, with probabilities) or "outcome" (a triangle: an end point, with an optional payoff). Usually omit it and it is inferred: a node whose branches carry a probability is a chance node, a node with no branches an outcome, anything else a decision. "decision", "chance", "outcome" |
| label | string | Optional text on the branch line leading into this node, e.g. "Yes" / "No" in a question flowchart, or an option name. Under a chance node it is followed by the probability ("Strong demand · 60%"). Omit it when the node's name already says it. max 40 chars |
| probability | number | Optional probability of this branch, for children of a chance node. Write it as 0–1 (0.6) or as a percentage (60): any value above 1 is read as a percentage, so write 1% as 0.01. Drawn on the branch as "60%". Branches of a chance node that leave it out share whatever is left of 100% equally. If a chance node's branches don't add up to 100%, the chart is still drawn and a warning says so. 0–100 |
| payoff | number | Optional value of an end outcome as a plain number (4.2 for $4.2m with prefix "$" and suffix "m"; negative for a loss). Shown right-aligned in a payoff column at the right edge and used to roll back expected values. Only counts on nodes without children. -1000000000000–1000000000000 |
| children | node[] | The branches leaving this node, top to bottom (up to 5): the options of a decision, the possible events of a chance node, or the answers to a question. max 5 items |
POST /api/render/decisiontree returns image/png; add ?format=svg for SVG.GET /decisiontree.png?d=<payload> and /decisiontree.svg?d=<payload> render a chart from a link. The payload is the JSON body, raw-deflated and base64url-encoded. Nothing is stored: links are permanent and cached for a year./decisiontree#d=<payload> opens the same chart in the builder for editing.GET /api/render/decisiontree?demo=1 returns the demo chart.GET /api/schema/decisiontree returns the JSON Schema, for code generators and AIs.Input is lenient where the intent is clear: numeric strings become numbers, out-of-range values are clamped, and unknown fields are ignored. Adjustments are listed in the X-Render-Warnings header. Anything unclear returns a 400 that says how to fix it:
{
"error": "Invalid payload",
"issues": [{ "path": "tasks", "message": "must be an array" }],
"example": { … }
}
Use the hosted MCP server instead. It gives Claude, Cursor and other MCP clients a create_decision_tree tool that returns the image plus image, SVG and edit links. See the MCP page →