Insights
For instructions on how to authenticate to use this endpoint, see API overview.
Adds an "access_controls" action to the viewset that handles access control for the given resource
Why a mixin? We want to easily add this to any existing resource, including providing easy helpers for adding access control info such as the current users access level to any response.
Endpoints
List all insights
Required API key scopes
insight:readPath parameters
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Query parameters
- created_byinteger
- formatstringOne of:
"csv""json" - limitinteger
Number of results to return per page.
- offsetinteger
The initial index from which to return the results.
- refreshstringDefault:
force_cacheOne of:"async""async_except_on_cache_miss""blocking""force_async""force_blocking""force_cache""lazy_async"Whether to refresh the retrieved insights, how aggresively, and if sync or async:
'force_cache'- return cached data or a cache miss; always completes immediately as it never calculates'blocking'- calculate synchronously (returning only when the query is done), UNLESS there are very fresh results in the cache'async'- kick off background calculation (returning immediately with a query status), UNLESS there are very fresh results in the cache'lazy_async'- kick off background calculation, UNLESS there are somewhat fresh results in the cache'force_blocking'- calculate synchronously, even if fresh results are already cached'force_async'- kick off background calculation, even if fresh results are already cached Background calculation can be tracked using thequery_statusresponse field.
- short_idstring
Response
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/
Response
Status 200
{"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","filters": null,"query": 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,"saved": 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"}]}
Create insights
Required API key scopes
insight:writePath parameters
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Query parameters
- formatstringOne of:
"csv""json"
Request parameters
- namestring
- derived_namestring
- filters
- query
Query node JSON string
- orderinteger
- deletedboolean
- dashboardsarray
DEPRECATED. Will be removed in a future release. Use dashboard_tiles instead. A dashboard ID for each of the dashboards that this insight is displayed on. - descriptionstring
- tagsarray
- favoritedboolean
- savedboolean
Response
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"
Response
Status 201
{"id": 0,"short_id": "string","name": "string","derived_name": "string","filters": null,"query": 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,"saved": 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"}
List all insights sharing
Required API key scopes
sharing_configuration:readPath parameters
- insight_idinteger
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
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/
Response
Status 200
{"created_at": "2019-08-24T14:15:22Z","enabled": true,"access_token": "string"}
Retrieve insights
Required API key scopes
insight:readPath parameters
- idinteger
A unique integer value identifying this insight.
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Query parameters
- formatstringOne of:
"csv""json" - from_dashboardinteger
Only if loading an insight in the context of a dashboard: The relevant dashboard's ID. When set, the specified dashboard's filters and date range override will be applied.
- refreshstringDefault:
force_cacheOne of:"async""async_except_on_cache_miss""blocking""force_async""force_blocking""force_cache""lazy_async"Whether to refresh the insight, how aggresively, and if sync or async:
'force_cache'- return cached data or a cache miss; always completes immediately as it never calculates'blocking'- calculate synchronously (returning only when the query is done), UNLESS there are very fresh results in the cache'async'- kick off background calculation (returning immediately with a query status), UNLESS there are very fresh results in the cache'lazy_async'- kick off background calculation, UNLESS there are somewhat fresh results in the cache'force_blocking'- calculate synchronously, even if fresh results are already cached'force_async'- kick off background calculation, even if fresh results are already cached Background calculation can be tracked using thequery_statusresponse field.
Response
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/
Response
Status 200
{"id": 0,"short_id": "string","name": "string","derived_name": "string","filters": null,"query": 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,"saved": 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"}
Update insights
Required API key scopes
insight:writePath parameters
- idinteger
A unique integer value identifying this insight.
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Query parameters
- formatstringOne of:
"csv""json"
Request parameters
- namestring
- derived_namestring
- filters
- query
Query node JSON string
- orderinteger
- deletedboolean
- dashboardsarray
DEPRECATED. Will be removed in a future release. Use dashboard_tiles instead. A dashboard ID for each of the dashboards that this insight is displayed on. - descriptionstring
- tagsarray
- favoritedboolean
- savedboolean
Response
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"
Response
Status 200
{"id": 0,"short_id": "string","name": "string","derived_name": "string","filters": null,"query": 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,"saved": 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"}
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
A unique integer value identifying this insight.
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Query parameters
- formatstringOne of:
"csv""json"
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/
Response
Status 405 No response body
Retrieve insights activity retrieve
Required API key scopes
activity_log:readPath parameters
- idinteger
A unique integer value identifying this insight.
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Query parameters
- formatstringOne of:
"csv""json"
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/
Response
Status 200 No response body
Create insights viewed
Required API key scopes
insight:readPath parameters
- idinteger
A unique integer value identifying this insight.
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Query parameters
- formatstringOne of:
"csv""json"
Request parameters
- namestring
- derived_namestring
- filters
- query
Query node JSON string
- orderinteger
- deletedboolean
- dashboardsarray
DEPRECATED. Will be removed in a future release. Use dashboard_tiles instead. A dashboard ID for each of the dashboards that this insight is displayed on. - descriptionstring
- tagsarray
- favoritedboolean
- savedboolean
Request
POST /api /projects /:project_id /insights /:id /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/projects/:project_id/insights/:id/viewed/\-d name="string"
Response
Status 200 No response body
Retrieve insights activity
Required API key scopes
activity_log:readPath parameters
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Query parameters
- formatstringOne of:
"csv""json"
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/
Response
Status 200 No response body
Create insights cancel
Path parameters
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Query parameters
- formatstringOne of:
"csv""json"
Request parameters
- namestring
- derived_namestring
- filters
- query
Query node JSON string
- orderinteger
- deletedboolean
- dashboardsarray
DEPRECATED. Will be removed in a future release. Use dashboard_tiles instead. A dashboard ID for each of the dashboards that this insight is displayed on. - descriptionstring
- tagsarray
- favoritedboolean
- savedboolean
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"
Response
Status 200 No response body
Retrieve insights funnel
Required API key scopes
insight:readPath parameters
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Query parameters
- formatstringOne of:
"csv""json"
Request
GET /api /projects /:project_id /insights /funnelexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/projects/:project_id/insights/funnel/
Response
Status 200 No response body
Create insights funnel
Required API key scopes
insight:readPath parameters
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Query parameters
- formatstringOne of:
"csv""json"
Request parameters
- namestring
- derived_namestring
- filters
- query
Query node JSON string
- orderinteger
- deletedboolean
- dashboardsarray
DEPRECATED. Will be removed in a future release. Use dashboard_tiles instead. A dashboard ID for each of the dashboards that this insight is displayed on. - descriptionstring
- tagsarray
- favoritedboolean
- savedboolean
Request
POST /api /projects /:project_id /insights /funnelexport 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/funnel/\-d name="string"
Response
Status 200 No response body
Retrieve insights funnel correlation
Path parameters
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Query parameters
- formatstringOne of:
"csv""json"
Request
GET /api /projects /:project_id /insights /funnel /correlationexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/projects/:project_id/insights/funnel/correlation/
Response
Status 200 No response body
Create insights funnel correlation
Path parameters
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Query parameters
- formatstringOne of:
"csv""json"
Request parameters
- namestring
- derived_namestring
- filters
- query
Query node JSON string
- orderinteger
- deletedboolean
- dashboardsarray
DEPRECATED. Will be removed in a future release. Use dashboard_tiles instead. A dashboard ID for each of the dashboards that this insight is displayed on. - descriptionstring
- tagsarray
- favoritedboolean
- savedboolean
Request
POST /api /projects /:project_id /insights /funnel /correlationexport 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/funnel/correlation/\-d name="string"
Response
Status 200 No response body
Retrieve insights my last viewed
Returns basic details about the last 5 insights viewed by this user. Most recently viewed first.
Path parameters
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Query parameters
- formatstringOne of:
"csv""json"
Request
GET /api /projects /:project_id /insights /my_last_viewedexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/projects/:project_id/insights/my_last_viewed/
Response
Status 200 No response body
Create insights timing
Path parameters
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Query parameters
- formatstringOne of:
"csv""json"
Request parameters
- namestring
- derived_namestring
- filters
- query
Query node JSON string
- orderinteger
- deletedboolean
- dashboardsarray
DEPRECATED. Will be removed in a future release. Use dashboard_tiles instead. A dashboard ID for each of the dashboards that this insight is displayed on. - descriptionstring
- tagsarray
- favoritedboolean
- savedboolean
Request
POST /api /projects /:project_id /insights /timingexport 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/timing/\-d name="string"
Response
Status 200 No response body
Retrieve insights trend
Required API key scopes
insight:readPath parameters
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Query parameters
- formatstringOne of:
"csv""json"
Request
GET /api /projects /:project_id /insights /trendexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/projects/:project_id/insights/trend/
Response
Status 200 No response body
Create insights trend
Required API key scopes
insight:readPath parameters
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Query parameters
- formatstringOne of:
"csv""json"
Request parameters
- namestring
- derived_namestring
- filters
- query
Query node JSON string
- orderinteger
- deletedboolean
- dashboardsarray
DEPRECATED. Will be removed in a future release. Use dashboard_tiles instead. A dashboard ID for each of the dashboards that this insight is displayed on. - descriptionstring
- tagsarray
- favoritedboolean
- savedboolean
Request
POST /api /projects /:project_id /insights /trendexport 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/trend/\-d name="string"