Insights-2
For instructions on how to authenticate to use this endpoint, see API overview.
Endpoints
GET | |
POST | |
GET | |
POST | |
GET | |
POST | |
DELETE | |
POST | |
GET | |
GET | |
GET | |
PATCH | |
DELETE | |
GET | |
GET | |
GET | |
POST | |
GET | |
POST |
Retrieve environments insights trending
Returns trending insights based on view count in the last 24 hours. Defaults to returning top 10 insights.
Path parameters
- environment_idstring
Query parameters
- formatstringOne of:
"csv""json"
Example request
GET /api /environments /:environment_id /insights /trendingexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/environments/:environment_id/insights/trending/
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.get("<ph_app_host>/api/environments/{environment_id}/insights/trending/".format(project_id=project_id,environment_id="<the environment id>"),headers={"Authorization": "Bearer {}".format(api_key)},).json()
Example response
Status 200 No response body
Create environments insights viewed
Update insight view timestamps. Expects: {"insight_ids": [1, 2, 3, ...]}
Required API key scopes
insight:readPath parameters
- environment_idstring
Query parameters
- formatstringOne of:
"csv""json"
Request parameters
- namestring
- derived_namestring
- query
- orderinteger
- deletedboolean
- dashboardsarray
- descriptionstring
- tagsarray
- favoritedboolean
- _create_in_folderstring
Example request
POST /api /environments /:environment_id /insights /viewedexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl-H 'Content-Type: application/json'\-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/environments/:environment_id/insights/viewed/\-d name="string"
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.post("<ph_app_host>/api/environments/{environment_id}/insights/viewed/".format(project_id=project_id,environment_id="<the environment id>"),headers={"Authorization": "Bearer {}".format(api_key)},data={"name": "string"}).json()
Example response
Status 200 No response body
List all insights
Required API key scopes
insight:readPath parameters
- project_idstring
Query parameters
- basicboolean
- formatstringOne of:
"csv""json" - limitinteger
- offsetinteger
- refreshstringDefault:
force_cacheOne of:"async""async_except_on_cache_miss""blocking""force_async""force_blocking""force_cache""lazy_async" - short_idstring
Response
Example request
GET /api /projects /:project_id /insightsexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/projects/:project_id/insights/
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.get("<ph_app_host>/api/projects/{project_id}/insights/".format(project_id=project_id),headers={"Authorization": "Bearer {}".format(api_key)},).json()
Example response
Status 200
RESPONSE
{"count": 123,"next": "http://api.example.org/accounts/?offset=400&limit=100","previous": "http://api.example.org/accounts/?offset=200&limit=100","results": [{"id": 0,"short_id": "string","name": "string","derived_name": "string","query": {"embedded": null,"full": null,"hidePersonsModal": null,"hideTooltipOnScroll": null,"kind": "InsightVizNode","showCorrelationTable": null,"showFilters": null,"showHeader": null,"showLastComputation": null,"showLastComputationRefresh": null,"showResults": null,"showTable": null,"source": {"aggregation_group_type_index": null,"breakdownFilter": {"breakdown": null,"breakdown_group_type_index": null,"breakdown_hide_other_aggregation": null,"breakdown_histogram_bin_count": null,"breakdown_limit": null,"breakdown_normalize_url": null,"breakdown_path_cleaning": null,"breakdown_type": "cohort","breakdowns": null},"compareFilter": {"compare": false,"compare_to": null},"conversionGoal": null,"dataColorTheme": null,"dateRange": {"date_from": null,"date_to": null,"explicitDate": false},"filterTestAccounts": false,"interval": "second","kind": "TrendsQuery","modifiers": {"bounceRateDurationSeconds": null,"bounceRatePageViewMode": "count_pageviews","convertToProjectTimezone": null,"customChannelTypeRules": null,"dataWarehouseEventsModifiers": null,"debug": null,"forceClickhouseDataSkippingIndexes": null,"formatCsvAllowDoubleQuotes": null,"inCohortVia": "auto","materializationMode": "auto","materializedColumnsOptimizationMode": "disabled","optimizeJoinedFilters": null,"optimizeProjections": null,"personsArgMaxVersion": "auto","personsJoinMode": "inner","personsOnEventsMode": "disabled","propertyGroupsMode": "enabled","s3TableUseInvalidColumns": null,"sessionTableVersion": "auto","sessionsV2JoinMode": "string","timings": null,"useMaterializedViews": null,"usePreaggregatedIntermediateResults": null,"usePreaggregatedTableTransforms": null,"useWebAnalyticsPreAggregatedTables": null},"properties": [],"response": {"error": null,"hasMore": null,"hogql": null,"modifiers": {"bounceRateDurationSeconds": null,"bounceRatePageViewMode": "count_pageviews","convertToProjectTimezone": null,"customChannelTypeRules": null,"dataWarehouseEventsModifiers": null,"debug": null,"forceClickhouseDataSkippingIndexes": null,"formatCsvAllowDoubleQuotes": null,"inCohortVia": "auto","materializationMode": "auto","materializedColumnsOptimizationMode": "disabled","optimizeJoinedFilters": null,"optimizeProjections": null,"personsArgMaxVersion": "auto","personsJoinMode": "inner","personsOnEventsMode": "disabled","propertyGroupsMode": "enabled","s3TableUseInvalidColumns": null,"sessionTableVersion": "auto","sessionsV2JoinMode": "string","timings": null,"useMaterializedViews": null,"usePreaggregatedIntermediateResults": null,"usePreaggregatedTableTransforms": null,"useWebAnalyticsPreAggregatedTables": null},"query_status": {"complete": false,"dashboard_id": null,"end_time": null,"error": false,"error_message": null,"expiration_time": null,"id": "string","insight_id": null,"labels": null,"pickup_time": null,"query_async": true,"query_progress": {"active_cpu_time": 0,"bytes_read": 0,"estimated_rows_total": 0,"rows_read": 0,"time_elapsed": 0},"results": null,"start_time": null,"task_id": null,"team_id": 0},"resolved_date_range": {"date_from": "2019-08-24T14:15:22Z","date_to": "2019-08-24T14:15:22Z"},"results": [{}],"timings": null},"samplingFactor": null,"series": [{"custom_name": null,"fixedProperties": null,"kind": "GroupNode","limit": null,"math": null,"math_group_type_index": 0,"math_hogql": null,"math_multiplier": null,"math_property": null,"math_property_revenue_currency": {"property": null,"static": "AED"},"math_property_type": null,"name": null,"nodes": [{"custom_name": null,"event": null,"fixedProperties": null,"kind": "EventsNode","limit": null,"math": null,"math_group_type_index": 0,"math_hogql": null,"math_multiplier": null,"math_property": null,"math_property_revenue_currency": {"property": null,"static": "AED"},"math_property_type": null,"name": null,"optionalInFunnel": null,"orderBy": null,"properties": null,"response": null,"version": null}],"operator": "AND","optionalInFunnel": null,"orderBy": null,"properties": null,"response": null,"version": null}],"tags": {"name": null,"productKey": null,"scene": null},"trendsFilter": {"aggregationAxisFormat": "numeric","aggregationAxisPostfix": null,"aggregationAxisPrefix": null,"breakdown_histogram_bin_count": null,"confidenceLevel": null,"decimalPlaces": null,"detailedResultsAggregationType": "total","display": "Auto","formula": null,"formulaNodes": null,"formulas": null,"goalLines": null,"hiddenLegendIndexes": null,"minDecimalPlaces": null,"movingAverageIntervals": null,"resultCustomizationBy": "value","resultCustomizations": null,"showAlertThresholdLines": false,"showConfidenceIntervals": null,"showLabelsOnSeries": null,"showLegend": false,"showMovingAverage": null,"showMultipleYAxes": false,"showPercentStackView": false,"showTrendLines": null,"showValuesOnSeries": false,"smoothingIntervals": 1,"yAxisScaleType": "log10"},"version": null},"suppressSessionAnalysisWarning": null,"version": null,"vizSpecificOptions": {"ActionsPie": {"disableHoverOffset": null,"hideAggregation": null},"RETENTION": {"hideLineGraph": null,"hideSizeColumn": null,"useSmallLayout": null}}},"order": -2147483648,"deleted": true,"dashboards": [0],"dashboard_tiles": [{"id": 0,"dashboard_id": 0,"deleted": true}],"last_refresh": "string","cache_target_age": "string","next_allowed_client_refresh": "string","result": "string","hasMore": "string","columns": "string","created_at": "2019-08-24T14:15:22Z","created_by": {"id": 0,"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f","distinct_id": "string","first_name": "string","last_name": "string","email": "user@example.com","is_email_verified": true,"hedgehog_config": {"property1": null,"property2": null},"role_at_organization": "engineering"},"description": "string","updated_at": "2019-08-24T14:15:22Z","tags": [null],"favorited": true,"last_modified_at": "2019-08-24T14:15:22Z","last_modified_by": {"id": 0,"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f","distinct_id": "string","first_name": "string","last_name": "string","email": "user@example.com","is_email_verified": true,"hedgehog_config": {"property1": null,"property2": null},"role_at_organization": "engineering"},"is_sample": true,"effective_restriction_level": 21,"effective_privilege_level": 21,"user_access_level": "string","timezone": "string","is_cached": "string","query_status": "string","hogql": "string","types": "string","resolved_date_range": "string","_create_in_folder": "string","alerts": "string","last_viewed_at": "string"}]}
Create insights
Required API key scopes
insight:writePath parameters
- project_idstring
Query parameters
- formatstringOne of:
"csv""json"
Request parameters
- namestring
- derived_namestring
- query
- orderinteger
- deletedboolean
- dashboardsarray
- descriptionstring
- tagsarray
- favoritedboolean
- _create_in_folderstring
Response
Example request
POST /api /projects /:project_id /insightsexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl-H 'Content-Type: application/json'\-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/projects/:project_id/insights/\-d name="string"
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.post("<ph_app_host>/api/projects/{project_id}/insights/".format(project_id=project_id),headers={"Authorization": "Bearer {}".format(api_key)},data={"name": "string"}).json()
Example response
Status 201
RESPONSE
{"id": 0,"short_id": "string","name": "string","derived_name": "string","query": {"embedded": null,"full": null,"hidePersonsModal": null,"hideTooltipOnScroll": null,"kind": "InsightVizNode","showCorrelationTable": null,"showFilters": null,"showHeader": null,"showLastComputation": null,"showLastComputationRefresh": null,"showResults": null,"showTable": null,"source": {"aggregation_group_type_index": null,"breakdownFilter": {"breakdown": null,"breakdown_group_type_index": null,"breakdown_hide_other_aggregation": null,"breakdown_histogram_bin_count": null,"breakdown_limit": null,"breakdown_normalize_url": null,"breakdown_path_cleaning": null,"breakdown_type": "cohort","breakdowns": null},"compareFilter": {"compare": false,"compare_to": null},"conversionGoal": null,"dataColorTheme": null,"dateRange": {"date_from": null,"date_to": null,"explicitDate": false},"filterTestAccounts": false,"interval": "second","kind": "TrendsQuery","modifiers": {"bounceRateDurationSeconds": null,"bounceRatePageViewMode": "count_pageviews","convertToProjectTimezone": null,"customChannelTypeRules": null,"dataWarehouseEventsModifiers": null,"debug": null,"forceClickhouseDataSkippingIndexes": null,"formatCsvAllowDoubleQuotes": null,"inCohortVia": "auto","materializationMode": "auto","materializedColumnsOptimizationMode": "disabled","optimizeJoinedFilters": null,"optimizeProjections": null,"personsArgMaxVersion": "auto","personsJoinMode": "inner","personsOnEventsMode": "disabled","propertyGroupsMode": "enabled","s3TableUseInvalidColumns": null,"sessionTableVersion": "auto","sessionsV2JoinMode": "string","timings": null,"useMaterializedViews": null,"usePreaggregatedIntermediateResults": null,"usePreaggregatedTableTransforms": null,"useWebAnalyticsPreAggregatedTables": null},"properties": [],"response": {"error": null,"hasMore": null,"hogql": null,"modifiers": {"bounceRateDurationSeconds": null,"bounceRatePageViewMode": "count_pageviews","convertToProjectTimezone": null,"customChannelTypeRules": null,"dataWarehouseEventsModifiers": null,"debug": null,"forceClickhouseDataSkippingIndexes": null,"formatCsvAllowDoubleQuotes": null,"inCohortVia": "auto","materializationMode": "auto","materializedColumnsOptimizationMode": "disabled","optimizeJoinedFilters": null,"optimizeProjections": null,"personsArgMaxVersion": "auto","personsJoinMode": "inner","personsOnEventsMode": "disabled","propertyGroupsMode": "enabled","s3TableUseInvalidColumns": null,"sessionTableVersion": "auto","sessionsV2JoinMode": "string","timings": null,"useMaterializedViews": null,"usePreaggregatedIntermediateResults": null,"usePreaggregatedTableTransforms": null,"useWebAnalyticsPreAggregatedTables": null},"query_status": {"complete": false,"dashboard_id": null,"end_time": null,"error": false,"error_message": null,"expiration_time": null,"id": "string","insight_id": null,"labels": null,"pickup_time": null,"query_async": true,"query_progress": {"active_cpu_time": 0,"bytes_read": 0,"estimated_rows_total": 0,"rows_read": 0,"time_elapsed": 0},"results": null,"start_time": null,"task_id": null,"team_id": 0},"resolved_date_range": {"date_from": "2019-08-24T14:15:22Z","date_to": "2019-08-24T14:15:22Z"},"results": [{}],"timings": null},"samplingFactor": null,"series": [{"custom_name": null,"fixedProperties": null,"kind": "GroupNode","limit": null,"math": null,"math_group_type_index": 0,"math_hogql": null,"math_multiplier": null,"math_property": null,"math_property_revenue_currency": {"property": null,"static": "AED"},"math_property_type": null,"name": null,"nodes": [{"custom_name": null,"event": null,"fixedProperties": null,"kind": "EventsNode","limit": null,"math": null,"math_group_type_index": 0,"math_hogql": null,"math_multiplier": null,"math_property": null,"math_property_revenue_currency": {"property": null,"static": "AED"},"math_property_type": null,"name": null,"optionalInFunnel": null,"orderBy": null,"properties": null,"response": null,"version": null}],"operator": "AND","optionalInFunnel": null,"orderBy": null,"properties": null,"response": null,"version": null}],"tags": {"name": null,"productKey": null,"scene": null},"trendsFilter": {"aggregationAxisFormat": "numeric","aggregationAxisPostfix": null,"aggregationAxisPrefix": null,"breakdown_histogram_bin_count": null,"confidenceLevel": null,"decimalPlaces": null,"detailedResultsAggregationType": "total","display": "Auto","formula": null,"formulaNodes": null,"formulas": null,"goalLines": null,"hiddenLegendIndexes": null,"minDecimalPlaces": null,"movingAverageIntervals": null,"resultCustomizationBy": "value","resultCustomizations": null,"showAlertThresholdLines": false,"showConfidenceIntervals": null,"showLabelsOnSeries": null,"showLegend": false,"showMovingAverage": null,"showMultipleYAxes": false,"showPercentStackView": false,"showTrendLines": null,"showValuesOnSeries": false,"smoothingIntervals": 1,"yAxisScaleType": "log10"},"version": null},"suppressSessionAnalysisWarning": null,"version": null,"vizSpecificOptions": {"ActionsPie": {"disableHoverOffset": null,"hideAggregation": null},"RETENTION": {"hideLineGraph": null,"hideSizeColumn": null,"useSmallLayout": null}}},"order": -2147483648,"deleted": true,"dashboards": [0],"dashboard_tiles": [{"id": 0,"dashboard_id": 0,"deleted": true}],"last_refresh": "string","cache_target_age": "string","next_allowed_client_refresh": "string","result": "string","hasMore": "string","columns": "string","created_at": "2019-08-24T14:15:22Z","created_by": {"id": 0,"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f","distinct_id": "string","first_name": "string","last_name": "string","email": "user@example.com","is_email_verified": true,"hedgehog_config": {"property1": null,"property2": null},"role_at_organization": "engineering"},"description": "string","updated_at": "2019-08-24T14:15:22Z","tags": [null],"favorited": true,"last_modified_at": "2019-08-24T14:15:22Z","last_modified_by": {"id": 0,"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f","distinct_id": "string","first_name": "string","last_name": "string","email": "user@example.com","is_email_verified": true,"hedgehog_config": {"property1": null,"property2": null},"role_at_organization": "engineering"},"is_sample": true,"effective_restriction_level": 21,"effective_privilege_level": 21,"user_access_level": "string","timezone": "string","is_cached": "string","query_status": "string","hogql": "string","types": "string","resolved_date_range": "string","_create_in_folder": "string","alerts": "string","last_viewed_at": "string"}
List all insights sharing
Required API key scopes
sharing_configuration:readPath parameters
- insight_idinteger
- project_idstring
Example request
GET /api /projects /:project_id /insights /:insight_id /sharingexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/projects/:project_id/insights/:insight_id/sharing/
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.get("<ph_app_host>/api/projects/{project_id}/insights/{insight_id}/sharing/".format(project_id=project_id,insight_id="<the insight id>"),headers={"Authorization": "Bearer {}".format(api_key)},).json()
Example response
Status 200
RESPONSE
{"created_at": "2019-08-24T14:15:22Z","enabled": true,"access_token": "string","settings": null,"password_required": true,"share_passwords": "string"}
Create insights sharing passwords
Create a new password for the sharing configuration.
Required API key scopes
sharing_configuration:writePath parameters
- insight_idinteger
- project_idstring
Request parameters
- enabledboolean
- settings
- password_requiredboolean
Response
Example request
POST /api /projects /:project_id /insights /:insight_id /sharing /passwordsexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl-H 'Content-Type: application/json'\-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/projects/:project_id/insights/:insight_id/sharing/passwords/\-d created_at="string"
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.post("<ph_app_host>/api/projects/{project_id}/insights/{insight_id}/sharing/passwords/".format(project_id=project_id,insight_id="<the insight id>"),headers={"Authorization": "Bearer {}".format(api_key)},data={"created_at": "string"}).json()
Example response
Status 200
RESPONSE
{"created_at": "2019-08-24T14:15:22Z","enabled": true,"access_token": "string","settings": null,"password_required": true,"share_passwords": "string"}
Delete insights sharing passwords
Delete a password from the sharing configuration.
Required API key scopes
sharing_configuration:writePath parameters
- insight_idinteger
- password_idstring
- project_idstring
Example request
DELETE /api /projects /:project_id /insights /:insight_id /sharing /passwords /:password_idexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl -X DELETE \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/projects/:project_id/insights/:insight_id/sharing/passwords/:password_id/
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.delete("<ph_app_host>/api/projects/{project_id}/insights/{insight_id}/sharing/passwords/{password_id}/".format(project_id=project_id,insight_id="<the insight id>",,password_id="<the password id>"),headers={"Authorization": "Bearer {}".format(api_key)},)
Example response
Status 204 No response body
Create insights sharing refresh
Required API key scopes
sharing_configuration:writePath parameters
- insight_idinteger
- project_idstring
Request parameters
- enabledboolean
- settings
- password_requiredboolean
Response
Example request
POST /api /projects /:project_id /insights /:insight_id /sharing /refreshexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl-H 'Content-Type: application/json'\-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/projects/:project_id/insights/:insight_id/sharing/refresh/\-d created_at="string"
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.post("<ph_app_host>/api/projects/{project_id}/insights/{insight_id}/sharing/refresh/".format(project_id=project_id,insight_id="<the insight id>"),headers={"Authorization": "Bearer {}".format(api_key)},data={"created_at": "string"}).json()
Example response
Status 200
RESPONSE
{"created_at": "2019-08-24T14:15:22Z","enabled": true,"access_token": "string","settings": null,"password_required": true,"share_passwords": "string"}
List all insights thresholds
Required API key scopes
alert:readPath parameters
- insight_idinteger
- project_idstring
Query parameters
- limitinteger
- offsetinteger
Response
Example request
GET /api /projects /:project_id /insights /:insight_id /thresholdsexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/projects/:project_id/insights/:insight_id/thresholds/
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.get("<ph_app_host>/api/projects/{project_id}/insights/{insight_id}/thresholds/".format(project_id=project_id,insight_id="<the insight id>"),headers={"Authorization": "Bearer {}".format(api_key)},).json()
Example response
Status 200
RESPONSE
{"count": 123,"next": "http://api.example.org/accounts/?offset=400&limit=100","previous": "http://api.example.org/accounts/?offset=200&limit=100","results": [{"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08","created_at": "2019-08-24T14:15:22Z","name": "string","configuration": {"bounds": {"lower": null,"upper": null},"type": "absolute"},"alerts": [{"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08","created_by": {"id": 0,"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f","distinct_id": "string","first_name": "string","last_name": "string","email": "user@example.com","is_email_verified": true,"hedgehog_config": {"property1": null,"property2": null},"role_at_organization": "engineering"},"created_at": "2019-08-24T14:15:22Z","insight": 0,"name": "string","subscribed_users": [0],"threshold": {"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08","created_at": "2019-08-24T14:15:22Z","name": "string","configuration": {"bounds": {"lower": null,"upper": null},"type": "absolute"}},"condition": {"type": "absolute_value"},"state": "Firing","enabled": true,"last_notified_at": "2019-08-24T14:15:22Z","last_checked_at": "2019-08-24T14:15:22Z","next_check_at": "2019-08-24T14:15:22Z","checks": [{"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08","created_at": "2019-08-24T14:15:22Z","calculated_value": 0.1,"state": "Firing","targets_notified": true}],"config": {"check_ongoing_interval": null,"series_index": 0,"type": "TrendsAlertConfig"},"calculation_interval": "hourly","snoozed_until": "2019-08-24T14:15:22Z","skip_weekend": true}]}]}
Retrieve insights thresholds
Required API key scopes
alert:readPath parameters
- idstring
- insight_idinteger
- project_idstring
Response
Example request
GET /api /projects /:project_id /insights /:insight_id /thresholds /:idexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/projects/:project_id/insights/:insight_id/thresholds/:id/
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.get("<ph_app_host>/api/projects/{project_id}/insights/{insight_id}/thresholds/{insights-2_id}/".format(project_id=project_id,insights-2_id="<the insights-2 id>",insight_id="<the insight id>"),headers={"Authorization": "Bearer {}".format(api_key)},).json()
Example response
Status 200
RESPONSE
{"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08","created_at": "2019-08-24T14:15:22Z","name": "string","configuration": {"bounds": {"lower": null,"upper": null},"type": "absolute"},"alerts": [{"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08","created_by": {"id": 0,"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f","distinct_id": "string","first_name": "string","last_name": "string","email": "user@example.com","is_email_verified": true,"hedgehog_config": {"property1": null,"property2": null},"role_at_organization": "engineering"},"created_at": "2019-08-24T14:15:22Z","insight": 0,"name": "string","subscribed_users": [0],"threshold": {"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08","created_at": "2019-08-24T14:15:22Z","name": "string","configuration": {"bounds": {"lower": null,"upper": null},"type": "absolute"}},"condition": {"type": "absolute_value"},"state": "Firing","enabled": true,"last_notified_at": "2019-08-24T14:15:22Z","last_checked_at": "2019-08-24T14:15:22Z","next_check_at": "2019-08-24T14:15:22Z","checks": [{"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08","created_at": "2019-08-24T14:15:22Z","calculated_value": 0.1,"state": "Firing","targets_notified": true}],"config": {"check_ongoing_interval": null,"series_index": 0,"type": "TrendsAlertConfig"},"calculation_interval": "hourly","snoozed_until": "2019-08-24T14:15:22Z","skip_weekend": true}]}
Retrieve insights
Required API key scopes
insight:readPath parameters
- idinteger
- project_idstring
Query parameters
- formatstringOne of:
"csv""json" - from_dashboardinteger
- refreshstringDefault:
force_cacheOne of:"async""async_except_on_cache_miss""blocking""force_async""force_blocking""force_cache""lazy_async"
Response
Example request
GET /api /projects /:project_id /insights /:idexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/projects/:project_id/insights/:id/
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.get("<ph_app_host>/api/projects/{project_id}/insights/{insights-2_id}/".format(project_id=project_id,insights-2_id="<the insights-2 id>"),headers={"Authorization": "Bearer {}".format(api_key)},).json()
Example response
Status 200
RESPONSE
{"id": 0,"short_id": "string","name": "string","derived_name": "string","query": {"embedded": null,"full": null,"hidePersonsModal": null,"hideTooltipOnScroll": null,"kind": "InsightVizNode","showCorrelationTable": null,"showFilters": null,"showHeader": null,"showLastComputation": null,"showLastComputationRefresh": null,"showResults": null,"showTable": null,"source": {"aggregation_group_type_index": null,"breakdownFilter": {"breakdown": null,"breakdown_group_type_index": null,"breakdown_hide_other_aggregation": null,"breakdown_histogram_bin_count": null,"breakdown_limit": null,"breakdown_normalize_url": null,"breakdown_path_cleaning": null,"breakdown_type": "cohort","breakdowns": null},"compareFilter": {"compare": false,"compare_to": null},"conversionGoal": null,"dataColorTheme": null,"dateRange": {"date_from": null,"date_to": null,"explicitDate": false},"filterTestAccounts": false,"interval": "second","kind": "TrendsQuery","modifiers": {"bounceRateDurationSeconds": null,"bounceRatePageViewMode": "count_pageviews","convertToProjectTimezone": null,"customChannelTypeRules": null,"dataWarehouseEventsModifiers": null,"debug": null,"forceClickhouseDataSkippingIndexes": null,"formatCsvAllowDoubleQuotes": null,"inCohortVia": "auto","materializationMode": "auto","materializedColumnsOptimizationMode": "disabled","optimizeJoinedFilters": null,"optimizeProjections": null,"personsArgMaxVersion": "auto","personsJoinMode": "inner","personsOnEventsMode": "disabled","propertyGroupsMode": "enabled","s3TableUseInvalidColumns": null,"sessionTableVersion": "auto","sessionsV2JoinMode": "string","timings": null,"useMaterializedViews": null,"usePreaggregatedIntermediateResults": null,"usePreaggregatedTableTransforms": null,"useWebAnalyticsPreAggregatedTables": null},"properties": [],"response": {"error": null,"hasMore": null,"hogql": null,"modifiers": {"bounceRateDurationSeconds": null,"bounceRatePageViewMode": "count_pageviews","convertToProjectTimezone": null,"customChannelTypeRules": null,"dataWarehouseEventsModifiers": null,"debug": null,"forceClickhouseDataSkippingIndexes": null,"formatCsvAllowDoubleQuotes": null,"inCohortVia": "auto","materializationMode": "auto","materializedColumnsOptimizationMode": "disabled","optimizeJoinedFilters": null,"optimizeProjections": null,"personsArgMaxVersion": "auto","personsJoinMode": "inner","personsOnEventsMode": "disabled","propertyGroupsMode": "enabled","s3TableUseInvalidColumns": null,"sessionTableVersion": "auto","sessionsV2JoinMode": "string","timings": null,"useMaterializedViews": null,"usePreaggregatedIntermediateResults": null,"usePreaggregatedTableTransforms": null,"useWebAnalyticsPreAggregatedTables": null},"query_status": {"complete": false,"dashboard_id": null,"end_time": null,"error": false,"error_message": null,"expiration_time": null,"id": "string","insight_id": null,"labels": null,"pickup_time": null,"query_async": true,"query_progress": {"active_cpu_time": 0,"bytes_read": 0,"estimated_rows_total": 0,"rows_read": 0,"time_elapsed": 0},"results": null,"start_time": null,"task_id": null,"team_id": 0},"resolved_date_range": {"date_from": "2019-08-24T14:15:22Z","date_to": "2019-08-24T14:15:22Z"},"results": [{}],"timings": null},"samplingFactor": null,"series": [{"custom_name": null,"fixedProperties": null,"kind": "GroupNode","limit": null,"math": null,"math_group_type_index": 0,"math_hogql": null,"math_multiplier": null,"math_property": null,"math_property_revenue_currency": {"property": null,"static": "AED"},"math_property_type": null,"name": null,"nodes": [{"custom_name": null,"event": null,"fixedProperties": null,"kind": "EventsNode","limit": null,"math": null,"math_group_type_index": 0,"math_hogql": null,"math_multiplier": null,"math_property": null,"math_property_revenue_currency": {"property": null,"static": "AED"},"math_property_type": null,"name": null,"optionalInFunnel": null,"orderBy": null,"properties": null,"response": null,"version": null}],"operator": "AND","optionalInFunnel": null,"orderBy": null,"properties": null,"response": null,"version": null}],"tags": {"name": null,"productKey": null,"scene": null},"trendsFilter": {"aggregationAxisFormat": "numeric","aggregationAxisPostfix": null,"aggregationAxisPrefix": null,"breakdown_histogram_bin_count": null,"confidenceLevel": null,"decimalPlaces": null,"detailedResultsAggregationType": "total","display": "Auto","formula": null,"formulaNodes": null,"formulas": null,"goalLines": null,"hiddenLegendIndexes": null,"minDecimalPlaces": null,"movingAverageIntervals": null,"resultCustomizationBy": "value","resultCustomizations": null,"showAlertThresholdLines": false,"showConfidenceIntervals": null,"showLabelsOnSeries": null,"showLegend": false,"showMovingAverage": null,"showMultipleYAxes": false,"showPercentStackView": false,"showTrendLines": null,"showValuesOnSeries": false,"smoothingIntervals": 1,"yAxisScaleType": "log10"},"version": null},"suppressSessionAnalysisWarning": null,"version": null,"vizSpecificOptions": {"ActionsPie": {"disableHoverOffset": null,"hideAggregation": null},"RETENTION": {"hideLineGraph": null,"hideSizeColumn": null,"useSmallLayout": null}}},"order": -2147483648,"deleted": true,"dashboards": [0],"dashboard_tiles": [{"id": 0,"dashboard_id": 0,"deleted": true}],"last_refresh": "string","cache_target_age": "string","next_allowed_client_refresh": "string","result": "string","hasMore": "string","columns": "string","created_at": "2019-08-24T14:15:22Z","created_by": {"id": 0,"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f","distinct_id": "string","first_name": "string","last_name": "string","email": "user@example.com","is_email_verified": true,"hedgehog_config": {"property1": null,"property2": null},"role_at_organization": "engineering"},"description": "string","updated_at": "2019-08-24T14:15:22Z","tags": [null],"favorited": true,"last_modified_at": "2019-08-24T14:15:22Z","last_modified_by": {"id": 0,"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f","distinct_id": "string","first_name": "string","last_name": "string","email": "user@example.com","is_email_verified": true,"hedgehog_config": {"property1": null,"property2": null},"role_at_organization": "engineering"},"is_sample": true,"effective_restriction_level": 21,"effective_privilege_level": 21,"user_access_level": "string","timezone": "string","is_cached": "string","query_status": "string","hogql": "string","types": "string","resolved_date_range": "string","_create_in_folder": "string","alerts": "string","last_viewed_at": "string"}
Update insights
Required API key scopes
insight:writePath parameters
- idinteger
- project_idstring
Query parameters
- formatstringOne of:
"csv""json"
Request parameters
- namestring
- derived_namestring
- query
- orderinteger
- deletedboolean
- dashboardsarray
- descriptionstring
- tagsarray
- favoritedboolean
- _create_in_folderstring
Response
Example request
PATCH /api /projects /:project_id /insights /:idexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl -X PATCH \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/projects/:project_id/insights/:id/\-d name="string"
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.patch("<ph_app_host>/api/projects/{project_id}/insights/{insights-2_id}/".format(project_id=project_id,insights-2_id="<the insights-2 id>"),headers={"Authorization": "Bearer {}".format(api_key)},data={"name": "string"}).json()
Example response
Status 200
RESPONSE
{"id": 0,"short_id": "string","name": "string","derived_name": "string","query": {"embedded": null,"full": null,"hidePersonsModal": null,"hideTooltipOnScroll": null,"kind": "InsightVizNode","showCorrelationTable": null,"showFilters": null,"showHeader": null,"showLastComputation": null,"showLastComputationRefresh": null,"showResults": null,"showTable": null,"source": {"aggregation_group_type_index": null,"breakdownFilter": {"breakdown": null,"breakdown_group_type_index": null,"breakdown_hide_other_aggregation": null,"breakdown_histogram_bin_count": null,"breakdown_limit": null,"breakdown_normalize_url": null,"breakdown_path_cleaning": null,"breakdown_type": "cohort","breakdowns": null},"compareFilter": {"compare": false,"compare_to": null},"conversionGoal": null,"dataColorTheme": null,"dateRange": {"date_from": null,"date_to": null,"explicitDate": false},"filterTestAccounts": false,"interval": "second","kind": "TrendsQuery","modifiers": {"bounceRateDurationSeconds": null,"bounceRatePageViewMode": "count_pageviews","convertToProjectTimezone": null,"customChannelTypeRules": null,"dataWarehouseEventsModifiers": null,"debug": null,"forceClickhouseDataSkippingIndexes": null,"formatCsvAllowDoubleQuotes": null,"inCohortVia": "auto","materializationMode": "auto","materializedColumnsOptimizationMode": "disabled","optimizeJoinedFilters": null,"optimizeProjections": null,"personsArgMaxVersion": "auto","personsJoinMode": "inner","personsOnEventsMode": "disabled","propertyGroupsMode": "enabled","s3TableUseInvalidColumns": null,"sessionTableVersion": "auto","sessionsV2JoinMode": "string","timings": null,"useMaterializedViews": null,"usePreaggregatedIntermediateResults": null,"usePreaggregatedTableTransforms": null,"useWebAnalyticsPreAggregatedTables": null},"properties": [],"response": {"error": null,"hasMore": null,"hogql": null,"modifiers": {"bounceRateDurationSeconds": null,"bounceRatePageViewMode": "count_pageviews","convertToProjectTimezone": null,"customChannelTypeRules": null,"dataWarehouseEventsModifiers": null,"debug": null,"forceClickhouseDataSkippingIndexes": null,"formatCsvAllowDoubleQuotes": null,"inCohortVia": "auto","materializationMode": "auto","materializedColumnsOptimizationMode": "disabled","optimizeJoinedFilters": null,"optimizeProjections": null,"personsArgMaxVersion": "auto","personsJoinMode": "inner","personsOnEventsMode": "disabled","propertyGroupsMode": "enabled","s3TableUseInvalidColumns": null,"sessionTableVersion": "auto","sessionsV2JoinMode": "string","timings": null,"useMaterializedViews": null,"usePreaggregatedIntermediateResults": null,"usePreaggregatedTableTransforms": null,"useWebAnalyticsPreAggregatedTables": null},"query_status": {"complete": false,"dashboard_id": null,"end_time": null,"error": false,"error_message": null,"expiration_time": null,"id": "string","insight_id": null,"labels": null,"pickup_time": null,"query_async": true,"query_progress": {"active_cpu_time": 0,"bytes_read": 0,"estimated_rows_total": 0,"rows_read": 0,"time_elapsed": 0},"results": null,"start_time": null,"task_id": null,"team_id": 0},"resolved_date_range": {"date_from": "2019-08-24T14:15:22Z","date_to": "2019-08-24T14:15:22Z"},"results": [{}],"timings": null},"samplingFactor": null,"series": [{"custom_name": null,"fixedProperties": null,"kind": "GroupNode","limit": null,"math": null,"math_group_type_index": 0,"math_hogql": null,"math_multiplier": null,"math_property": null,"math_property_revenue_currency": {"property": null,"static": "AED"},"math_property_type": null,"name": null,"nodes": [{"custom_name": null,"event": null,"fixedProperties": null,"kind": "EventsNode","limit": null,"math": null,"math_group_type_index": 0,"math_hogql": null,"math_multiplier": null,"math_property": null,"math_property_revenue_currency": {"property": null,"static": "AED"},"math_property_type": null,"name": null,"optionalInFunnel": null,"orderBy": null,"properties": null,"response": null,"version": null}],"operator": "AND","optionalInFunnel": null,"orderBy": null,"properties": null,"response": null,"version": null}],"tags": {"name": null,"productKey": null,"scene": null},"trendsFilter": {"aggregationAxisFormat": "numeric","aggregationAxisPostfix": null,"aggregationAxisPrefix": null,"breakdown_histogram_bin_count": null,"confidenceLevel": null,"decimalPlaces": null,"detailedResultsAggregationType": "total","display": "Auto","formula": null,"formulaNodes": null,"formulas": null,"goalLines": null,"hiddenLegendIndexes": null,"minDecimalPlaces": null,"movingAverageIntervals": null,"resultCustomizationBy": "value","resultCustomizations": null,"showAlertThresholdLines": false,"showConfidenceIntervals": null,"showLabelsOnSeries": null,"showLegend": false,"showMovingAverage": null,"showMultipleYAxes": false,"showPercentStackView": false,"showTrendLines": null,"showValuesOnSeries": false,"smoothingIntervals": 1,"yAxisScaleType": "log10"},"version": null},"suppressSessionAnalysisWarning": null,"version": null,"vizSpecificOptions": {"ActionsPie": {"disableHoverOffset": null,"hideAggregation": null},"RETENTION": {"hideLineGraph": null,"hideSizeColumn": null,"useSmallLayout": null}}},"order": -2147483648,"deleted": true,"dashboards": [0],"dashboard_tiles": [{"id": 0,"dashboard_id": 0,"deleted": true}],"last_refresh": "string","cache_target_age": "string","next_allowed_client_refresh": "string","result": "string","hasMore": "string","columns": "string","created_at": "2019-08-24T14:15:22Z","created_by": {"id": 0,"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f","distinct_id": "string","first_name": "string","last_name": "string","email": "user@example.com","is_email_verified": true,"hedgehog_config": {"property1": null,"property2": null},"role_at_organization": "engineering"},"description": "string","updated_at": "2019-08-24T14:15:22Z","tags": [null],"favorited": true,"last_modified_at": "2019-08-24T14:15:22Z","last_modified_by": {"id": 0,"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f","distinct_id": "string","first_name": "string","last_name": "string","email": "user@example.com","is_email_verified": true,"hedgehog_config": {"property1": null,"property2": null},"role_at_organization": "engineering"},"is_sample": true,"effective_restriction_level": 21,"effective_privilege_level": 21,"user_access_level": "string","timezone": "string","is_cached": "string","query_status": "string","hogql": "string","types": "string","resolved_date_range": "string","_create_in_folder": "string","alerts": "string","last_viewed_at": "string"}
Delete insights
Hard delete of this model is not allowed. Use a patch API call to set "deleted" to true
Required API key scopes
insight:writePath parameters
- idinteger
- project_idstring
Query parameters
- formatstringOne of:
"csv""json"
Example request
DELETE /api /projects /:project_id /insights /:idexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl -X DELETE \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/projects/:project_id/insights/:id/
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.delete("<ph_app_host>/api/projects/{project_id}/insights/{insights-2_id}/".format(project_id=project_id,insights-2_id="<the insights-2 id>"),headers={"Authorization": "Bearer {}".format(api_key)},)
Example response
Status 405 No response body
Retrieve insights activity retrieve
Required API key scopes
activity_log:readPath parameters
- idinteger
- project_idstring
Query parameters
- formatstringOne of:
"csv""json"
Example request
GET /api /projects /:project_id /insights /:id /activityexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/projects/:project_id/insights/:id/activity/
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.get("<ph_app_host>/api/projects/{project_id}/insights/{insights-2_id}/activity/".format(project_id=project_id,insights-2_id="<the insights-2 id>"),headers={"Authorization": "Bearer {}".format(api_key)},).json()
Example response
Status 200 No response body
Retrieve insights analyze
Path parameters
- idinteger
- project_idstring
Query parameters
- formatstringOne of:
"csv""json"
Example request
GET /api /projects /:project_id /insights /:id /analyzeexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/projects/:project_id/insights/:id/analyze/
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.get("<ph_app_host>/api/projects/{project_id}/insights/{insights-2_id}/analyze/".format(project_id=project_id,insights-2_id="<the insights-2 id>"),headers={"Authorization": "Bearer {}".format(api_key)},).json()
Example response
Status 200 No response body
Retrieve insights suggestions
Path parameters
- idinteger
- project_idstring
Query parameters
- formatstringOne of:
"csv""json"
Example request
GET /api /projects /:project_id /insights /:id /suggestionsexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/projects/:project_id/insights/:id/suggestions/
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.get("<ph_app_host>/api/projects/{project_id}/insights/{insights-2_id}/suggestions/".format(project_id=project_id,insights-2_id="<the insights-2 id>"),headers={"Authorization": "Bearer {}".format(api_key)},).json()
Example response
Status 200 No response body
Create insights suggestions
Path parameters
- idinteger
- project_idstring
Query parameters
- formatstringOne of:
"csv""json"
Request parameters
- namestring
- derived_namestring
- query
- orderinteger
- deletedboolean
- dashboardsarray
- descriptionstring
- tagsarray
- favoritedboolean
- _create_in_folderstring
Example request
POST /api /projects /:project_id /insights /:id /suggestionsexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl-H 'Content-Type: application/json'\-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/projects/:project_id/insights/:id/suggestions/\-d name="string"
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.post("<ph_app_host>/api/projects/{project_id}/insights/{insights-2_id}/suggestions/".format(project_id=project_id,insights-2_id="<the insights-2 id>"),headers={"Authorization": "Bearer {}".format(api_key)},data={"name": "string"}).json()
Example response
Status 200 No response body
Retrieve insights activity
Required API key scopes
activity_log:readPath parameters
- project_idstring
Query parameters
- formatstringOne of:
"csv""json"
Example request
GET /api /projects /:project_id /insights /activityexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/projects/:project_id/insights/activity/
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.get("<ph_app_host>/api/projects/{project_id}/insights/activity/".format(project_id=project_id),headers={"Authorization": "Bearer {}".format(api_key)},).json()
Example response
Status 200 No response body
Create insights cancel
Path parameters
- project_idstring
Query parameters
- formatstringOne of:
"csv""json"
Request parameters
- namestring
- derived_namestring
- query
- orderinteger
- deletedboolean
- dashboardsarray
- descriptionstring
- tagsarray
- favoritedboolean
- _create_in_folderstring
Example request
POST /api /projects /:project_id /insights /cancelexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl-H 'Content-Type: application/json'\-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/projects/:project_id/insights/cancel/\-d name="string"
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.post("<ph_app_host>/api/projects/{project_id}/insights/cancel/".format(project_id=project_id),headers={"Authorization": "Bearer {}".format(api_key)},data={"name": "string"}).json()