How to Connect PostHog to an AI Agent
Auth setup
1. Go to PostHog > Settings > Personal API Keys. 2. Create key. 3. Use as Bearer token for API queries. 4. Project API key for event capture.
Key facts
| Base URL | https://app.posthog.com/api/ |
| API version | v1 |
| Auth | Personal API key as Bearer token. Project API key for event capture. |
| Request body | application/json |
| Pagination | cursor-based: next URL in response. |
| Rate limit | No hard limit for Cloud. Self-hosted: depends on deployment. |
| Error format | JSON: {"type":"validation_error","detail":"..."} |
Key endpoints
| Method | Path | Description |
POST | /capture | Capture event (use project API key) |
GET | /projects/{id}/insights | List insights/saved queries |
GET | /projects/{id}/feature_flags | List feature flags |
POST | /projects/{id}/query | Run HogQL query |
Quickstart
POST /capture
Content-Type: application/json
{"api_key":"{project_api_key}","event":"pageview","distinct_id":"user123"}
Agent pitfalls & tips
- Two key types: Personal API key (queries), Project API key (capture).
- Self-hostable โ Docker setup for local development.
- HogQL is PostHog's query language โ SQL-like for custom analysis.
- Feature flags: evaluate server-side via /decide endpoint.
- Community MCP server available for agent integration.
Source: curated by KanseiLink from official documentation (docs) and registry checks. Last reviewed: 2026-04-07. Specs change โ verify against the official docs before production use.
Frequently Asked Questions
What is PostHog's AEO score?
โผ
PostHog has an AEO score of 0.70 and is rated A (Functional agent integration). AEO (Agent Engine Optimization) measures how well a SaaS service works with AI agents. Scores range from 0.00 to 1.00, with grades from AAA (best) to D (not agent-ready).
Is PostHog AI-agent-ready?
โผ
PostHog is currently connectable for AI agent use. Third-party MCP integrations are available for this service. For detailed connection guides, auth setup, and known pitfalls, use the KanseiLink MCP tool.
How does PostHog compare to other Marketing services?
โผ
In the Marketing category, PostHog is rated A. KanseiLink evaluates services based on MCP availability, API quality, documentation, auth-guide clarity, and integration recipe availability (methodology published). Visit the full rankings at kansei-link.com to see how PostHog compares.
How can I integrate PostHog with an AI agent?
โผ
The fastest way to integrate PostHog with an AI agent is through KanseiLink MCP. Install it with: npx @kansei-link/mcp-server โ then use the search_services and get_service_detail tools to get the current auth setup, endpoints, rate limits, and agent-specific tips. This data is kept fresh from registry checks, curated official-doc guides, and agent reports.
How do I authenticate with PostHog?
โผ
Personal API key as Bearer token. Project API key for event capture. Setup: 1. Go to PostHog > Settings > Personal API Keys. 2. Create key. 3. Use as Bearer token for API queries. 4. Project API key for event capture.
What are PostHog's API rate limits?
โผ
No hard limit for Cloud. Self-hosted: depends on deployment.