Insights-3

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

Endpoints

POST
GET
GET
POST

Create insights generate name

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

Required API key scopes

insight:write

Path parameters

  • project_id
    string

Query parameters

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

Request parameters

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

Example request

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

Example 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_id
    string

Query parameters

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

Example request

GET /api/projects/:project_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/projects/:project_id/insights/my_last_viewed/

Example response

Status 200 No response body


Create insights viewed

Update insight view timestamps. Expects: {"insight_ids": [1, 2, 3, ...]}

Required API key scopes

insight:read

Path parameters

  • project_id
    string

Query parameters

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

Request parameters

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

Example request

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

Example response

Status 200 No response body

Community questions

Questions about this page? or post a community question.