Create Insight
Create a new insight to save a chart, analysis, or visualization in PostHog. Insights can contain trends, funnels, retention analysis, path analysis, and more.Endpoint
Path Parameters
integer
required
The ID of the project to create the insight in
Request Body
string
Name of the insight. If not provided, PostHog will generate a derived name from the query.
string
Optional description explaining what this insight shows
object
required
The query definition for this insight. The
kind field determines the query type:InsightVizNode— Product analytics (trends, funnels, retention, paths, stickiness, lifecycle)DataVisualizationNode— SQL insights using HogQLDataTableNode— Raw data tablesHogQuery— Hog language queries
object
Legacy filter format (deprecated). Use
query instead for new insights.array
Array of dashboard IDs to add this insight to
boolean
default:true
Whether to save this insight. Set to
false for temporary/unsaved insights.boolean
default:false
Whether to mark this insight as favorited
array
Array of tag names to apply to this insight
Response Fields
integer
Unique identifier for the insight
string
Short, human-readable ID for the insight (used in URLs)
string
Name of the insight
string
Auto-generated name if no explicit name was provided
object
The query definition for this insight
any
Query results (if calculated)
object
User who created the insight
string
ISO 8601 timestamp of creation
string
ISO 8601 timestamp of when results were last calculated
boolean
Whether the results are from cache
Examples
Create Trends Insight
Create an insight showing pageview trends over the last 7 days:Create Funnel Insight
Create a conversion funnel insight:Create SQL Insight
Create a SQL-based insight using HogQL:Add to Dashboard
Create an insight and add it to a dashboard:Response
Error Responses
error
Invalid query structure or missing required fields
error
Invalid or missing API key
error
Insufficient permissions to create insights
Notes
- Insights are not automatically calculated on creation; results are calculated on first view or when explicitly refreshed
- Use the
queryfield for all new insights (thefiltersfield is deprecated) - Insights can be added to multiple dashboards
- Set
saved: falseto create temporary/exploratory insights that don’t clutter your saved insights - Query results are cached for performance; use the
refreshparameter when retrieving to force recalculation