Product

For instructions on how to authenticate to use this endpoint, see API overview.

Endpoints

POST
POST
GET
GET
POST
GET
POST
GET
PATCH
DELETE
GET
GET
GET
POST
GET
PATCH
DELETE
GET

Create environments insights cancel

DRF ViewSet mixin that gates coalesced responses behind permission checks.

The QueryCoalescingMiddleware attaches cached response data to request.META["_coalesced_response"] for followers. This mixin runs DRF's initial() (auth + permissions + throttling) before returning the cached response, ensuring the request is authorized.

Query parameters

  • format
    string
    One of: "csv""json"

Request parameters

  • name
    stringnull
  • derived_name
    stringnull
  • query
  • order
    integernull
  • deleted
    boolean
  • dashboards
    array
  • description
    stringnull
  • tags
    array
  • favorited
    boolean
  • _create_in_folder
    string

Example request

POST /api/environments/:environment_id/insights/cancel
export 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/cancel/\
-d name=["string","null"]

Example response

Status 200 No response body

Create environments insights generate metadata

Generate an AI-suggested name and description for an insight based on its query configuration.

Required API key scopes

insight:write

Query parameters

  • format
    string
    One of: "csv""json"

Request parameters

  • name
    stringnull
  • derived_name
    stringnull
  • query
  • order
    integernull
  • deleted
    boolean
  • dashboards
    array
  • description
    stringnull
  • tags
    array
  • favorited
    boolean
  • _create_in_folder
    string

Example request

POST /api/environments/:environment_id/insights/generate_metadata
export 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/generate_metadata/\
-d name=["string","null"]

Example response

Status 200 No response body

Retrieve environments insights my last viewed

Returns basic details about the last 5 insights viewed by this user. Most recently viewed first.

Query parameters

  • format
    string
    One of: "csv""json"

Example request

GET /api/environments/:environment_id/insights/my_last_viewed
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:environment_id/insights/my_last_viewed/

Example response

Status 200 No response body


Create environments insights viewed

Record that the current user has just viewed one or more insights. Submitted ids that do not belong to the current project or that point at deleted insights are silently dropped. Returns 201 on success regardless of how many ids were retained.

Required API key scopes

insight:read

Query parameters

  • format
    string
    One of: "csv""json"

Request parameters

  • insight_ids
    array

Example request

POST /api/environments/:environment_id/insights/viewed
export 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 insight_ids="array"

Example response

Status 201 Views recorded.

List all elements

Required API key scopes

element:read

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

GET /api/projects/:project_id/elements
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/elements/

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": [
{
"text": "string",
"tag_name": "string",
"attr_class": [
"string"
],
"href": "string",
"attr_id": "string",
"nth_child": -2147483648,
"nth_of_type": -2147483648,
"attributes": null,
"order": -2147483648
}
]
}

Create elements

Required API key scopes

element:write

Request parameters

  • text
    stringnull
  • tag_name
    stringnull
  • attr_class
    arraynull
  • href
    stringnull
  • attr_id
    stringnull
  • nth_child
    integernull
  • nth_of_type
    integernull
  • attributes
  • order
    integernull

Response


Example request

POST /api/projects/:project_id/elements
export 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/elements/\
-d text=["string","null"]

Example response

Status 201
RESPONSE
{
"text": "string",
"tag_name": "string",
"attr_class": [
"string"
],
"href": "string",
"attr_id": "string",
"nth_child": -2147483648,
"nth_of_type": -2147483648,
"attributes": null,
"order": -2147483648
}

Retrieve elements

Required API key scopes

element:read

Path parameters

  • id
    integer

Response


Example request

GET /api/projects/:project_id/elements/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/elements/:id/

Example response

Status 200
RESPONSE
{
"text": "string",
"tag_name": "string",
"attr_class": [
"string"
],
"href": "string",
"attr_id": "string",
"nth_child": -2147483648,
"nth_of_type": -2147483648,
"attributes": null,
"order": -2147483648
}

Update elements

Required API key scopes

element:write

Path parameters

  • id
    integer

Request parameters

  • text
    stringnull
  • tag_name
    stringnull
  • attr_class
    arraynull
  • href
    stringnull
  • attr_id
    stringnull
  • nth_child
    integernull
  • nth_of_type
    integernull
  • attributes
  • order
    integernull

Response


Example request

PATCH /api/projects/:project_id/elements/:id
export 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/elements/:id/\
-d text=["string","null"]

Example response

Status 200
RESPONSE
{
"text": "string",
"tag_name": "string",
"attr_class": [
"string"
],
"href": "string",
"attr_id": "string",
"nth_child": -2147483648,
"nth_of_type": -2147483648,
"attributes": null,
"order": -2147483648
}

Delete elements

Required API key scopes

