Skip to main content
POST
Run a HogQL query on PostHog

Authorizations

Authorization
string
header
required

An API key, sent as Authorization: Bearer stfy_live_…. See Authentication for how to get one and which scopes it needs.

Body

application/json
query
string
required

A HogQL SELECT. It may hold the date tokens {START_DATE}, {END_DATE}, {START_DATE_SQL}, {END_DATE_SQL}, {START_DATE_MS} and {END_DATE_MS}

Required string length: 1 - 100000
limit
integer
default:10

The most rows to return

Required range: 1 <= x <= 100
period
enum<string>
default:WEEKLY

Fills the date tokens with the latest complete period

Available options:
DAILY,
WEEKLY,
MONTHLY
week_start_day
integer | null

0 = Monday … 6 = Sunday. The config's week start day when left out

Required range: 0 <= x <= 6

Response

200 - application/json

Successful Response

columns
string[]
required

The column names of the first row

row_count
integer
required

How many rows are returned

rows
Rows · object[]
required

The rows. They can hold any PostHog data, emails included

truncated
boolean
required

True when PostHog had more rows than limit