> For the complete documentation index, see [llms.txt](https://docs.erathos.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.erathos.com/connectors/apis/posthog.md).

# PostHog

## Using the Erathos platform

When selecting PostHog as a new connector on the Erathos platform, you will need to name your connection and fill in the following form:

* **Token** — Your PostHog personal API key used for authentication

With this connection created you can seamlessly move your PostHog data to your BigQuery, Redshift or Postgres data warehouse.

### How to find my token?

To authenticate with PostHog, you need a personal API key. Log in to your PostHog instance, click on your profile in the top-right corner, and navigate to **Settings → Personal API keys**. Click **+ Create personal API key**, give it a name (e.g. "Erathos"), and copy the generated key.

Paste the personal API key into the **Token** field on the Erathos platform connection form. Click **Save and close** to complete setup.

## Endpoints and fields

### actions

Sync type availability: Full-refresh

| Field           | Type      |
| --------------- | --------- |
| id              | integer   |
| name            | text      |
| description     | text      |
| created\_at     | timestamp |
| updated\_at     | timestamp |
| created\_by\_id | integer   |
| deleted         | boolean   |

### annotations

Sync type availability: Full-refresh

| Field           | Type      |
| --------------- | --------- |
| id              | integer   |
| content         | text      |
| created\_at     | timestamp |
| date\_marker    | timestamp |
| created\_by\_id | integer   |

### cohorts

Sync type availability: Full-refresh

| Field           | Type      |
| --------------- | --------- |
| id              | integer   |
| name            | text      |
| description     | text      |
| created\_at     | timestamp |
| updated\_at     | timestamp |
| is\_static      | boolean   |
| created\_by\_id | integer   |

### dashboards

Sync type availability: Full-refresh

| Field           | Type      |
| --------------- | --------- |
| id              | integer   |
| name            | text      |
| description     | text      |
| created\_at     | timestamp |
| updated\_at     | timestamp |
| created\_by\_id | integer   |
| deleted         | boolean   |

### events

Sync type availability: Full and incremental refresh

[Cursor](https://docs.erathos.com/platform/connections/sync-types#understanding-cursors): `created_at`

| Field        | Type      | Cursor |
| ------------ | --------- | ------ |
| id           | text      |        |
| event        | text      |        |
| distinct\_id | text      |        |
| timestamp    | timestamp |        |
| properties   | text      |        |
| elements     | text      |        |
| created\_at  | timestamp | ✓      |

### experiments

Sync type availability: Full-refresh

| Field           | Type      |
| --------------- | --------- |
| id              | integer   |
| name            | text      |
| description     | text      |
| created\_at     | timestamp |
| updated\_at     | timestamp |
| created\_by\_id | integer   |

### feature\_flags

Sync type availability: Full-refresh

| Field           | Type      |
| --------------- | --------- |
| id              | integer   |
| key             | text      |
| name            | text      |
| active          | boolean   |
| created\_at     | timestamp |
| created\_by\_id | integer   |
| deleted         | boolean   |

### persons

Sync type availability: Full-refresh

| Field          | Type      |
| -------------- | --------- |
| id             | text      |
| distinct\_id   | text      |
| properties     | text      |
| created\_at    | timestamp |
| is\_identified | boolean   |
| name           | text      |
| email          | text      |

### session\_recordings

Sync type availability: Full-refresh

| Field        | Type      |
| ------------ | --------- |
| id           | text      |
| session\_id  | text      |
| distinct\_id | text      |
| viewed       | boolean   |
| start\_time  | timestamp |
| end\_time    | timestamp |
| duration     | float     |
| created\_at  | timestamp |

### surveys

Sync type availability: Full-refresh

| Field           | Type      |
| --------------- | --------- |
| id              | integer   |
| name            | text      |
| description     | text      |
| created\_at     | timestamp |
| updated\_at     | timestamp |
| created\_by\_id | integer   |

## Entity Relationships

```mermaid
erDiagram
    actions {
        integer id PK
        text name
        text description
        timestamp created_at
        timestamp updated_at
        integer created_by_id
        boolean deleted
    }
    annotations {
        integer id PK
        text content
        timestamp created_at
        timestamp date_marker
        integer created_by_id
    }
    cohorts {
        integer id PK
        text name
        text description
        timestamp created_at
        timestamp updated_at
        boolean is_static
        integer created_by_id
    }
    dashboards {
        integer id PK
        text name
        text description
        timestamp created_at
        timestamp updated_at
        integer created_by_id
        boolean deleted
    }
    events {
        text id PK
        text event
        text distinct_id
        timestamp timestamp
        text properties
        text elements
        timestamp created_at
    }
    experiments {
        integer id PK
        text name
        text description
        timestamp created_at
        timestamp updated_at
        integer created_by_id
    }
    feature_flags {
        integer id PK
        text key
        text name
        boolean active
        timestamp created_at
        integer created_by_id
        boolean deleted
    }
    persons {
        text id PK
        text distinct_id
        text properties
        timestamp created_at
        boolean is_identified
        text name
        text email
    }
    session_recordings {
        text id PK
        text session_id
        text distinct_id
        boolean viewed
        timestamp start_time
        timestamp end_time
        float duration
        timestamp created_at
    }
    surveys {
        integer id PK
        text name
        text description
        timestamp created_at
        timestamp updated_at
        integer created_by_id
    }
```
