> ## Documentation Index
> Fetch the complete documentation index at: https://nango-wari-migrated-bigcommerce-docs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# PostHog

> Integrate your application with the PostHog API

## 🚀 Quickstart

Connect to PostHog with Nango and see data flow in 2 minutes.

<Steps>
  <Step title="Create an integration">
    In Nango ([free signup](https://app.nango.dev)), go to [Integrations](https://app.nango.dev/dev/integrations) -> *Configure New Integration* -> *PostHog*.
  </Step>

  <Step title="Authorize PostHog">
    Go to [Connections](https://app.nango.dev/dev/connections) -> *Add Test Connection* -> *Authorize*, then enter your **Subdomain** (e.g. `us` or `eu.i`) and **API Key**. Later, you'll let your users do the same directly from your app.
  </Step>

  <Step title="Call the PostHog API">
    Let's make your first request to the PostHog API (get current user). Replace the placeholders below with your [secret key](https://app.nango.dev/dev/environment-settings), [integration ID](https://app.nango.dev/dev/integrations), and [connection ID](https://app.nango.dev/dev/connections):

    <Tabs>
      <Tab title="cURL">
        ```bash theme={null}
        curl "https://api.nango.dev/proxy/api/users/@me" \
          -H "Authorization: Bearer <NANGO-SECRET-KEY>" \
          -H "Provider-Config-Key: <INTEGRATION-ID>" \
          -H "Connection-Id: <CONNECTION-ID>"
        ```
      </Tab>

      <Tab title="Node">
        Install Nango's backend SDK with `npm i @nangohq/node`. Then run:

        ```typescript theme={null}
        import { Nango } from '@nangohq/node';

        const nango = new Nango({ secretKey: '<NANGO-SECRET-KEY>' });

        const response = await nango.get({
            endpoint: '/api/users/@me',
            providerConfigKey: '<INTEGRATION-ID>',
            connectionId: '<CONNECTION-ID>'
        });

        console.log(response.data);
        ```
      </Tab>
    </Tabs>

    Or fetch credentials dynamically via the [Node SDK](/reference/sdks/node#get-a-connection-with-credentials) or [API](/reference/api/connection/get).

    ✅ You're connected! Check the [Logs](https://app.nango.dev/dev/logs) tab in Nango to inspect requests.
  </Step>

  <Step title="Implement Nango in your app">
    Follow our [Auth implementation guide](/guides/primitives/auth) to integrate Nango in your app.

    To obtain your own production credentials (subdomain and API key), follow the connect guide linked below.
  </Step>
</Steps>

## 📚 PostHog Integration Guides

Nango-maintained guides for common use cases.

* [How do I link my PostHog account?](/api-integrations/posthog/connect)\
  Connect your PostHog account using the Connect UI (subdomain and API key)

<Note>
  **Subdomain:** Use the part of your PostHog URL after `https://` and before `.posthog.com` (e.g. `us`, `eu.i` for US/EU Cloud). PostHog enforces different [rate limits](https://posthog.com/docs/api#rate-limiting) per resource.
</Note>

Official docs: [PostHog API documentation](https://posthog.com/docs/api)

## 🧩 Pre-built syncs & actions for PostHog

Enable them in your dashboard. Extend and customize to fit your needs.

### Others

| Function name                 | Description                                                          | Type                                           | Source code                                                                                                                         |
| ----------------------------- | -------------------------------------------------------------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| `capture-event`               | Capture a PostHog event.                                             | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/capture-event.ts)               |
| `create-action`               | Create an action (saved event pattern) in PostHog.                   | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/create-action.ts)               |
| `create-alert`                | Create an alert on an insight in PostHog.                            | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/create-alert.ts)                |
| `create-annotation`           | Create an annotation in PostHog.                                     | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/create-annotation.ts)           |
| `create-cohort`               | Create a cohort in PostHog.                                          | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/create-cohort.ts)               |
| `create-dashboard`            | Create a dashboard in PostHog.                                       | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/create-dashboard.ts)            |
| `create-early-access-feature` | Create an early access feature in PostHog.                           | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/create-early-access-feature.ts) |
| `create-experiment`           | Create an A/B experiment in PostHog.                                 | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/create-experiment.ts)           |
| `create-feature-flag`         | Create a feature flag in PostHog.                                    | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/create-feature-flag.ts)         |
| `create-insight`              | Create a insight in PostHog.                                         | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/create-insight.ts)              |
| `create-person`               | Create a person in PostHog.                                          | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/create-person.ts)               |
| `create-survey`               | Create a survey in PostHog.                                          | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/create-survey.ts)               |
| `delete-action`               | Delete an action in PostHog.                                         | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/delete-action.ts)               |
| `delete-alert`                | Delete an alert in PostHog.                                          | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/delete-alert.ts)                |
| `delete-annotation`           | Delete or archive an annotation in PostHog by setting it as deleted. | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/delete-annotation.ts)           |
| `delete-cohort`               | Delete or archive a cohort in PostHog.                               | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/delete-cohort.ts)               |
| `delete-dashboard`            | Delete or archive a dashboard in PostHog.                            | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/delete-dashboard.ts)            |
| `delete-early-access-feature` | Delete an early access feature in PostHog.                           | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/delete-early-access-feature.ts) |
| `delete-feature-flag`         | Delete or archive a feature flag in PostHog                          | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/delete-feature-flag.ts)         |
| `delete-insight`              | Delete or archive an insight in PostHog.                             | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/delete-insight.ts)              |
| `delete-person`               | Delete or archive a person in PostHog.                               | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/delete-person.ts)               |
| `delete-survey`               | Delete a survey in PostHog.                                          | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/delete-survey.ts)               |
| `get-action`                  | Retrieve a single action from PostHog.                               | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/get-action.ts)                  |
| `get-alert`                   | Retrieve a single alert from PostHog.                                | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/get-alert.ts)                   |
| `get-annotation`              | Retrieve a single annotation from PostHog.                           | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/get-annotation.ts)              |
| `get-cohort`                  | Retrieve a single cohort from PostHog.                               | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/get-cohort.ts)                  |
| `get-dashboard`               | Retrieve a single dashboard from PostHog.                            | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/get-dashboard.ts)               |
| `get-early-access-feature`    | Retrieve a single early access feature from PostHog.                 | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/get-early-access-feature.ts)    |
| `get-event-definition`        | Retrieve a single event definition from PostHog.                     | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/get-event-definition.ts)        |
| `get-event`                   | Retrieve a single event from PostHog.                                | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/get-event.ts)                   |
| `get-experiment`              | Retrieve a single experiment from PostHog.                           | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/get-experiment.ts)              |
| `get-feature-flag`            | Retrieve a single feature flag from PostHog.                         | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/get-feature-flag.ts)            |
| `get-insight`                 | Retrieve a single insight from PostHog.                              | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/get-insight.ts)                 |
| `get-person`                  | Retrieve a single person from PostHog.                               | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/get-person.ts)                  |
| `get-project`                 | Retrieve a single project from PostHog.                              | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/get-project.ts)                 |
| `get-property-definition`     | Retrieve a single property definition from PostHog.                  | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/get-property-definition.ts)     |
| `get-survey`                  | Retrieve a single survey from PostHog.                               | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/get-survey.ts)                  |
| `identify-person`             | Identify or update a PostHog person.                                 | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/identify-person.ts)             |
| `list-actions`                | List actions (saved event patterns) from PostHog.                    | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/list-actions.ts)                |
| `list-alerts`                 | List alerts from PostHog.                                            | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/list-alerts.ts)                 |
| `list-annotations`            | List annotations from PostHog.                                       | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/list-annotations.ts)            |
| `list-cohorts`                | List cohorts from PostHog.                                           | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/list-cohorts.ts)                |
| `list-dashboards`             | List dashboards from PostHog.                                        | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/list-dashboards.ts)             |
| `list-early-access-features`  | List early access features from PostHog.                             | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/list-early-access-features.ts)  |
| `list-event-definitions`      | List event definitions (auto-detected event schemas) from PostHog.   | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/list-event-definitions.ts)      |
| `list-events`                 | List events from PostHog.                                            | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/list-events.ts)                 |
| `list-experiments`            | List experiments from PostHog.                                       | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/list-experiments.ts)            |
| `list-feature-flags`          | List feature flags from PostHog.                                     | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/list-feature-flags.ts)          |
| `list-insights`               | List insights from PostHog.                                          | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/list-insights.ts)               |
| `list-persons`                | List persons from PostHog.                                           | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/list-persons.ts)                |
| `list-projects`               | List projects from PostHog                                           | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/list-projects.ts)               |
| `list-property-definitions`   | List property definitions from PostHog.                              | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/list-property-definitions.ts)   |
| `list-session-recordings`     | List session recordings from PostHog.                                | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/list-session-recordings.ts)     |
| `list-surveys`                | List surveys from PostHog.                                           | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/list-surveys.ts)                |
| `update-action`               | Update an action in PostHog.                                         | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/update-action.ts)               |
| `update-alert`                | Update an alert in PostHog.                                          | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/update-alert.ts)                |
| `update-annotation`           | Update an annotation in PostHog                                      | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/update-annotation.ts)           |
| `update-cohort`               | Update a cohort in PostHog.                                          | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/update-cohort.ts)               |
| `update-dashboard`            | Update a dashboard in PostHog                                        | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/update-dashboard.ts)            |
| `update-early-access-feature` | Update an early access feature in PostHog.                           | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/update-early-access-feature.ts) |
| `update-experiment`           | Update an experiment in PostHog                                      | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/update-experiment.ts)           |
| `update-feature-flag`         | Update a feature flag in PostHog.                                    | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/update-feature-flag.ts)         |
| `update-insight`              | Update a insight in PostHog.                                         | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/update-insight.ts)              |
| `update-person`               | Update a person in PostHog.                                          | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/update-person.ts)               |
| `update-property-definition`  | Update a property definition in PostHog.                             | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/update-property-definition.ts)  |
| `update-survey`               | Update a survey in PostHog.                                          | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/actions/update-survey.ts)               |
| `actions`                     | Sync actions (saved event patterns) from PostHog.                    | [Sync](/guides/functions/syncs/sync-functions) | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/syncs/actions.ts)                       |
| `annotations`                 | Sync annotations from PostHog                                        | [Sync](/guides/functions/syncs/sync-functions) | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/syncs/annotations.ts)                   |
| `cohorts`                     | Sync cohorts from PostHog.                                           | [Sync](/guides/functions/syncs/sync-functions) | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/syncs/cohorts.ts)                       |
| `dashboards`                  | Sync dashboards from PostHog.                                        | [Sync](/guides/functions/syncs/sync-functions) | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/syncs/dashboards.ts)                    |
| `early-access-features`       | Sync early access features from PostHog.                             | [Sync](/guides/functions/syncs/sync-functions) | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/syncs/early-access-features.ts)         |
| `event-definitions`           | Sync event definitions (auto-detected event schemas) from PostHog.   | [Sync](/guides/functions/syncs/sync-functions) | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/syncs/event-definitions.ts)             |
| `events`                      | Sync events from PostHog.                                            | [Sync](/guides/functions/syncs/sync-functions) | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/syncs/events.ts)                        |
| `experiments`                 | Sync experiments from PostHog.                                       | [Sync](/guides/functions/syncs/sync-functions) | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/syncs/experiments.ts)                   |
| `feature-flags`               | Sync feature flags from PostHog.                                     | [Sync](/guides/functions/syncs/sync-functions) | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/syncs/feature-flags.ts)                 |
| `insights`                    | Sync insights from PostHog                                           | [Sync](/guides/functions/syncs/sync-functions) | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/syncs/insights.ts)                      |
| `persons`                     | Sync persons from PostHog                                            | [Sync](/guides/functions/syncs/sync-functions) | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/syncs/persons.ts)                       |
| `projects`                    | Sync projects from PostHog.                                          | [Sync](/guides/functions/syncs/sync-functions) | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/syncs/projects.ts)                      |
| `session-recordings`          | Sync session recording metadata from PostHog                         | [Sync](/guides/functions/syncs/sync-functions) | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/syncs/session-recordings.ts)            |
| `surveys`                     | Sync surveys from PostHog.                                           | [Sync](/guides/functions/syncs/sync-functions) | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/posthog/syncs/surveys.ts)                       |

***
