Klairr queries PostHog via HogQL — a SQL dialect over ClickHouse. Authentication uses a Personal API key with read scope.
Step 1: Create a Personal API key
In PostHog: Settings → Personal API keys → Create personal API key. Give it a clear name (“Klairr read”) and a 90-day rotation cadence.
The key needs read scope only. Klairr does not request plugins:write, cohorts:write, feature_flags:write, or any organization-wide scope.
Step 2: Find your project ID
PostHog → Project settings. The numeric ID is shown at the top of the page.
Step 3: Add the connector
| Field | Example |
|---|---|
| PostHog host | https://us.posthog.com |
| Project ID | 12345 |
| Personal API key | phx_… |
For self-hosted PostHog, use your origin (e.g. https://posthog.internal.example.com). For PostHog Cloud, use https://us.posthog.com (US) or https://eu.posthog.com (EU).
What Klairr queries
- Schema comes from
/api/projects/<id>/property_definitions/— the project’s full event and person property taxonomy. - Question answering issues HogQL queries through
/api/projects/<id>/query/. HogQL is read-only by design; Klairr also pre-checks every query for write keywords as a defence-in-depth layer. - Two virtual tables:
events(event stream) andpersons(identified users with merged distinct_ids).
Notes
- HogQL function names mostly track ClickHouse; the prompt shipped to the LLM includes dialect hints.
- Property values use dot-paths:
properties.utm_campaign. - A server-side LIMIT is always applied — even if you ask for “all events”, Klairr returns the first N matching rows.