Create Chart
Add a chart to a board. A chart is a title and a spec: what it computes (SQL, funnel, retention or user paths) and how it is drawn (a Vega-Lite subset).
Overview
Creates a chart on a board and returns the full chart object. A chart is atitle, an optional description, and a spec:
querysays what the chart computes:sql,funnel,retentionorpaths.viewsays how it is drawn. It is a strict subset of Vega-Lite: amarkand anencodingwhose channels name columns of the query result. The view never computes; sums, sorting and limits belong in the SQL.
400 that names them.
Request Fields
spec.query
{{date_from}} and {{date_to}} variables. Project scoping is applied automatically.
spec.view for SQL charts
x, y, color, xOffset, yOffset, theta, text. Each channel is { "field": "<column>" }. The value channel (y, or x on horizontal bars) may add "stack": true or "normalize" and "axis": { "format": "..." }; x and y may add a Vega-Lite type; theta needs "aggregate": "sum". Only the combinations in the table above are valid, so a view always draws exactly as written: for example, a line is never stacked, and grouped bars are not also stacked. data, params, expressions, channel title, and transforms other than fold are rejected.
Number formats use d3-format strings, the same as Vega-Lite: ",.0f" (1,234), ".2f" (1234.57), ".3~s" (1.23k), ".1%" (12.3%, for values stored as fractions), "$,.2f" (1,234.57). Width and precision have at most 2 digits. A number card takes `"encoding": { "text": { "format": ",.2f” } }, and text.field` picks its column.
Layers: at most 2 layers draw data (one bar layer at most, one series each, the same x); add any number of rule layers for goal lines. Horizontal bars take no layers. At most one nested layer is allowed: it comes after the first layer, holds the line and then only rules, and needs resolve.scale.y: "independent". Its rules use the right axis.
SQL Chart Examples
Table
Number
Line
Bar with two metrics
Stacked bar
Line split by a column
One line per chain, from rows of (date, chain, users).Grouped bars
100% stacked bars
Each month adds up to 100%, so the axis shows each chain’s share of volume.Horizontal bars with a number format
Categories are ranked by value, largest at the top.Bars plus a line on two axes
Daily signups as bars on the left axis, the conversion rate as a line on the right axis.Goal line
A line chart with a dashed goal line at 5,000. The chart keeps its type.Goal line on the right axis
Signups as bars on the left axis, the conversion rate as a line on the right axis, and a 5% conversion goal on the right axis.Scatter
One point per wallet, colored by segment.Number with a format
Pie
Funnel Charts
Funnel charts measure step-by-step conversion. The query is built fromspec.query.steps; there is no SQL. At least 2 steps are required.
The FunnelStep Object
Each step in the steps array has the following shape:
Filter Operators (StepFilterCondition)
settings for Funnel Charts
ConversionWindow
unit must be one of: hour · day · week (7 days).
breakdown values
device · browser · os · location · referrer · ref · utm_source · utm_medium · utm_campaign · utm_term · utm_content · builder_codes
The top categories are shown individually. The rest collapse into “Others”.
Funnel Examples
Basic 3-step closed funnel
With per-step property filters and a breakdown
Open funnel with a multi-value in filter
User Paths Charts
Show how users move through your app around ordered anchors.spec.query.settings.anchors needs at least one entry. One anchor gives an open-ended exploration; two or more constrain the path in order.
settings for User Paths Charts
Retention Charts
Measure how often users return over time. There is no SQL.settings for Retention Charts
RetentionUserFilter:
null:
Validation Reference
Response
201 Created: returns the full chart object.
id with the Get Chart, Update Chart, and Delete Chart endpoints.
400 Bad Request: the spec is not valid (unknown key, failing SQL, a view column that is not in the result, too few funnel steps). Branch on error.code; see Errors.
Authorizations
Headers
Optional unique value (e.g. a UUID v4) that lets you safely retry POST/PUT/PATCH/DELETE requests. The first request runs normally; subsequent requests with the same key replay the stored response (status + body) for 24 hours, so retries can never double-create or double-charge. Two concurrent requests with the same key return 409 IDEMPOTENCY_IN_PROGRESS. Generate a fresh key per logical operation.
255Body
Request body for creating a chart: a title and a ChartSpec (query + view). The server validates the spec: a SQL query runs, and every column the view names must be in its result. Funnel queries need at least 2 steps; retention settings must include entryFilter; paths settings need at least one anchor.
Chart spec v1: query says what the chart computes, view how it is drawn (a Vega-Lite subset; channels name result columns and never compute). SQL charts: number = {mark:"text", encoding:{}} (1 row, 1 column), or encoding.text {field?, format?} to pick and format a column of the one row; table = {mark:"x-table"}; bar/line/area/point need encoding.x and encoding.y. Several y columns: transform [{fold:[cols], as:["series","value"]}] with y = value and color = series (bar also xOffset = series; area also y.stack true). One y column split by a column: line + color = one line per value; bar + color + xOffset (same column) = grouped bars; bar or area + color + y.stack true = stacked, y.stack "normalize" = 100% stacked (shares). Horizontal bars: bar with y {field, type:"nominal"} (the category) and x {field, type:"quantitative"} (the value), grouped with yOffset. Number format: axis {format} on the value channel (d3-format: "$,.2f" money, ".1%" fractions as percent, ".3~s" compact). Scatter = {mark:"point"} with numeric x and y, optional color. Pie = {mark:"arc", encoding:{theta:{field, aggregate:"sum"}, color:{field}}}. Layered view {layer:[...], resolve?}: a chart plus goal lines {mark:"rule", encoding:{y:{datum:}}}, or combo = one bar layer + one line layer on the same x with one y each, resolve.scale.y "independent" for a second axis; a goal on that right (line) axis nests the line and its rule: {layer:[, {layer:[, ]}], resolve:{scale:{y:"independent"}}} (a top-level rule is on the left axis). Only these combinations are valid: a view must draw exactly as written. Funnel, retention and paths queries are drawn with x-funnel, x-retention and x-sankey.
Response
Chart created
A saved chart attached to a board.
Chart spec v1: query says what the chart computes, view how it is drawn (a Vega-Lite subset; channels name result columns and never compute). SQL charts: number = {mark:"text", encoding:{}} (1 row, 1 column), or encoding.text {field?, format?} to pick and format a column of the one row; table = {mark:"x-table"}; bar/line/area/point need encoding.x and encoding.y. Several y columns: transform [{fold:[cols], as:["series","value"]}] with y = value and color = series (bar also xOffset = series; area also y.stack true). One y column split by a column: line + color = one line per value; bar + color + xOffset (same column) = grouped bars; bar or area + color + y.stack true = stacked, y.stack "normalize" = 100% stacked (shares). Horizontal bars: bar with y {field, type:"nominal"} (the category) and x {field, type:"quantitative"} (the value), grouped with yOffset. Number format: axis {format} on the value channel (d3-format: "$,.2f" money, ".1%" fractions as percent, ".3~s" compact). Scatter = {mark:"point"} with numeric x and y, optional color. Pie = {mark:"arc", encoding:{theta:{field, aggregate:"sum"}, color:{field}}}. Layered view {layer:[...], resolve?}: a chart plus goal lines {mark:"rule", encoding:{y:{datum:}}}, or combo = one bar layer + one line layer on the same x with one y each, resolve.scale.y "independent" for a second axis; a goal on that right (line) axis nests the line and its rule: {layer:[, {layer:[, ]}], resolve:{scale:{y:"independent"}}} (a top-level rule is on the left axis). Only these combinations are valid: a view must draw exactly as written. Funnel, retention and paths queries are drawn with x-funnel, x-retention and x-sankey.