Insights-3
For instructions on how to authenticate to use this endpoint, see API overview.
Endpoints
POST | |
POST | |
POST | |
GET | |
GET | |
POST |
Create insights bulk update tags
Bulk update tags on multiple objects.
PAT access: this action has no required_scopes= on the decorator —
inheriting viewsets must add "bulk_update_tags" to their
scope_object_write_actions list to accept personal API keys.
Without that opt-in, APIScopePermission rejects PAT requests with
"This action does not support personal API key access". Done per-viewset
so granting <scope>:write for one resource doesn't leak access to
sibling resources that share this mixin.
Accepts:
- {"ids": [...], "action": "add"|"remove"|"set", "tags": ["tag1", "tag2"]}
Actions:
- "add": Add tags to existing tags on each object
- "remove": Remove specific tags from each object
- "set": Replace all tags on each object with the provided list
Query parameters
- formatstringOne of:
"csv""json"
Request parameters
- idsarray
- action
- tagsarray
Response
Example request
POST /api /projects /:project_id /insights /bulk_update_tagsExample response
Status 200
Create 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
- formatstringOne of:
"csv""json"
Request parameters
- namestringnull
- derived_namestringnull
- query
- orderintegernull
- deletedboolean
- dashboardsarray
- descriptionstringnull
- tagsarray
- favoritedboolean
- _create_in_folderstring
Example request
POST /api /projects /:project_id /insights /cancelExample response
Status 200 No response body
Create insights generate metadata
Generate an AI-suggested name and description for an insight based on its query configuration.
Required API key scopes
insight:writeQuery parameters
- formatstringOne of:
"csv""json"
Request parameters
- namestringnull
- derived_namestringnull
- query
- orderintegernull
- deletedboolean
- dashboardsarray
- descriptionstringnull
- tagsarray
- favoritedboolean
- _create_in_folderstring
Example request
POST /api /projects /:project_id /insights /generate_metadataExample 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.
Query parameters
- formatstringOne of:
"csv""json"
Example request
GET /api /projects /:project_id /insights /my_last_viewedExample response
Status 200 No response body
Retrieve insights trending
Also available via the PostHog MCP server:
insights-trending-retrieve— Get most-viewed insights
Returns insights ranked by view count over the last N days (default 7), highest first. Each result includes the same metadata as the standard insights list, plus a view_count and up to 3 recent viewers. Useful for surfacing the most-used insights in a project.
Required API key scopes
insight:readQuery parameters
- daysinteger
- formatstringOne of:
"csv""json" - limitinteger
- offsetinteger
Response
Example request
GET /api /projects /:project_id /insights /trendingExample response
Status 200
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. Returns 201 on success regardless of how many ids were retained.
Required API key scopes
insight:readQuery parameters
- formatstringOne of:
"csv""json"
Request parameters
- insight_idsarray
Example request
POST /api /projects /:project_id /insights /viewed