Skip to main content

PostHog

This page contains the setup guide and reference information for the PostHog source connector.

Prerequisites​

  • A PostHog account on PostHog Cloud (US or EU) or a self-hosted PostHog instance.

  • A personal API key with the following read scopes:

    ScopeUsed by stream
    project:readprojects, and to list the projects that every other stream reads from
    annotation:readannotations
    cohort:readcohorts
    feature_flag:readfeature_flags
    insight:readinsights
    person:readpersons
    query:readevents

    If you only plan to sync some streams, you can omit the scopes for the streams you don't use, but project:read is always required. The connector uses the projects stream to check the connection.

Setup guide​

Step 1: Create a PostHog personal API key​

  1. In PostHog, go to the Personal API keys section of your account settings.
  2. Click + Create a personal API key and give the key a label.
  3. Select the read scopes listed in Prerequisites.
  4. Copy the key value immediately. PostHog doesn't show it again after you refresh the page.

For more details, see PostHog's personal API keys documentation.

Step 2: Set up the PostHog connector in Airbyte​

  1. In Airbyte, go to Sources and click + New source.
  2. Select PostHog from the list of sources.
  3. Enter a name for the source.
  4. For API Key, enter the personal API key you created in Step 1.
  5. For Start Date, enter the UTC date and time in the format YYYY-MM-DDTHH:mm:ssZ, for example 2021-01-01T00:00:00Z. The connector uses this value for events when no saved cursor is available. Saved per-project or legacy shared cursors take precedence, even if they are earlier than this date. Other streams use full refresh.
  6. (Optional) For Base URL, enter the URL of your PostHog instance. The default is https://app.posthog.com. If your project is on PostHog EU Cloud, enter https://eu.posthog.com. If you self-host PostHog, enter your instance's domain, for example https://posthog.example.com. Don't include the /api path, because the connector adds it.
  7. (Optional) For Events stream slice step size (in days), enter the number of days of events the connector requests in each time window. The default is 30, and the allowed range is 1 to 91. Lower this value if syncs of the events stream fail or run for a long time. See Limitations.
  8. Click Set up source.

Supported sync modes​

FeatureSupported
Full Refresh SyncYes
Incremental SyncYes, events stream only

Supported streams​

The projects stream lists your PostHog projects. Every other stream reads its data separately for each of those projects.

StreamPostHog API endpointSync modes
projectsProjectsFull Refresh
annotationsAnnotationsFull Refresh
cohortsCohortsFull Refresh
eventsEventsFull Refresh, Incremental
feature_flagsFeature flagsFull Refresh
insightsInsightsFull Refresh
personsPersonsFull Refresh

Incremental sync for the events stream​

The events stream uses the event timestamp field as its cursor. The connector stores a separate cursor value for each project. A project with no saved cursor normally starts from the configured start date; if a legacy shared timestamp remains in the state, that timestamp is used as the fallback for the project instead. Existing projects resume from their saved cursors. Within each project, the connector requests events in time windows sized by the Events stream slice step size setting.

Limitations​

The PostHog events API is deprecated​

PostHog has deprecated the events API that the events stream uses and plans to remove it at a future date. PostHog currently applies these restrictions to that API:

  • Pagination offsets larger than 50,000 are disabled. There is also a lower, connector-specific limit: the connector requests 10,000 events per page, but PostHog returns at most 1,000. Its current paginator stops when a page contains fewer than the requested 10,000 records, so it can silently omit events after the first 1,000 in each project's time window. Lowering Events stream slice step size reduces this risk, but cannot prevent truncation if even a one-day window contains more than 1,000 events.
  • The range between the after and before parameters must be less than one year. Normal windows are at most 91 days, but if a saved cursor is earlier than a newly configured Start Date, the first request can span from that cursor to the end of the new window and exceed this limit. Changing Start Date alone doesn't reset saved state. Keep it at or before saved cursors unless you deliberately restart the stream with cleared state.

For large or recurring event exports, PostHog recommends batch exports instead of the events API.

Rate limiting​

PostHog rate limits its private API endpoints, which are the endpoints this connector reads from. At the time of writing, PostHog documents these limits:

  • Analytics endpoints, such as retrieving persons: 240 requests per minute and 1,200 requests per hour.
  • Other read endpoints: 480 requests per minute and 4,800 requests per hour.

For current limits and details on how PostHog counts requests, see PostHog's rate limiting documentation.

IP allow list​

If you use Airbyte Cloud and your organization restricts access to specific IPs, add the Airbyte Cloud IP addresses to your allow list.

Reference​

Config fields reference

Field
Type
Property name
string
api_key
string
start_date
string
base_url
integer
events_time_step

Changelog​

Expand to review
VersionDatePull RequestSubject
1.1.312026-11-1091639Update dependencies
1.1.302026-11-0390903Require Python 3.11 or newer, retaining support through Python 3.13.
1.1.292026-11-0390691Update dependencies
1.1.282026-10-2790013Update dependencies
1.1.272026-10-2078912Update dependencies
1.1.262026-10-1488960Update to CDK v7 and base image 4.1.1
1.1.252025-02-0153032Update dependencies
1.1.242025-01-2552536Update dependencies
1.1.232025-01-1851856Update dependencies
1.1.222025-01-1151313Update dependencies
1.1.212024-12-2850685Update dependencies
1.1.202024-12-2150280Update dependencies
1.1.192024-12-1449716Update dependencies
1.1.182024-12-1249066Starting with this version, the Docker image is now rootless. Please note that this and future versions will not be compatible with Airbyte versions earlier than 0.64
1.1.172024-10-2947724Update dependencies
1.1.162024-10-2847033Update dependencies
1.1.152024-10-1246769Update dependencies
1.1.142024-10-0546421Update dependencies
1.1.132024-09-2846108Update dependencies
1.1.122024-09-2145796Update dependencies
1.1.112024-09-1445570Update dependencies
1.1.102024-09-0745241Update dependencies
1.1.92024-08-3144996Update dependencies
1.1.82024-08-2444658Update dependencies
1.1.72024-08-1744350Update dependencies
1.1.62024-08-1344016Fix events stream pagniator to workaround PostHog API issue #13508
1.1.52024-08-1043488Update dependencies
1.1.42024-08-0343232Update dependencies
1.1.32024-07-2742769Update dependencies
1.1.22024-07-2042151Update dependencies
1.1.12024-07-1341823Update dependencies
1.1.02024-06-2039763Add properties and uuid attributes to persons stream
1.0.02023-12-0428593Fix events.event type
0.1.152023-10-2831265Fix Events stream datetime format
0.1.142023-08-2929947Add optional field to spec: events_time_step
0.1.132023-07-1928461Fixed EventsSimpleRetriever declaration
0.1.122023-06-2827764Update following state breaking changes
0.1.112023-06-0927135Fix custom EventsSimpleRetriever
0.1.102023-04-1524084Increase events streams batch size
0.1.92023-02-1322906Specified date formatting in specification
0.1.82022-11-1118993connector migrated to low-code, added projects,insights streams, added project based slicing for all other streams
0.1.72022-07-2614585Add missing 'properties' field to event attributes
0.1.62022-01-208617Update connector fields title/description
0.1.52021-12-249082Remove obsolete session_events and insights streams
0.1.42021-09-146058Support self-hosted posthog instances
0.1.32021-07-204001Incremental streams read only relevant pages
0.1.22021-07-154692Use account information for checking the connection
0.1.12021-07-054539Add AIRBYTE_ENTRYPOINT env variable for kubernetes support
0.1.02021-06-083768Initial Release