Skip to main content
PostHog logo

PostHog

Lets an agent explore your PostHog product analytics - read insights, persons, events, cohorts, and feature flags, run HogQL/SQL event queries, and create feature flags, cohorts, and annotations.

What it can do

MethodWhat it does
posthog_get_meGet the authenticated PostHog user account (email, name, default org/project).
posthog_list_projectsList all projects accessible to this user.
posthog_list_insightsList insights (saved analytics queries/dashboards); filter by search, paginate.
posthog_get_insightGet one insight including its definition, filters, and cached result data.
posthog_list_personsList persons (user profiles); search by distinct_id or properties, paginate.
posthog_get_personGet one person by numeric ID or distinct_id, with all properties and events.
posthog_list_eventsList events; filter by event name and person_id, paginate.
posthog_query_eventsRun a HogQL or SQL query over events and return the results.
posthog_list_feature_flagsList feature flags; filter by search, paginate.
posthog_get_feature_flagGet one feature flag by ID or key with its variants and targeting.
posthog_create_feature_flagCreate a feature flag (key, name, optional active/filters/rollout).
posthog_update_feature_flagUpdate a feature flag (name, active, filters, rollout percentage).
posthog_list_cohortsList cohorts (user segments); filter by search, paginate.
posthog_get_cohortGet one cohort with its definition, membership count, and filters.
posthog_create_cohortCreate a cohort (name and membership filters, optional description).
posthog_list_annotationsList annotations (markers on insight graphs); filter by insight_id, paginate.
posthog_create_annotationCreate an annotation (content and date marker, optional insight to attach).

How to get credentials

  1. Open posthog.com/settings/account-api-keys.
  2. Click Create personal API key, name it (e.g. FlyMyAI Agent), and pick the scopes the agent needs (read for analytics, write for feature flags/cohorts/annotations).
  3. Copy the key - it is shown only once.
  4. Find your project ID: open Project settings, or read it from any PostHog URL of the form /project/<ID>/ (it is numeric).

Fields to fill in FlyMyAI

FlyMyAI fieldWhere it comes from
POSTHOG_API_KEYPostHog - Settings - Personal API keys
POSTHOG_PROJECT_IDNumeric project ID (Project settings, or in URLs /project/<ID>/)
POSTHOG_HOST (optional)https://us.posthog.com (default) or https://eu.posthog.com
We love our partners - FlyMy.AI builds with the best. Thanks, PostHog!