Setup
Put them in your environment or
.env; Data APIs covers the other ways.
Notes
- Every project endpoint needs the numeric project_id in the path; it is in the project’s settings and app URL.
- The query endpoint is the general way to read data: SQL over events, persons, sessions. Without your own LIMIT it returns 100 rows; with one, up to 50,000. It is not an export path.
- Rate limits per key: query 240/min and 2,400/hour with 3 concurrent queries and a 10 s execution cap per project; analytics endpoints (insights, persons) 240/min and 1,200/hour. Personal keys also draw from an hourly read budget (429 api_queries_budget_exceeded).
- List endpoints page with limit/offset and return next/previous URLs.
Endpoints
Get the authenticated user
- Needs user:read.
Run a SQL (HogQL) query
- A read over POST. Needs query:read.
- Long queries: use refresh async and poll GET /api/projects/{project_id}/query/{id}/.
Get an async query’s status and results
- Needs query:read.
List saved insights
- Needs insight:read.
Get an insight with its results
- Needs insight:read.
List dashboards
- Needs dashboard:read.
List persons
- Needs person:read.
List events
- Needs query:read. For aggregates use posthog.query.run.
List feature flags
- Needs feature_flag:read.