element:write

Path parameters

  • id
    integer

Example request

DELETE /api/projects/:project_id/elements/:id
export 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/elements/:id/

Example response

Status 204 No response body

Retrieve elements stats

The original version of this API always and only returned $autocapture elements If no include query parameter is sent this remains true. Now, you can pass a combination of include query parameters to get different types of elements Currently only $autocapture and $rageclick and $dead_click are supported

Required API key scopes

element:read

Example request

GET /api/projects/:project_id/elements/stats
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/elements/stats/

Example response

Status 200 No response body

Retrieve elements values

Required API key scopes

element:read

Example request

GET /api/projects/:project_id/elements/values
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/elements/values/

Example response

Status 200 No response body

List all insights

Also available via the PostHog MCP server:

  • insights-listGet all insights

DRF ViewSet mixin that gates coalesced responses behind permission checks.

The QueryCoalescingMiddleware attaches cached response data to request.META["_coalesced_response"] for followers. This mixin runs DRF's initial() (auth + permissions + throttling) before returning the cached response, ensuring the request is authorized.

Required API key scopes

insight:read

Query parameters

  • basic
    boolean
  • created_by
    string
  • created_date_from
    string
  • created_date_to
    string
  • dashboards
    string
  • date_from
    string
  • date_to
    string
  • favorited
    boolean
  • format
    string
    One of: "csv""json"
  • insight
    string
    One of: "FUNNELS""JSON""LIFECYCLE""PATHS""RETENTION""SQL""STICKINESS""TRENDS"
  • last_viewed_date_from
    string
  • last_viewed_date_to
    string
  • limit
    integer
  • offset
    integer
  • refresh
    string
    Default: force_cache
    One of: "async""async_except_on_cache_miss""blocking""force_async""force_blocking""force_cache""lazy_async"
  • saved
    boolean
  • search
    string
  • short_id
    string
  • tags
    string
  • user
    boolean

Response


Example request

GET /api/projects/:project_id/insights
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/insights/

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": null,
"compareFilter": null,
"conversionGoal": null,
"dataColorTheme": null,
"dateRange": null,
"filterTestAccounts": false,
"interval": "day",
"kind": "TrendsQuery",
"modifiers": null,
"properties": [],
"response": null,
"samplingFactor": null,
"series": [
{
"custom_name": null,
"fixedProperties": null,
"kind": "GroupNode",
"limit": null,
"math": null,
"math_group_type_index": null,
"math_hogql": null,
"math_multiplier": null,
"math_property": null,
"math_property_revenue_currency": null,
"math_property_type": null,
"name": null,
"nodes": [
{
"custom_name": null,
"event": null,
"fixedProperties": null,
"kind": "EventsNode",
"limit": null,
"math": null,
"math_group_type_index": null,
"math_hogql": null,
"math_multiplier": null,
"math_property": null,
"math_property_revenue_currency": null,
"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": null,
"trendsFilter": null,
"version": null
},
"suppressSessionAnalysisWarning": null,
"version": null,
"vizSpecificOptions": null
},
"order": -2147483648,
"deleted": true,
"dashboards": [
0
],
"dashboard_tiles": [
{
"id": 0,
"dashboard_id": 0,
"deleted": true
}
],
"last_refresh": "2019-08-24T14:15:22Z",
"cache_target_age": "2019-08-24T14:15:22Z",
"next_allowed_client_refresh": "2019-08-24T14:15:22Z",
"result": null,
"hasMore": true,
"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": {},
"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": {},
"role_at_organization": "engineering"
},
"is_sample": true,
"effective_restriction_level": 21,
"effective_privilege_level": 21,
"user_access_level": "string",
"timezone": "string",
"is_cached": true,
"query_status": null,
"hogql": "string",
"types": [
null
],
"resolved_date_range": {
"date_from": "2019-08-24T14:15:22Z",
"date_to": "2019-08-24T14:15:22Z"
},
"_create_in_folder": "string",
"alerts": [
null
],
"last_viewed_at": "2019-08-24T14:15:22Z"
}
]
}

Create insights

Also available via the PostHog MCP server:

  • insight-createCreate insight

DRF ViewSet mixin that gates coalesced responses behind permission checks.

The QueryCoalescingMiddleware attaches cached response data to request.META["_coalesced_response"] for followers. This mixin runs DRF's initial() (auth + permissions + throttling) before returning the cached response, ensuring the request is authorized.

Required API key scopes

insight:write

Query parameters

  • format
    string
    One of: "csv""json"

Request parameters

  • name
    stringnull
  • derived_name
    stringnull
  • query
  • order
    integernull
  • deleted
    boolean
  • dashboards
    array
  • description
    stringnull
  • tags
    array
  • favorited
    boolean
  • _create_in_folder
    string

