All integrations
Get an API key
PostHog
Events, insights, feature flags and session recordings in PostHog.
Analytics
How an agent reaches it
MCPREST APICLI
How you authenticate
API key
- Create a personal API key in Settings, then Personal API keys, scoping it to the projects you need.
- The personal API key (phx_) reads data. The project API key (phc_) only writes events and is not a credential for this API.
Connection details
- Base URL
- https://us.posthog.com/api
- Pagination
- offset
Common endpoints
| list projects | GET /projects |
| query events | POST /projects/{id}/query |
| list feature flags | GET /projects/{id}/feature_flags |
| list insights | GET /projects/{id}/insights |
Worth knowing
- US and EU clouds are separate hosts with separate keys. Using the wrong one 401s.
- The write-side project key (phc_) and the read-side personal key (phx_) are different things; only phx_ works here.
- Most paths are scoped to a project id: /api/projects/{id}/....