Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

40.0 KB
Raw Blame
{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "properties": {
        "dashboards": {
            "description": "Dashboard IDs this insight should belong to. This is a full replacement — always include all existing dashboard IDs when adding a new one.",
            "items": {
                "type": "number"
            },
            "type": "array"
        },
        "description": {
            "anyOf": [
                {
                    "maxLength": 400,
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "description": "Optional, about 15 words. Omit if the name is enough. No change notes. Max 400 characters."
        },
        "favorited": {
            "type": "boolean"
        },
        "id": {
            "anyOf": [
                {
                    "type": "number"
                },
                {
                    "type": "string"
                }
            ],
            "description": "Numeric primary key or 8-character `short_id` (for example `AaVQ8Ijw`) identifying the insight."
        },
        "name": {
            "anyOf": [
                {
                    "maxLength": 400,
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ]
        },
        "query": {
            "anyOf": [
                {
                    "additionalProperties": {},
                    "properties": {
                        "kind": {
                            "const": "DataTableNode",
                            "default": "DataTableNode",
                            "type": "string"
                        },
                        "source": {
                            "additionalProperties": {},
                            "properties": {
                                "kind": {
                                    "const": "EventsQuery",
                                    "default": "EventsQuery",
                                    "type": "string"
                                },
                                "select": {
                                    "description": "Event columns as HogQL expressions.",
                                    "items": {
                                        "type": "string"
                                    },
                                    "type": "array"
                                }
                            },
                            "required": ["select"],
                            "type": "object"
                        }
                    },
                    "required": ["source"],
                    "type": "object"
                },
                {
                    "additionalProperties": {},
                    "properties": {
                        "config": {
                            "additionalProperties": {},
                            "description": "Complete worksheet configuration, including shelves and filters. Validated by the insight API.",
                            "propertyNames": {
                                "type": "string"
                            },
                            "type": "object"
                        },
                        "kind": {
                            "const": "BIVisualizationNode",
                            "default": "BIVisualizationNode",
                            "type": "string"
                        },
                        "source": {
                            "additionalProperties": {},
                            "properties": {
                                "kind": {
                                    "const": "HogQLQuery",
                                    "default": "HogQLQuery",
                                    "type": "string"
                                },
                                "query": {
                                    "description": "The HogQL query to run.",
                                    "type": "string"
                                }
                            },
                            "required": ["query"],
                            "type": "object"
                        }
                    },
                    "required": ["config", "source"],
                    "type": "object"
                },
                {
                    "properties": {
                        "kind": {
                            "const": "InsightVizNode",
                            "default": "InsightVizNode",
                            "type": "string"
                        },
                        "source": {
                            "additionalProperties": {},
                            "description": "Product analtycs query objects like TrendsQuery, FunnelsQuery, RetentionQuery, PathsQuery, StickinessQuery, LifecycleQuery",
                            "propertyNames": {
                                "type": "string"
                            },
                            "type": "object"
                        },
                        "vizSpecificOptions": {
                            "description": "Chart rendering options.",
                            "properties": {
                                "ActionsPie": {
                                    "properties": {
                                        "hideAggregation": {
                                            "description": "Hide the total on a pie chart.",
                                            "type": "boolean"
                                        }
                                    },
                                    "type": "object"
                                }
                            },
                            "type": "object"
                        }
                    },
                    "required": ["source"],
                    "type": "object"
                },
                {
                    "properties": {
                        "chartSettings": {
                            "description": "Chart configuration. Ignored when `display` is `ActionsTable` or `BoldNumber`.",
                            "properties": {
                                "boxPlot": {
                                    "description": "Column mappings for `BoxPlot`. The SQL must return one pre-aggregated row per X-axis and series pair.",
                                    "properties": {
                                        "excludeOutliers": {
                                            "description": "Clip whiskers to 1.5 times the interquartile range. Defaults to true.",
                                            "type": "boolean"
                                        },
                                        "maxColumn": {
                                            "description": "Numeric column containing the maximum for each box.",
                                            "type": "string"
                                        },
                                        "meanColumn": {
                                            "description": "Numeric column containing the mean for each box.",
                                            "type": "string"
                                        },
                                        "medianColumn": {
                                            "description": "Numeric column containing the median for each box.",
                                            "type": "string"
                                        },
                                        "minColumn": {
                                            "description": "Numeric column containing the minimum for each box.",
                                            "type": "string"
                                        },
                                        "p25Column": {
                                            "description": "Numeric column containing the 25th percentile for each box.",
                                            "type": "string"
                                        },
                                        "p75Column": {
                                            "description": "Numeric column containing the 75th percentile for each box.",
                                            "type": "string"
                                        },
                                        "seriesColumn": {
                                            "anyOf": [
                                                {
                                                    "type": "string"
                                                },
                                                {
                                                    "type": "null"
                                                }
                                            ],
                                            "description": "Optional column that groups each X-axis value into separate colored series. Set to `null` for one series."
                                        },
                                        "xAxisColumn": {
                                            "anyOf": [
                                                {
                                                    "type": "string"
                                                },
                                                {
                                                    "type": "null"
                                                }
                                            ],
                                            "description": "X-axis category column. Set to `null` for one overall distribution or one box per series."
                                        }
                                    },
                                    "required": [
                                        "maxColumn",
                                        "meanColumn",
                                        "medianColumn",
                                        "minColumn",
                                        "p25Column",
                                        "p75Column"
                                    ],
                                    "type": "object"
                                },
                                "goalLines": {
                                    "description": "Horizontal goal lines drawn across the chart.",
                                    "items": {
                                        "properties": {
                                            "label": {
                                                "description": "Label rendered next to the goal line.",
                                                "type": "string"
                                            },
                                            "value": {
                                                "description": "Y-axis value at which the goal line is drawn.",
                                                "type": "number"
                                            }
                                        },
                                        "required": ["label", "value"],
                                        "type": "object"
                                    },
                                    "type": "array"
                                },
                                "leftYAxisSettings": {
                                    "description": "Settings for the left Y axis.",
                                    "properties": {
                                        "label": {
                                            "description": "Label rendered beside this Y axis.",
                                            "type": "string"
                                        },
                                        "scale": {
                                            "description": "Scale used for this Y axis.",
                                            "enum": ["linear", "logarithmic"],
                                            "type": "string"
                                        },
                                        "showGridLines": {
                                            "description": "Show grid lines for this Y axis.",
                                            "type": "boolean"
                                        },
                                        "showTicks": {
                                            "description": "Show tick labels on this Y axis.",
                                            "type": "boolean"
                                        },
                                        "startAtZero": {
                                            "description": "Whether this Y axis should start at zero.",
                                            "type": "boolean"
                                        }
                                    },
                                    "type": "object"
                                },
                                "legendPosition": {
                                    "description": "Where the legend sits. Defaults to right for pie and donut, top for other charts.",
                                    "enum": ["top", "bottom", "left", "right"],
                                    "type": "string"
                                },
                                "metric": {
                                    "description": "Settings for `Metric`. `summary` defaults to `latest`.",
                                    "properties": {
                                        "showChange": {
                                            "type": "boolean"
                                        },
                                        "summary": {
                                            "enum": ["total", "average", "latest"],
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                },
                                "pie": {
                                    "description": "Settings for `ActionsPie` and `ActionsDonut`.",
                                    "properties": {
                                        "showTotal": {
                                            "description": "Whether to show the aggregation total. Defaults to on only when slices show values.",
                                            "type": "boolean"
                                        },
                                        "sliceContent": {
                                            "description": "What to render on each slice. Defaults to values.",
                                            "enum": ["labels", "values", "none"],
                                            "type": "string"
                                        },
                                        "valueDisplay": {
                                            "description": "Whether slice values show as absolute amounts or shares of the total. Only applies when `sliceContent` is `values`.",
                                            "enum": ["absolute", "percentage"],
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                },
                                "rightYAxisSettings": {
                                    "description": "Settings for the right Y axis. Only applies when a Y series uses `settings.display.yAxisPosition: \"right\"`.",
                                    "properties": {
                                        "label": {
                                            "description": "Label rendered beside this Y axis.",
                                            "type": "string"
                                        },
                                        "scale": {
                                            "description": "Scale used for this Y axis.",
                                            "enum": ["linear", "logarithmic"],
                                            "type": "string"
                                        },
                                        "showGridLines": {
                                            "description": "Show grid lines for this Y axis.",
                                            "type": "boolean"
                                        },
                                        "showTicks": {
                                            "description": "Show tick labels on this Y axis.",
                                            "type": "boolean"
                                        },
                                        "startAtZero": {
                                            "description": "Whether this Y axis should start at zero.",
                                            "type": "boolean"
                                        }
                                    },
                                    "type": "object"
                                },
                                "seriesBreakdownColumn": {
                                    "anyOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": "null"
                                        }
                                    ],
                                    "description": "Column that splits a single Y series into multiple colored series — e.g. breaking down a line chart by `country`. Set to `null` or omit to disable. A breakdown buckets rows by x value, so it is ignored when `display` is `ScatterPlot`."
                                },
                                "showAnnotations": {
                                    "description": "Show annotations on the chart. Only applies to line, area, bar, and stacked bar charts whose X axis is a date or datetime column.",
                                    "type": "boolean"
                                },
                                "showLegend": {
                                    "description": "Show the chart legend.",
                                    "type": "boolean"
                                },
                                "showNullsAsZero": {
                                    "description": "Replace null aggregation results with zero.",
                                    "type": "boolean"
                                },
                                "showTotalRow": {
                                    "description": "Show a total summing all Y series. Applies to line, bar, and area charts.",
                                    "type": "boolean"
                                },
                                "showValuesOnSeries": {
                                    "description": "Render each data point's value as a label directly on the series.",
                                    "type": "boolean"
                                },
                                "stackBars100": {
                                    "description": "Stack bars to 100% of the total. Only meaningful with `ActionsStackedBar`.",
                                    "type": "boolean"
                                },
                                "xAxis": {
                                    "description": "Column used as the X axis. Typically a time bucket or categorical column, but `ScatterPlot` plots two measures against each other, so it needs a numeric column here too.",
                                    "properties": {
                                        "column": {
                                            "description": "Name of a column returned by the SQL query.",
                                            "type": "string"
                                        },
                                        "settings": {
                                            "description": "Optional display and number-formatting settings for this column.",
                                            "properties": {
                                                "display": {
                                                    "description": "Display settings for this column.",
                                                    "properties": {
                                                        "description": {
                                                            "description": "Table column description shown in the header tooltip.",
                                                            "type": "string"
                                                        }
                                                    },
                                                    "type": "object"
                                                },
                                                "formatting": {
                                                    "description": "Number-formatting settings for the values in this column.",
                                                    "properties": {
                                                        "decimalPlaces": {
                                                            "description": "Number of decimal places to display.",
                                                            "type": "number"
                                                        },
                                                        "prefix": {
                                                            "description": "Text prepended to each value (e.g. `$`).",
                                                            "type": "string"
                                                        },
                                                        "style": {
                                                            "description": "`none`: unformatted; `number`: thousands separators; `short`: abbreviations (1.2k, 3.4M). `percent`: multiplies by 100 and adds `%`. Pass a 0–1 ratio (`a / b`) and omit the `%` suffix to avoid doubling it.",
                                                            "enum": ["none", "number", "short", "percent"],
                                                            "type": "string"
                                                        },
                                                        "suffix": {
                                                            "description": "Value suffix (e.g. ` ms`). Omit for `percent`, which adds `%`.",
                                                            "type": "string"
                                                        }
                                                    },
                                                    "type": "object"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "required": ["column"],
                                    "type": "object"
                                },
                                "xAxisLabel": {
                                    "description": "Label rendered under the X axis.",
                                    "type": "string"
                                },
                                "yAxis": {
                                    "description": "One or more numeric columns plotted as Y series.",
                                    "items": {
                                        "properties": {
                                            "column": {
                                                "description": "Name of a column returned by the SQL query to map onto this axis.",
                                                "type": "string"
                                            },
                                            "settings": {
                                                "description": "Optional series settings. Only applies to Y-axis series.",
                                                "properties": {
                                                    "display": {
                                                        "description": "Display settings for a plotted Y series.",
                                                        "properties": {
                                                            "color": {
                                                                "description": "Custom color for this series as a hex string (e.g. `#1d4aff`).",
                                                                "type": "string"
                                                            },
                                                            "displayType": {
                                                                "description": "Chart type. `auto` uses `display`.",
                                                                "enum": ["auto", "line", "bar", "area"],
                                                                "type": "string"
                                                            },
                                                            "excludeFromTotal": {
                                                                "description": "Keep this series out of the tooltip's total row, e.g. a target line over stacked bars. A bar series still stacks, so set `displayType` to `line` for a series drawn over the stack.",
                                                                "type": "boolean"
                                                            },
                                                            "label": {
                                                                "description": "Series label in legends and tooltips; replaces the column name.",
                                                                "type": "string"
                                                            },
                                                            "trendLine": {
                                                                "description": "Draw a linear trend line for this series. Only meaningful for line, bar, and area charts.",
                                                                "type": "boolean"
                                                            },
                                                            "valueLabels": {
                                                                "description": "Per-series override of chart-level `showValuesOnSeries`. `show` labels this series even when the chart setting is off, `hide` leaves it unlabeled when the setting is on, `auto` follows the chart.",
                                                                "enum": ["auto", "show", "hide"],
                                                                "type": "string"
                                                            },
                                                            "yAxisPosition": {
                                                                "description": "Which Y axis this numeric series should use. Use `right` for a secondary Y axis.",
                                                                "enum": ["left", "right"],
                                                                "type": "string"
                                                            }
                                                        },
                                                        "type": "object"
                                                    },
                                                    "formatting": {
                                                        "description": "Number-formatting settings for the values on this axis or series.",
                                                        "properties": {
                                                            "decimalPlaces": {
                                                                "description": "Number of decimal places to display.",
                                                                "type": "number"
                                                            },
                                                            "prefix": {
                                                                "description": "Text prepended to each value (e.g. `$`).",
                                                                "type": "string"
                                                            },
                                                            "style": {
                                                                "description": "`none`: unformatted; `number`: thousands separators; `short`: abbreviations (1.2k, 3.4M). `percent`: multiplies by 100 and adds `%`. Pass a 0–1 ratio (`a / b`) and omit the `%` suffix to avoid doubling it.",
                                                                "enum": ["none", "number", "short", "percent"],
                                                                "type": "string"
                                                            },
                                                            "suffix": {
                                                                "description": "Value suffix (e.g. ` ms`). Omit for `percent`, which adds `%`.",
                                                                "type": "string"
                                                            }
                                                        },
                                                        "type": "object"
                                                    }
                                                },
                                                "type": "object"
                                            }
                                        },
                                        "required": ["column"],
                                        "type": "object"
                                    },
                                    "type": "array"
                                }
                            },
                            "type": "object"
                        },
                        "display": {
                            "description": "Chart type (default `ActionsTable`): `BoldNumber` = one value; `Metric` = KPI; `ActionsLineGraph` / `ActionsAreaGraph` = time series; `ActionsPie` / `ActionsDonut` / `ActionsProportionBar` = shares; `ActionsBar` / `ActionsStackedBar` = categories; `ActionsBarValue` = horizontal rankings; `TwoDimensionalHeatmap` = 2D aggregates; `ScatterPlot` = two measures; `BoxPlot` = distribution summaries with `chartSettings.boxPlot`.",
                            "enum": [
                                "ActionsTable",
                                "BoldNumber",
                                "Metric",
                                "ActionsLineGraph",
                                "ActionsBar",
                                "ActionsBarValue",
                                "ActionsPie",
                                "ActionsDonut",
                                "ActionsProportionBar",
                                "ActionsStackedBar",
                                "ActionsAreaGraph",
                                "TwoDimensionalHeatmap",
                                "ScatterPlot",
                                "BoxPlot"
                            ],
                            "type": "string"
                        },
                        "kind": {
                            "const": "DataVisualizationNode",
                            "default": "DataVisualizationNode",
                            "type": "string"
                        },
                        "source": {
                            "additionalProperties": {},
                            "description": "HogQL query object that produces the rows to visualize.",
                            "propertyNames": {
                                "type": "string"
                            },
                            "type": "object"
                        },
                        "tableSettings": {
                            "description": "Table configuration. Only applies when `display` is `ActionsTable` or omitted.",
                            "properties": {
                                "columns": {
                                    "description": "Columns to display and their order. Omit to show every column returned by the query.",
                                    "items": {
                                        "properties": {
                                            "column": {
                                                "description": "Name of a column returned by the SQL query.",
                                                "type": "string"
                                            },
                                            "settings": {
                                                "description": "Optional display and number-formatting settings for this column.",
                                                "properties": {
                                                    "display": {
                                                        "description": "Display settings for this column.",
                                                        "properties": {
                                                            "description": {
                                                                "description": "Table column description shown in the header tooltip.",
                                                                "type": "string"
                                                            }
                                                        },
                                                        "type": "object"
                                                    },
                                                    "formatting": {
                                                        "description": "Number-formatting settings for the values in this column.",
                                                        "properties": {
                                                            "decimalPlaces": {
                                                                "description": "Number of decimal places to display.",
                                                                "type": "number"
                                                            },
                                                            "prefix": {
                                                                "description": "Text prepended to each value (e.g. `$`).",
                                                                "type": "string"
                                                            },
                                                            "style": {
                                                                "description": "`none`: unformatted; `number`: thousands separators; `short`: abbreviations (1.2k, 3.4M). `percent`: multiplies by 100 and adds `%`. Pass a 0–1 ratio (`a / b`) and omit the `%` suffix to avoid doubling it.",
                                                                "enum": ["none", "number", "short", "percent"],
                                                                "type": "string"
                                                            },
                                                            "suffix": {
                                                                "description": "Value suffix (e.g. ` ms`). Omit for `percent`, which adds `%`.",
                                                                "type": "string"
                                                            }
                                                        },
                                                        "type": "object"
                                                    }
                                                },
                                                "type": "object"
                                            }
                                        },
                                        "required": ["column"],
                                        "type": "object"
                                    },
                                    "type": "array"
                                },
                                "pinnedColumns": {
                                    "description": "Column names to pin to the left of the table.",
                                    "items": {
                                        "type": "string"
                                    },
                                    "type": "array"
                                },
                                "transpose": {
                                    "description": "Transpose rows and columns.",
                                    "type": "boolean"
                                }
                            },
                            "type": "object"
                        }
                    },
                    "required": ["source"],
                    "type": "object"
                },
                {
                    "additionalProperties": {},
                    "properties": {
                        "kind": {
                            "anyOf": [
                                {
                                    "enum": [
                                        "TrendsQuery",
                                        "FunnelsQuery",
                                        "RetentionQuery",
                                        "PathsQuery",
                                        "PathsV2Query",
                                        "StickinessQuery",
                                        "LifecycleQuery",
                                        "WebStatsTableQuery",
                                        "WebOverviewQuery"
                                    ],
                                    "type": "string"
                                },
                                {
                                    "enum": ["MetricsQuery", "MetricsHistogramQuery"],
                                    "type": "string"
                                }
                            ]
                        }
                    },
                    "required": ["kind"],
                    "type": "object"
                },
                {
                    "additionalProperties": {},
                    "properties": {
                        "kind": {
                            "const": "HogQLQuery",
                            "default": "HogQLQuery",
                            "type": "string"
                        },
                        "query": {
                            "description": "The HogQL query to run.",
                            "type": "string"
                        }
                    },
                    "required": ["query"],
                    "type": "object"
                },
                {
                    "additionalProperties": {},
                    "properties": {
                        "kind": {
                            "const": "EventsQuery",
                            "default": "EventsQuery",
                            "type": "string"
                        },
                        "select": {
                            "description": "Event columns as HogQL expressions.",
                            "items": {
                                "type": "string"
                            },
                            "type": "array"
                        }
                    },
                    "required": ["select"],
                    "type": "object"
                }
            ]
        },
        "tags": {
            "items": {},
            "type": "array"
        }
    },
    "required": ["id"],
    "type": "object"
}