> ## Documentation Index
> Fetch the complete documentation index at: https://nango.dev/docs/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                                                                                                                 |
| ----------------------- | ------------------------------------------------------------------ | ---------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| `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)               |

***
