Skip to main content

PostHog

PostHog is an open-source product analytics platform for tracking events, persons, and cohorts, and for managing insights, dashboards, feature flags, experiments, surveys, and annotations. Nexla connects to the PostHog API to ingest analytics data into your pipelines and to push events and configuration objects back into PostHog.

PostHog icon

Power end-to-end data operations for your PostHog API with Nexla. Our bi-directional PostHog connector is purpose-built for PostHog, making it simple to ingest data, sync it across systems, and deliver it anywhere — all with no coding required. Nexla turns API-sourced data into ready-to-use, reusable data products and makes it easy to send data to PostHog or any other destination. With comprehensive monitoring, lineage tracking, and access controls, Nexla keeps your PostHog workflows fast, secure, and fully governed.

Features

Type: API

SourceDestination

  • Seamless API Integration: Connect to any endpoint as source or destination without coding, with automatic data product creation
  • Visual Composition & Chaining: Build complex integrations using visual templates, chain API calls, and compose workflows with data validation and filtering
  • API Proxy: Expose curated slices of your data securely with a secure and customizable API proxy that validates and transforms data on the fly
  • Request optimization with intelligent batching, retry, and caching to minimize API calls and costs

Prerequisites

Before creating a PostHog credential in Nexla, you need a Personal API Key for your PostHog account. PostHog authenticates private API requests (reads and writes) with a Personal API Key, sent in the Authorization header as a bearer token.

To create a Personal API Key:

  1. Sign in to your PostHog account (US Cloud, EU Cloud, or your self-hosted instance).

  2. Open your account settings and go to the Personal API Keys section.

  3. Click + Create a personal API key.

  4. Enter a label that describes the key's purpose (e.g., "Nexla Integration").

  5. Select the scopes the key should have. As a security best practice, grant only the scopes required for the endpoints you plan to use — for example, read scopes for events, persons, and insights when using PostHog as a data source, and write scopes for the objects you intend to create or update when using it as a destination.

  6. Click to create the key, then copy the key value immediately. PostHog only displays the key once; after you navigate away, it cannot be retrieved and you will need to create a new key.

PostHog is region-specific. Requests to a US Cloud project use the https://us.posthog.com host, and requests to an EU Cloud project use the https://eu.posthog.com host; self-hosted instances use your own domain. Personal API Keys are scoped to the account and project in which they were created.

Event ingestion (the Capture Event destination endpoint) uses your Project API Key — the public write-only key found in your project settings — which is distinct from the Personal API Key used for authenticated reads and writes. For details, see the PostHog API documentation and the Personal API keys guide.

Authenticate

Credentials required

FieldRequiredSecretDescription
Personal API KeyYesYesPostHog Personal API Key generated under Settings > Personal API Keys in your PostHog account.

Create a credential in Nexla

  1. After selecting the data source/destination type, click the Add Credential tile to open the Add New Credential overlay.

  2. Enter a name for the credential in the Credential Name field and a short, meaningful description in the Credential Description field.

  3. Enter your PostHog Personal API Key in the Personal API Key field. This key is sent as a bearer token in the Authorization header for all authenticated API requests and must be kept confidential.

  4. Click the Save button at the bottom of the overlay. The newly added credential will now appear in a tile on the Authenticate screen during data source/destination creation.

    If your Personal API Key is compromised, revoke it in your PostHog account under Settings > Personal API Keys and create a new one. Keys can be invalidated individually without affecting your other keys.

Use as a data source

To create a new data flow, navigate to the Integrate section, and click the New Data Flow button. Select the PostHog connector tile, then select the credential that will be used to connect to the PostHog instance, and click Next; or, create a new PostHog credential for use in this flow.

Endpoint templates

Nexla provides pre-built templates that can be used to rapidly configure data sources to ingest data from common PostHog endpoints. Select the endpoint from which this source will fetch data from the Endpoint pulldown menu. Available endpoint templates are listed in the expandable boxes below.

[Rest API] List Events

List captured analytics events for the project. Supports after/before time-range and event/distinct_id filters.

Use this endpoint to ingest raw captured events. For details on filter parameters and response fields, see the PostHog API documentation.

[Rest API] Get Event

Get a single captured event by ID.

For details on the event object and its fields, see the PostHog API documentation.

[Rest API] List Persons

List person profiles (users) tracked in the project.

For details on person profiles and pagination, see the PostHog API documentation.

[Rest API] Get Person

Get details of a single person profile.

For details on the person object and its properties, see the PostHog API documentation.

[Rest API] List Cohorts

List saved cohorts (dynamic or static person segments).

For details on cohort definitions, see the PostHog API documentation.

[Rest API] Get Cohort

Get details of a single cohort.

For details on the cohort object, see the PostHog API documentation.

[Rest API] List Cohort Persons

List the persons belonging to a cohort.

For details on cohort membership and pagination, see the PostHog API documentation.

[Rest API] List Insights

List saved insights (trend/funnel/retention analyses).

For details on insight types and fields, see the PostHog API documentation.

[Rest API] Get Insight

Get details of a single saved insight.

For details on the insight object, see the PostHog API documentation.

[Rest API] List Feature Flags

List feature flags configured for the project.

For details on feature flag definitions, see the PostHog API documentation.

[Rest API] Get Feature Flag

Get details of a single feature flag.