Response


Example request

POST /api/projects/:project_id/insights
export 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","null"]

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": null,
"compareFilter": null,
"conversionGoal": null,
"dataColorTheme": null,
"dateRange": null,
"filterTestAccounts": false,
"interval": "day",
"kind": "TrendsQuery",
"modifiers": null,
"properties": [],
"response": null,
"samplingFactor": null,
"series": [
{
"custom_name": null,
"fixedProperties": null,
"kind": "GroupNode",
"limit": null,
"math": null,
"math_group_type_index": null,
"math_hogql": null,
"math_multiplier": null,
"math_property": null,
"math_property_revenue_currency": null,
"math_property_type": null,
"name": null,
"nodes": [
{
"custom_name": null,
"event": null,
"fixedProperties": null,
"kind": "EventsNode",
"limit": null,
"math": null,
"math_group_type_index": null,
"math_hogql": null,
"math_multiplier": null,
"math_property": null,
"math_property_revenue_currency": null,
"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": null,
"trendsFilter": null,
"version": null
},
"suppressSessionAnalysisWarning": null,
"version": null,
"vizSpecificOptions": null
},
"order": -2147483648,
"deleted": true,
"dashboards": [
0
],
"dashboard_tiles": [
{
"id": 0,
"dashboard_id": 0,
"deleted": true
}
],
"last_refresh": "2019-08-24T14:15:22Z",
"cache_target_age": "2019-08-24T14:15:22Z",
"next_allowed_client_refresh": "2019-08-24T14:15:22Z",
"result": null,
"hasMore": true,
"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": {},
"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": {},
"role_at_organization": "engineering"
},
"is_sample": true,
"effective_restriction_level": 21,
"effective_privilege_level": 21,
"user_access_level": "string",
"timezone": "string",
"is_cached": true,
"query_status": null,
"hogql": "string",
"types": [
null
],
"resolved_date_range": {
"date_from": "2019-08-24T14:15:22Z",
"date_to": "2019-08-24T14:15:22Z"
},
"_create_in_folder": "string",
"alerts": [
null
],
"last_viewed_at": "2019-08-24T14:15:22Z"
}

Retrieve insights

Also available via the PostHog MCP server:

  • insight-getGet insight

DRF ViewSet mixin that gates coalesced responses behind permission checks.

The QueryCoalescingMiddleware attaches cached response data to request.META["_coalesced_response"] for followers. This mixin runs DRF's initial() (auth + permissions + throttling) before returning the cached response, ensuring the request is authorized.

Required API key scopes

insight:read

Path parameters

  • id

Query parameters

  • filters_override
    string
  • format
    string
    One of: "csv""json"
  • from_dashboard
    integer
  • refresh
    string
    Default: force_cache
    One of: "async""async_except_on_cache_miss""blocking""force_async""force_blocking""force_cache""lazy_async"
  • variables_override
    string

Response


Example request

GET /api/projects/:project_id/insights/:id
export 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/

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": null,
"compareFilter": null,
"conversionGoal": null,
"dataColorTheme": null,
"dateRange": null,
"filterTestAccounts": false,
"interval": "day",
"kind": "TrendsQuery",
"modifiers": null,
"properties": [],
"response": null,
"samplingFactor": null,
"series": [
{
"custom_name": null,
"fixedProperties": null,
"kind": "GroupNode",
"limit": null,
"math": null,
"math_group_type_index": null,
"math_hogql": null,
"math_multiplier": null,
"math_property": null,
"math_property_revenue_currency": null,
"math_property_type": null,
"name": null,
"nodes": [
{
"custom_name": null,
"event": null,
"fixedProperties": null,
"kind": "EventsNode",
"limit": null,
"math": null,
"math_group_type_index": null,
"math_hogql": null,
"math_multiplier": null,
"math_property": null,
"math_property_revenue_currency": null,
"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": null,
"trendsFilter": null,
"version": null
},
"suppressSessionAnalysisWarning": null,
"version": null,
"vizSpecificOptions": null
},
"order": -2147483648,
"deleted": true,
"dashboards": [
0
],
"dashboard_tiles": [
{
"id": 0,
"dashboard_id": 0,
"deleted": true
}
],
"last_refresh": "2019-08-24T14:15:22Z",
"cache_target_age": "2019-08-24T14:15:22Z",
"next_allowed_client_refresh": "2019-08-24T14:15:22Z",
"result": null,
"hasMore": true,
"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": {},
"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": {},
"role_at_organization": "engineering"
},
"is_sample": true,
"effective_restriction_level": 21,
"effective_privilege_level": 21,
"user_access_level": "string",
"timezone": "string",
"is_cached": true,
"query_status": null,
"hogql": "string",
"types": [
null
],
"resolved_date_range": {
"date_from": "2019-08-24T14:15:22Z",
"date_to": "2019-08-24T14:15:22Z"
},
"_create_in_folder": "string",
"alerts": [
null
],
"last_viewed_at": "2019-08-24T14:15:22Z"
}

