Environments-7

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

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

Delete environments insights

Required API key scopes

insight:write

Path parameters

  • id
    integer

    A unique integer value identifying this insight.

  • project_id
    string

    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

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

Request

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

Response

Status 405 No response body

Delete environments insights

Required API key scopes

insight:write

Path parameters

  • id
    integer

    A unique integer value identifying this insight.

  • project_id
    string

    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

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

Request

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

Response

Status 405 No response body

Retrieve environments insights access controls

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.

Path parameters

  • id
    integer

    A unique integer value identifying this insight.

  • project_id
    string

    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

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

Response


Request

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

Response

Status 200
RESPONSE
{
"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
}
},
"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
}
},
"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"
}

Retrieve environments insights access controls

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.

Path parameters

  • id
    integer

    A unique integer value identifying this insight.

  • project_id
    string

    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

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

Response


Request

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

Response

Status 200
RESPONSE
{
"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
}
},
"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
}
},
"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"
}

Retrieve environments insights activity retrieve

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.

Required API key scopes

activity_log:read

Path parameters

  • id
    integer

    A unique integer value identifying this insight.

  • project_id
    string

    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

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

Request

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

Response

Status 200 No response body

Retrieve environments insights activity retrieve

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.

Required API key scopes

activity_log:read

Path parameters

  • id
    integer

    A unique integer value identifying this insight.

  • project_id
    string

    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

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

Request

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

Response

Status 200 No response body

Retrieve environments insights global access controls

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.

Path parameters

  • id
    integer

    A unique integer value identifying this insight.

  • project_id
    string

    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

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

Response


Request

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

Response

Status 200
RESPONSE
{
"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
}
},
"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
}
},
"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"
}

Retrieve environments insights global access controls

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.

Path parameters

  • id
    integer

    A unique integer value identifying this insight.

  • project_id
    string

    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

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

Response


Request

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

Response

Status 200
RESPONSE
{
"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
}
},
"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
}
},
"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 environments insights viewed

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.

Path parameters

  • id
    integer

    A unique integer value identifying this insight.

  • project_id
    string

    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

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

Request parameters

  • name
    string
  • derived_name
    string
  • filters
  • query

    Query node JSON string

  • order
    integer
  • deleted
    boolean
  • dashboards
    array
        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.
        
    
  • description
    string
  • tags
    array
  • favorited
    boolean
  • saved
    boolean

Request

POST /api/environments/:project_id/insights/:id/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/:project_id/insights/:id/viewed/\
-d name="string"

Response

Status 200 No response body

Create environments insights viewed

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.

Path parameters

  • id
    integer

    A unique integer value identifying this insight.

  • project_id
    string

    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

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

Request parameters

  • name
    string
  • derived_name
    string
  • filters
  • query

    Query node JSON string

  • order
    integer
  • deleted
    boolean
  • dashboards
    array
        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.
        
    
  • description
    string
  • tags
    array
  • favorited
    boolean
  • saved
    boolean

Request

POST /api/environments/:project_id/insights/:id/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/:project_id/insights/:id/viewed/\
-d name="string"

Response

Status 200 No response body

Retrieve environments insights activity

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.

Required API key scopes

activity_log:read

Path parameters

  • project_id
    string

    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

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

Request

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

Response

Status 200 No response body

Retrieve environments insights activity

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.

Required API key scopes

activity_log:read

Path parameters

  • project_id
    string

    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

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

Request

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

Response

Status 200 No response body

Create environments insights cancel

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.

Path parameters

  • project_id
    string

    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

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

Request parameters

  • name
    string
  • derived_name
    string
  • filters
  • query

    Query node JSON string

  • order
    integer
  • deleted
    boolean
  • dashboards
    array
        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.
        
    
  • description
    string
  • tags
    array
  • favorited
    boolean
  • saved
    boolean

Request

POST /api/environments/:project_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/:project_id/insights/cancel/\
-d name="string"

Response

Status 200 No response body

Create environments insights cancel

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.

Path parameters

  • project_id
    string

    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

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

Request parameters

  • name
    string
  • derived_name
    string
  • filters
  • query

    Query node JSON string

  • order
    integer
  • deleted
    boolean
  • dashboards
    array
        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.
        
    
  • description
    string
  • tags
    array
  • favorited
    boolean
  • saved
    boolean

Request

POST /api/environments/:project_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/:project_id/insights/cancel/\
-d name="string"

Response

Status 200 No response body

Retrieve environments insights funnel

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.

Required API key scopes

insight:read

Path parameters

  • project_id
    string

    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

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

Request

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

Response

Status 200 No response body

Retrieve environments insights funnel

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.

Required API key scopes

insight:read

Path parameters

  • project_id
    string

    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

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

Request

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

Response

Status 200 No response body
Next page →

Questions?

Was this page useful?