PostHog Event to TypeScript

Paste a PostHog event payload (/capture/ POST body or webhook export) and get a TypeScript interface for distinct_id, properties, $-prefixed system keys, and your custom fields.

JSON input valid
TypeScript output

      
    

About this conversion

PostHog events are deeply nested in one big properties bag: the SDK injects its own $-prefixed system keys ($lib, $lib_version, $browser, $os, $device_type, $session_id, $current_url, $referrer, $ip), and your application adds its own custom keys alongside them. The mix means hand-typing the properties bag becomes a moving target every time the SDK updates. Generating a TypeScript interface from a real capture payload pins down both halves at once.

Use the result in a webhook export consumer, a self-hosted PostHog destination, or a server-side capture call. Combined with the posthog-node SDK, generated types catch shape changes before they reach your data warehouse — and they document which $-prefixed properties you actually rely on.

Same shape, other validators

Other JSON shapes