Update insights

Also available via the PostHog MCP server:

  • insight-updateUpdate insight

DRF ViewSet mixin that gates coalesced responses behind permission checks.

The QueryCoalescingMiddleware attaches cached response data to request.META["_coalesced_response"] for followers. This mixin runs DRF's initial() (auth + permissions + throttling) before returning the cached response, ensuring the request is authorized.

Required API key scopes

insight:write

Path parameters

  • id

Query parameters

  • format
    string
    One of: "csv""json"

Request parameters

  • name
    stringnull
  • derived_name
    stringnull
  • query
  • order
    integernull
  • deleted
    boolean
  • dashboards
    array
  • description
    stringnull
  • tags
    array
  • favorited
    boolean
  • _create_in_folder
    string

Response


Example request

PATCH /api/projects/:project_id/insights/:id
export 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","null"]

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": null,
"compareFilter": null,
"conversionGoal": null,
"dataColorTheme": null,
"dateRange": null,
"filterTestAccounts": false,
"interval": "day",
"kind": "TrendsQuery",
"modifiers": null,
"properties": [],
"response": null,
"samplingFactor": null,
"series": [
{
"custom_name": null,
"fixedProperties": null,
"kind": "GroupNode",
"limit": null,
"math": null,
"math_group_type_index": null,
"math_hogql": null,
"math_multiplier": null,
"math_property": null,
"math_property_revenue_currency": null,
"math_property_type": null,
"name": null,
"nodes": [
{
"custom_name": null,
"event": null,
"fixedProperties": null,
"kind": "EventsNode",
"limit": null,
"math": null,
"math_group_type_index": null,
"math_hogql": null,
"math_multiplier": null,
"math_property": null,
"math_property_revenue_currency": null,
"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": null,
"trendsFilter": null,
"version": null
},
"suppressSessionAnalysisWarning": null,
"version": null,
"vizSpecificOptions": null
},
"order": -2147483648,
"deleted": true,
"dashboards": [
0
],
"dashboard_tiles": [
{
"id": 0,
"dashboard_id": 0,
"deleted": true
}
],
"last_refresh": "2019-08-24T14:15:22Z",
"cache_target_age": "2019-08-24T14:15:22Z",
"next_allowed_client_refresh": "2019-08-24T14:15:22Z",
"result": null,
"hasMore": true,
"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": {},
"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": {},
"role_at_organization": "engineering"
},
"is_sample": true,
"effective_restriction_level": 21,
"effective_privilege_level": 21,
"user_access_level": "string",
"timezone": "string",
"is_cached": true,
"query_status": null,
"hogql": "string",
"types": [
null
],
"resolved_date_range": {
"date_from": "2019-08-24T14:15:22Z",
"date_to": "2019-08-24T14:15:22Z"
},
"_create_in_folder": "string",
"alerts": [
null
],
"last_viewed_at": "2019-08-24T14:15:22Z"
}

Delete insights

Also available via the PostHog MCP server:

  • insight-deleteDelete insight

Hard delete of this model is not allowed. Use a patch API call to set "deleted" to true

Required API key scopes

insight:write

Path parameters

  • id

Query parameters

  • format
    string
    One of: "csv""json"

Example request

DELETE /api/projects/:project_id/insights/:id
export 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/

Example response

Status 405 No response body

Retrieve insights activity

Also available via the PostHog MCP server:

  • insights-activity-retrieveGet insight activity log

Audit trail for a single insight — every change made to it, by whom, and when. Use this when you want the change history of a specific insight; use the project-wide activity endpoint for a broader view.

Required API key scopes

activity_log:read

Path parameters

  • id
    integer

Query parameters

  • format
    string
    One of: "csv""json"
  • limit
    integer
  • page
    integer

Response


Example request

GET /api/projects/:project_id/insights/:id/activity
export 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/

Example response

Status 200
RESPONSE
{
"results": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"user": {},
"activity": "string",
"scope": "string",
"item_id": "string",
"detail": {
"id": "string",
"changes": [
{
"type": "string",
"action": "string",
"field": "string",
"before": null,
"after": null
}
],
"merge": {
"type": "string",
"source": null,
"target": null
},
"trigger": {
"job_type": "string",
"job_id": "string",
"payload": null
},
"name": "string",
"short_id": "string",
"type": "string"
},
"created_at": "2019-08-24T14:15:22Z"
}
],
"next": "http://example.com",
"previous": "http://example.com",
"total_count": 0
}

Community questions

Questions about this page? or post a community question.