PostHog Integration
API Key (Bearer)Connect your AI agent to PostHog. Track events, manage feature flags, analyze user behavior, and query funnels from conversations.
What your agent can do
With PostHog credentials, your agent gets access to analytics, feature flags, and user data through the PostHog API.
Event tracking
Query captured events, create custom event definitions, and analyze event volumes over time.
Feature flag management
List, create, update, and toggle feature flags. Check flag status for specific users or groups.
User analytics
Look up user profiles, view event timelines, and analyze user properties and cohort membership.
Funnel analysis
Query funnel conversion rates, identify drop-off points, and compare cohort performance.
Prerequisites
- ✓A PostHog account (Cloud or self-hosted)
- ✓Personal API key from Settings > Personal API Keys
- ✓A ClawTrust agent on any plan (Starter, Pro, or Enterprise)
Step-by-step setup
Generate a Personal API key in PostHog and add it to your agent.
Open PostHog settings
In your PostHog project, click your avatar in the bottom left and go to Settings > Personal API Keys.
Create a Personal API key
Click "Create personal API key" and give it a descriptive name (e.g., "ClawTrust Agent"). Select the scopes your agent needs.
Copy the API key
Copy the generated key immediately. PostHog only shows it once. This is a Bearer token for API authentication.
Add to ClawTrust
In your agent's dashboard, go to Credentials > Add Credential. Select "API Key (Bearer)", paste your key, and set allowed domains to *.posthog.com and app.posthog.com.
Credential details
Type
Header
Authorization: Bearer phx_xxxAllowed domains
*.posthog.comFields
Personal API key (single field)Example actions
Once connected, you can ask your agent to perform actions like these.
"Show me the top 10 events by volume from the last 7 days"
Queries the PostHog events API and returns a ranked summary of event counts.
"Enable the new-dashboard feature flag for the beta-testers group"
Updates the feature flag to include the specified group in its rollout.
"What is the signup-to-purchase conversion rate this month?"
Runs a funnel query for the specified events and returns the conversion percentage.
"Look up user john@acme.com and show their recent event timeline"
Fetches the user profile and returns their last events with timestamps.
Ready to connect your agent to PostHog?
Add your Personal API key and your agent starts querying analytics immediately.