# Hermoso: posthog_query: Ask PostHog · Hermoso developer docs

> Machine-readable twin of https://hermoso.ai/docs/reference/ads/posthog_query/. Generated from the shipped page. Do not edit by hand.
> Full agent guide: https://hermoso.ai/llms.txt · MCP: https://app.hermoso.ai/mcp

[Docs](https://hermoso.ai/docs/) / [Tool reference](https://hermoso.ai/docs/reference/) / [Ad campaign management](https://hermoso.ai/docs/reference/ads/) / posthog_query

# `posthog_query`

Ask PostHog a question in HogQL read-only

Area: PRODUCT ANALYTICS: PostHog · Mixpanel · Amplitude · [Ad campaign management](https://hermoso.ai/docs/reference/ads/). Generated from the running MCP server, like the rest of the [tool reference](https://hermoso.ai/docs/reference/).

## Description

ASK POSTHOG A QUESTION IN HogQL — their SQL dialect over the `events`, `persons` and `sessions` tables. Use it for per-user funnels, retention and custom breakdowns, e.g. `SELECT properties.$current_url, count() FROM events WHERE event = '$pageview' AND timestamp > now() - INTERVAL 7 DAY GROUP BY 1 ORDER BY 2 DESC`. IT IS NOT AN EXPORTER AND MUST NEVER BE LOOPED — PostHog's own policy, verbatim: "Third-party connectors must use batch exports, not /query. Connectors built on /query are not supported and will be rate-limited or rejected." Ask ONE bounded question. Do not paginate it, do not schedule it, and do not call it repeatedly to assemble a whole table; if the user genuinely needs bulk data, tell them to set up a PostHog batch export. Every query is capped at 1000 rows, and OFFSET is refused outright because PostHog returns HTTP 400 for it on API keys — use keyset pagination on `timestamp` (events) or `id` (persons) if a second page is truly needed. Read-only, 0 credits.

## Parameters

Parameter Type Description

`query` required `string` a HogQL (ClickHouse-flavoured SQL) query — one bounded question, never a page of an export

`limit` `number` row cap, 1–1000 (default 1000). A LIMIT already in the query is honoured and clamped to the same ceiling

## Example call

Every required parameter is shown, filled from the schema where it gives a value and otherwise with a placeholder naming the type. Replace the placeholders with real values. The same call works on the MCP server, the CLI and `POST https://app.hermoso.ai/v1/tools/posthog_query`.

**MCP** (`tools/call`)

`{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"posthog_query","arguments":{"query":"<string>"}}}`
**CLI**

`hermoso call posthog_query --json '{"query":"<string>"}'`

## Credits

Credits are spent only on two things: running an AI model (image, video, voice, text, planning, post-production) and Ad Spy research. See [Credits & costs](https://hermoso.ai/docs/credits/).

## Related tools

- [list_posthog_projects](https://hermoso.ai/docs/reference/ads/list_posthog_projects/) List the PostHog projects this key can see
- [posthog_insight](https://hermoso.ai/docs/reference/ads/posthog_insight/) Read a saved PostHog insight (funnel / retention / trend)
- [list_posthog_session_recordings](https://hermoso.ai/docs/reference/ads/list_posthog_session_recordings/) List PostHog session replays
- [posthog_persons](https://hermoso.ai/docs/reference/ads/posthog_persons/) Look up people in PostHog
- [mixpanel_insights](https://hermoso.ai/docs/reference/ads/mixpanel_insights/) Read a saved Mixpanel report
- [mixpanel_retention](https://hermoso.ai/docs/reference/ads/mixpanel_retention/) Mixpanel retention cohorts
- [mixpanel_segmentation](https://hermoso.ai/docs/reference/ads/mixpanel_segmentation/) Mixpanel event segmentation (maintenance mode)
- [mixpanel_funnel](https://hermoso.ai/docs/reference/ads/mixpanel_funnel/) Read a saved Mixpanel funnel (maintenance mode)
- [list_mixpanel_events](https://hermoso.ai/docs/reference/ads/list_mixpanel_events/) List Mixpanel events (or one event’s properties)
- [amplitude_segmentation](https://hermoso.ai/docs/reference/ads/amplitude_segmentation/) Amplitude event segmentation

[All 759 Ad campaign management tools](https://hermoso.ai/docs/reference/ads/) · [tools.json](https://hermoso.ai/docs/reference/tools.json)
