Canonical: https://weaveos.com/reference/posthog/paginate-hogql-query

1. [Software capabilities](https://weaveos.com/reference)
2. /[PostHog](https://weaveos.com/reference/posthog)
3. /Paginate a PostHog HogQL query

[![](https://weaveos.com/reference/logos/posthog.svg)PostHog](https://weaveos.com/reference/posthog)

# Paginate a PostHog HogQL query

Personal API keys cannot use OFFSET with the PostHog Query API. For ad hoc paging, use a keyset predicate on the sort column. Use Batch Exports when you need a complete export.

Documentation reviewed November 27, 2026 · 2 methods with sources

## Ways to do it

1. [1API: POST /api/projects/{project\_id}/query](https://weaveos.com/reference/posthog/paginate-hogql-query#method-1)
2. [2Interface: PostHog SQL editor](https://weaveos.com/reference/posthog/paginate-hogql-query#method-2)

API

### POST /api/projects/{project\_id}/query

Run a named HogQLQuery with a bounded result set through the Query API.

[Read source: PostHog warehouse query pagination](https://posthog.com/docs/data-warehouse/query)

- Requirements

  A PostHog personal API key with project query read permission, project ID, and the correct US or EU API host.

- Limitations

  Personal API keys get HTTP 400 for OFFSET pagination. For ad hoc event pages, use a timestamp cursor and account for rows with the same timestamp at a page boundary.

Example shell

Copy

```
curl --fail "https://us.posthog.com/api/projects/$POSTHOG_PROJECT_ID/query/" \
  -H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
  -H 'Content-Type: application/json' --data-binary @- <<'JSON'
{"query":{"kind":"HogQLQuery","name":"events_after_cursor","query":"SELECT event, timestamp FROM events WHERE timestamp > '2026-11-27 00:00:00' ORDER BY timestamp LIMIT 1000"}}
JSON
```

Interface

### PostHog SQL editor

Use the SQL editor to inspect a bounded result and apply LIMIT or OFFSET interactively.

[Read source: PostHog SQL editor](https://posthog.com/docs/data-warehouse/sql)

- Requirements

  A PostHog project with access to the SQL editor.

- Limitations

  SQL insights default to 100 rows. Set a LIMIT explicitly if you need a different page size.

Example text

Copy

```
SELECT event, timestamp FROM events ORDER BY timestamp LIMIT 100 OFFSET 100
```

[Previous PostHog taskRead a PostHog feature flag definition](https://weaveos.com/reference/posthog/read-feature-flag-definition)

## More from PostHog

[View all 3 PostHog tasks](https://weaveos.com/reference/posthog)

- ### [Query PostHog event data](https://weaveos.com/reference/posthog/query-event-data)

  Send a HogQL query to the Query API when an application needs the results. Use the PostHog SQL editor or the execute-sql MCP tool for an interactive query.

  API, MCP, Interface
