PostHog
Connect & Ingest data from PostHog
PostHog is an open-source product analytics platform that helps teams understand user behavior. The Sling PostHog connector extracts data from the PostHog API, supporting projects, persons, events, cohorts, feature flags, insights, annotations, actions, session recordings, event definitions, and property definitions.
CLI Pro Required: APIs require a CLI Pro token or Platform Plan.
Setup
The following credentials are accepted:
Secrets:
api_key(required) -> PostHog Personal API Keyproject_id(required) -> PostHog Project IDhost(optional) -> PostHog host (defaults tous.posthog.com)
Inputs (optional):
anchor_date-> Starting date for first sync (defaults to 1 year ago)
Getting Your Credentials
Log in to PostHog (or your self-hosted instance)
Go to Settings β Personal API Keys
Click Create personal API key
Give it a label (e.g., "Sling Integration")
Under Scopes, select the All access preset (or grant read access to the endpoints you need)
Under Organization & project access, select All access (or choose specific projects)
Click Create key and copy the key (it starts with
phx_)Find your Project ID in Settings β Project (also visible in the URL:
https://us.posthog.com/project/<project_id>)
Self-Hosted & EU Cloud: If you use PostHog EU Cloud, set host to eu.posthog.com. For self-hosted instances, set host to your custom domain (e.g., posthog.yourcompany.com).
Important: Personal API keys grant access to your PostHog project data. Keep your key secure and never share it publicly.
Using sling conns
sling connsHere are examples of setting a connection named POSTHOG. We must provide the type=api property:
Environment Variable
See here to learn more about the .env.sling file.
Sling Env File YAML
See here to learn more about the sling env.yaml file.
Replication
Here's an example replication configuration to sync PostHog data to a PostgreSQL database:
Endpoints
projects
Projects (teams) accessible to the user
No
β
persons
Persons (users) tracked in the project
No
β
events
Events captured in the project
Yes
β
cohorts
Cohort definitions
No
β
feature_flags
Feature flag definitions
No
β
insights
Saved insights (charts, funnels, trends)
No
β
annotations
Annotations on charts
Yes
β
actions
Actions (custom event groups)
No
β
session_recordings
Session recording metadata
Yes
β
event_definitions
Event name definitions and metadata
No
β
property_definitions
Property definitions and metadata
No
β
To discover available endpoints:
Endpoint Details
projects β Returns all projects (teams) accessible to the authenticated user. Does not require a project ID scope.
persons β Returns all persons (users) tracked in the project, including custom properties and distinct IDs. Uses offset-based pagination.
events β Returns events captured in the project. Supports incremental sync via timestamp β after the first full extraction, subsequent runs only fetch events newer than the last synced timestamp. Ordered by timestamp descending.
cohorts β Returns all cohort definitions in the project, including group properties and membership criteria.
feature_flags β Returns all feature flag definitions, including rollout percentages and filter groups.
insights β Returns all saved insights (charts, funnels, trends, retention analyses) in the project, including query definitions and dashboard associations.
annotations β Returns all annotations in the project. Supports incremental sync via updated_at β subsequent runs only fetch annotations created or updated since the last sync.
actions β Returns all actions (custom event groups) defined in the project, including their step definitions.
session_recordings β Returns session recording metadata (not the actual recordings). Supports incremental sync via start_time β subsequent runs only fetch recordings started after the last sync date.
event_definitions β Returns all event name definitions and metadata in the project, including tags and verification status.
property_definitions β Returns all property definitions in the project, including property types and numerical flags.
Incremental Sync
The events, annotations, and session_recordings endpoints support incremental sync:
First run: Fetches all data from the
anchor_date(default: 1 year ago) to nowSubsequent runs: Only fetches data created or updated since the last sync
To customize the starting date:
Rate Limiting
The PostHog API enforces rate limits of 240 requests/minute for analytics endpoints and 480 requests/minute for CRUD endpoints.
The connector automatically:
Uses conservative rate limiting (3 requests/second)
Limits concurrency to 2 parallel requests
Retries with exponential backoff on 429 (rate limit) responses with up to 5 retry attempts
Retries with linear backoff on 5xx server errors with up to 3 retry attempts
If you are facing issues connecting, please reach out to us at [email protected], on discord or open a Github Issue here.
Last updated
Was this helpful?