> ## 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 (Capture API)

> Send events to PostHog using the public capture API and a project token

## 🚀 Quickstart

Connect to PostHog's Capture API with Nango and send your first event in 2 minutes. This uses a **Project Token** (`phc_...`), not a personal API key — the capture API is a public, write-only endpoint with no identity validation, so no user login is required.

**1. Create an integration**

In Nango ([free signup](https://app.nango.dev)), go to [Integrations](https://app.nango.dev/dev/integrations) -> *Configure New Integration* -> *PostHog (Capture API)*.

**2. Authorize PostHog**

Go to [Connections](https://app.nango.dev/dev/connections) -> *Add Test Connection* -> *Authorize*, then enter your **Hostname** (e.g. `us.i.posthog.com`) and **Project Token**. Later, you'll let your users do the same directly from your app.

**3. Send your first event**

Let's send a test event via the capture API. Replace the placeholders below with your [Environment API key](https://nango.dev/docs/reference/backend/http-api/api-keys.md), [integration ID](https://app.nango.dev/dev/integrations), and [connection ID](https://app.nango.dev/dev/connections):

**cURL**

```bash theme={null}
curl "https://api.nango.dev/proxy/i/v0/e/" \
  -X POST \
  -H "Authorization: Bearer <NANGO-API-KEY>" \
  -H "Provider-Config-Key: <INTEGRATION-ID>" \
  -H "Connection-Id: <CONNECTION-ID>" \
  -H "Content-Type: application/json" \
  -d '{"event": "test-event", "distinct_id": "test-user-123"}'
```

**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({ apiKey: '<NANGO-API-KEY>' });

const res = await nango.post({
    endpoint: '/i/v0/e/',
    data: { event: 'test-event', distinct_id: 'test-user-123' },
    providerConfigKey: '<INTEGRATION-ID>',
    connectionId: '<CONNECTION-ID>'
});

console.log(res.data);
```

Nango automatically adds your stored **Project Token** as the `api_key` field in the request body — you only need to supply `event` and `distinct_id` (plus any `properties` you want).

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

**4. Implement Nango in your app**

Follow our [Auth implementation guide](https://nango.dev/docs/guides/primitives/auth.md) to integrate Nango in your app.

## 📚 PostHog (Capture API) Integration Guides

* [How do I link my PostHog account?](https://nango.dev/docs/api-integrations/posthog-capture/connect)\
  Connect your PostHog account using the Connect UI (hostname and Project Token)

> [!NOTE]
>
> Need PostHog's general analytics/query API instead (reading data, not sending events)? Use the [PostHog](https://nango.dev/docs/api-integrations/posthog.md) integration, which authenticates with a personal API key.

Official docs: [PostHog Capture API reference](https://posthog.com/docs/api/capture)

## 🧩 Pre-built syncs & actions for PostHog (Capture API)

Explore Nango-provided actions in your dashboard. Extend and customize them to fit your needs.

*No pre-built syncs or actions available yet.*

> [!TIP]
>
> Not seeing the integration you need? [Build your own](https://nango.dev/docs/guides/functions/functions-guide.md) independently.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.