Sapilon becomes publicly available on 1 December 2026: 42 days to go. The core goes open source the same day →

PostHog integration

In short

Query product analytics, read insights, dashboards and feature flags. Connect it on the Integrations page; your app then calls PostHog through Sapilon without ever holding a PostHog credential.

Lets your app run HogQL queries over your PostHog events, and read saved insights, dashboards and feature flags.

Connecting

On the Integrations page choose Connect on PostHog and fill in:

  • Region — us or eu — the part before .posthog.com where you sign in.
  • Personal API key — PostHog → Settings → Personal API keys → Create. Give it read access to Query, Insight, Dashboard and Feature flag.

Sapilon checks the key with the provider before it saves it, and stores it encrypted; it is never shown again.

What your app can do

Only these requests are available; anything else is refused.

  • GET /api/projects
  • POST /api/projects/*/query
  • GET /api/projects/*/insights
  • GET /api/projects/*/insights/*
  • GET /api/projects/*/dashboards
  • GET /api/projects/*/feature_flags

How the agent uses it

Use integrations.request('posthog', …); paths are relative to https://<region>.posthog.com.

  • GET /api/projects — project ids.
  • POST /api/projects/{id}/query — HogQL. Example: { method: 'POST', path: '/api/projects/1234/query', body: { query: { kind: 'HogQLQuery', query: "select event, count() from events where timestamp > now() - interval 7 day group by event order by 2 desc limit 20" } } }. Rows are results, columns columns.
  • GET /api/projects/{id}/insights, GET /api/projects/{id}/insights/{insightId} — saved insights with their results.
  • GET /api/projects/{id}/dashboards, GET /api/projects/{id}/feature_flags.

Read-only. To send events from the app, use PostHog’s own client with the project key.

More from PostHog: https://posthog.com/docs/api

Last updated .

Was this page helpful?