For details on the feature flag object, see the PostHog API documentation.

[Rest API] List Annotations

List annotations (notes overlaid on charts, e.g. deploys).

For details on annotations, see the PostHog API documentation.

[Rest API] Get Annotation

Get details of a single annotation.

For details on the annotation object, see the PostHog API documentation.

[Rest API] List Dashboards

List dashboards configured for the project.

For details on dashboards, see the PostHog API documentation.

[Rest API] Get Dashboard

Get details of a single dashboard, including its tiles.

For details on the dashboard object and its tiles, see the PostHog API documentation.

[Rest API] List Event Definitions

List the distinct event names seen in the project and their metadata.

For details on event definitions, see the PostHog API documentation.

[Rest API] List Property Definitions

List the distinct event/person property keys seen in the project.

For details on property definitions, see the PostHog API documentation.

[Rest API] List Experiments

List A/B test experiments configured for the project.

For details on experiments, see the PostHog API documentation.

[Rest API] Get Experiment

Get details of a single experiment, including results.

For details on the experiment object and its results, see the PostHog API documentation.

[Rest API] List Surveys

List in-product surveys configured for the project.

For details on surveys, see the PostHog API documentation.

[Rest API] Get Survey

Get details of a single survey, including its questions.

For details on the survey object and its questions, see the PostHog API documentation.

Once the selected endpoint template has been configured, click the Test button to the right of the endpoint selection menu to retrieve a sample of the data that will be fetched. Sample data will be displayed in the Endpoint Test Result panel on the right, allowing you to verify that the source is configured correctly before saving.

Manual configuration

PostHog data sources can also be manually configured to ingest data from any valid PostHog API endpoint, including endpoints not covered by the pre-built templates, chained API calls, or custom request parameters. Select the Advanced tab at the top of the configuration screen, and follow the instructions in Connect to Any API to configure the API method, endpoint URL, date/time and lookup macros, path to data, metadata, and request headers.

Once all of the relevant settings have been configured, click the Create button in the upper right corner of the screen to save and create the new PostHog data source. Nexla will now begin ingesting data from the configured endpoint and will organize any data that it finds into one or more Nexsets.

Use as a destination

Click the + icon on the Nexset that will be sent to the PostHog destination, and select the Send to Destination option from the menu. Select the PostHog connector from the list of available destination connectors, then select the credential that will be used to connect to the PostHog project, and click Next; or, create a new PostHog credential for use in this flow.

Endpoint templates

Nexla provides pre-built templates that can be used to rapidly configure destinations to send data to common PostHog endpoints. Select the endpoint to which data will be sent from the Endpoint pulldown menu. Then, click on the template in the list below to expand it, and follow the instructions to configure additional endpoint settings.

[Rest API] Capture Event

Ingest a new analytics event via PostHog's capture endpoint. Each record's body needs api_key (the project key, which is distinct from the Bearer Personal API Key used for reads), event, distinct_id, and properties.

Event capture uses your project's public write-only API Key rather than the Personal API Key. For details on the capture payload format, see the PostHog API documentation.

[Rest API] Create Feature Flag

Create a new feature flag.

Each record from your Nexset is sent as a separate request to create a feature flag. For the required request body format, see the PostHog API documentation.

[Rest API] Update Feature Flag

Update an existing feature flag (e.g. rollout %, filters, active state).

Include the ID of the feature flag to update in each record. For the request body format, see the PostHog API documentation.

[Rest API] Create Cohort

Create a new cohort (dynamic or static person segment).

Each record from your Nexset is sent as a separate request to create a cohort. For the required request body format, see the PostHog API documentation.

[Rest API] Update Cohort

Update an existing cohort's definition or name.

Include the ID of the cohort to update in each record. For the request body format, see the PostHog API documentation.

[Rest API] Add Persons to Static Cohort

Add person IDs to an existing static cohort.

This endpoint applies only to static cohorts. For the request body format, see the PostHog API documentation.

[Rest API] Create Annotation

Create a new annotation (e.g. mark a deploy or incident on charts).

Each record from your Nexset is sent as a separate request to create an annotation. For the required request body format, see the PostHog API documentation.

[Rest API] Update Annotation

Update an existing annotation.

Include the ID of the annotation to update in each record. For the request body format, see the PostHog API documentation.

[Rest API] Create Dashboard

Create a new dashboard.

Each record from your Nexset is sent as a separate request to create a dashboard. For the required request body format, see the PostHog API documentation.

[Rest API] Create Insight

Create a new saved insight.

Each record from your Nexset is sent as a separate request to create an insight. For the required request body format, see the PostHog API documentation.

Manual configuration

PostHog destinations can also be manually configured to send data to any valid PostHog API endpoint. Select the Advanced tab at the top of the configuration screen, and follow the instructions in Connect to Any API to configure the API method, data format, endpoint URL, request headers, attribute exclusions, record batching, and response webhooks.

PostHog APIs typically expect JSON format for most operations. For update operations, include the ID of the object to be updated in the request.

Save & activate

Once all endpoint settings have been configured, click the Done button in the upper right corner of the screen to save and create the destination. To send the data to the configured PostHog endpoint, open the destination resource menu, and select Activate.

The Nexset data will not be sent to the PostHog endpoint until the destination is activated. Destinations can be activated immediately or at a later time, providing full control over data movement.