PostHog API: What You Can Do and How to Use It with AI Agents
PostHog is a product analytics platform with events, funnels, session recordings, feature flags and experiments. It has a public API for sending events and a private API for querying data and managing project resources. Product and engineering teams use it, in the cloud or self-hosted.
What the PostHog API offers
Event capture
Send events and user properties from systems and apps.
Queries
Ask questions of the data with HogQL, PostHog's query language.
Insights and dashboards
Read and create saved reports.
Feature flags
Create and evaluate flags to roll out features.
People and cohorts
User profiles and groups by behavior.
Session recordings
Access to browsing recordings.
How to access the PostHog API
- With your company’s credentialsSending events uses the project's public key. Queries and management use a personal API key with the scopes you choose.
- Session recordings can contain personal data: use masking and restrict access.
- Heavy queries count against usage limits.
- Changes to feature flags affect real users.
Official documentation: posthog.com/docs/api
What an iTeam agent does with the PostHog API
Why the visit did not convert
The agent queries the funnel and the recordings of sessions that dropped off and summarizes the friction points for the team.
Question in natural language
The manager asks how many signups came from a campaign and the agent builds the query and answers.
Flag with approval
The team asks to release a feature to a group, and the agent prepares the flag change, applied after approval.
Tracking error alert
The agent notices when an important event has stopped arriving and alerts engineering.
From the credential to the agent at work, with approval
Create the personal API key
In PostHog, generate a personal key with read scopes and, if needed, write scopes for flags.
Register it in the iTeam vault
The key stays in the vault. Queries are open, and changes to flags and experiments require approval.
Compare the numbers
In the first weeks, check the agent's answers against the PostHog insights.
Ready-made AI teams for this work
Management reporting team
Revenue, margin, pipeline and cash in one report, built from your systems, with a short note on what changed and why.
Data analysis team
Ask which customers stopped buying or which region lost margin. The team writes the SQL, runs it and explains the result.
IT service desk team
Password resets, access requests and how-to questions handled in chat, with Jira updated and approvals in place.
Questions about the PostHog API
Is the PostHog API free?
PostHog has a monthly free tier and charges for usage above it. The API follows the plan and limits of the project.
Do I need to write code to use the PostHog API with iTeam?
Not necessarily. iTeam uses the documentation and the PostHog MCP server, and the deployment team sets up access.
Does it work with a self-hosted PostHog?
Generally yes, as long as the API is reachable from the integration's network.