Insights

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

Endpoints

GET
GET
POST

Retrieve 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/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

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, as are views from impersonated staff-support sessions. 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/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 insight_ids="array"

Example response

Status 201 Views recorded.