API referenceConsole
product analytics
Polylane reads PostHog error tracking, session replays and feature flag changes during investigations to find what changed and which users it affects.

Connect

Connect PostHog from the terminal. Pass --help for the flags PostHog accepts.

Terminal
polylane integration connect --type posthog

How it works

Error alerts become issues

The destination sends three PostHog error tracking events to Polylane: a new error, a reopened error, and a spiking error. Polylane checks the signature, the timestamp, and the project of each delivery, and drops a delivery that it already received. Each PostHog error maps to one Polylane issue, and Polylane investigates it. A spiking error arrives as critical. New and reopened errors arrive with the severity "error". PostHog sends no notice when an error recovers.

Polylane checks the destination every hour and repairs it if it is disabled or missing. The destination needs the hog_function:write scope. If the grant does not include it, Polylane sends a notice that asks you to reconnect PostHog. If PostHog refuses the destination for billing reasons, the daily checks keep running.

Daily checks

Product analytics settles per day, so Polylane checks the project once a day:

  • The event volume of the five most active events.
  • Trends pinned to a dashboard.
  • Number displays with a relative date range, recalculated from their saved query.
  • Saved trends, HogQL queries, and alert queries that Polylane can run, up to ten for each connection.

A clear change opens an issue. A check that cannot read complete data reports no reading, and never marks an issue as recovered. On the integration page, you can turn the checks off.

The checks and the agents share one request budget for the project. A result that Polylane serves from its cache does not use the budget.

Polylane also explores the connection when you connect it and every 12 hours after that, and records what it finds as issues.

During an investigation

Read PostHog data and request API changes through Polylane. Agents query product data, read saved insights, dashboards and notebooks, explain feature flag changes and experiments, read errors with their logs and traces, and find session replays and the affected users. Changes require safety review and approval, and the connected project's OAuth grant limits which operations are available.

Polylane refreshes the OAuth token. If the token stays expired for more than 12 hours, Polylane asks you to reconnect.

Scopes

ToolScopesWhat they unlock
posthogQueryuser:read, project:read, query:read, event_definition:read, property_definition:read, action:readQueries product data and discovers events, properties, and actions.
posthogInsightsinsight:read, dashboard:read, notebook:read, alert:readReads saved analysis, dashboards, notebooks, and alerts.
posthogChangesfeature_flag:read, experiment:read, experiment_holdout:read, experiment_saved_metric:read, early_access_feature:read, activity_log:readExplains feature changes, experiments, and rollouts.
posthogAnnotationsannotation:readReads chart annotations.
posthogErrorserror_tracking:read, health_issue:read, logs:read, metrics:read, tracing:read, llm_analytics:read, endpoint:readReads errors and the telemetry that explains them.
posthogReplayssession_recording:read, session_recording_playlist:read, person:read, cohort:read, group:read, survey:readFinds sessions and the audiences affected.
Alert deliveryhog_function:writeManages one HTTP destination for error tracking issue alerts.
posthogApiorganization:read, hog_function:read, batch_export:read, warehouse_table:read, warehouse_view:read, external_data_source:read, integration:read, web_analytics:read, heatmap:read, annotation:write, dashboard:writeCalls the PostHog API. A call other than GET needs a reason and must stay within the granted scopes.

Disconnecting

Disconnecting deletes the destination that Polylane created and leaves the PostHog authorized application in place. Remove it under Settings → Connected applications in PostHog. Polylane does not revoke the application itself. A revoke in PostHog removes every grant that you gave the application.

Disconnect

Disconnecting stops every sync and check and deletes the credentials Polylane held. Polylane removes what PostHog's API lets it remove. The following stays until you remove it yourself:

  • PostHog authorized application
Terminal
polylane integration disconnect <id>

Tools

7

Operations agents can perform in threads.

Query
Query PostHog analytics or discover the event and property vocabulary for a bounded date range
Insights
Read the PostHog insights, dashboards, alerts and notebooks the team watches
Changes
Read PostHog feature flags, experiments, releases and activity that explain what changed
Annotations
List PostHog project annotations before recording a new event
Errors
Read PostHog error-tracking issues, their events, stack frames and spike history
Replays
Read PostHog session recordings and playlists to understand what users saw
Api
Call the connected PostHog REST API