downloading-batch-export-files

Export PostHog events, persons, sessions, or HogQL query results and download Parquet or JSONLines files.

713|118|Updated Aug 11, 2020
One-click install
npx skills add https://github.com/PostHog/posthog-foss --skill downloading-batch-export-files
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: downloading-batch-export-files
Source: https://github.com/PostHog/posthog-foss/tree/main/products/batch_exports/skills/downloading-batch-export-files
Command: npx skills add https://github.com/PostHog/posthog-foss --skill downloading-batch-export-files

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Getting raw PostHog data out of the platform for offline analysis, backups, or migration normally requires manual API orchestration: starting an export, polling its status, and handling redirect-based file downloads. This Skill automates that entire workflow through MCP tools and the REST download endpoint.

Core Features & Use Cases

  • On-demand exports: Export events, persons, sessions, or arbitrary HogQL query results with optional event filters, date ranges, compression, and file size splitting.
  • Status polling and error handling: Poll export runs until completion, with clear handling for cancelled, failed, and timed-out states.
  • Redirect-based file download: Download exported Parquet or JSONLines files via the REST endpoint, following signed-URL redirects and saving results to disk.
  • Use Case: A data analyst needs last week's pageview events as compressed JSONLines for local analysis. The Skill starts the export, polls until completion, and saves the file as posthog-events-<run_id>-0.jsonl.gz.

Quick Start

Export all $pageview events from the past week as a gzip-compressed JSONLines file and download it to my machine.

Frequently Asked Questions about downloading-batch-export-files

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I export raw PostHog events to a file?

Start an on-demand export with the file-download-batch-exports-create MCP tool, specifying the events model, date range, and file format. Poll the run until it completes, then download each file through the REST download endpoint.

How do I export HogQL query results from PostHog?

Pass your query as hogql_query with the hogql model when creating the export, omitting date intervals. Every selected column must be a field or have an alias, and the hogql model is in closed beta enabled per team.

What file formats does PostHog batch export support?

Exports support Parquet and JSONLines formats. Compression options include zstd, gzip, brotli, lz4, and snappy, though JSONLines only supports gzip and brotli compression.

What is the maximum date range for a PostHog batch export?

The maximum export interval is one week per run. For longer periods, split the request into multiple separate export runs or choose which week to export.

Why did my HogQL batch export fail with a permission error?

A permission error stating HogQL batch exports are not enabled means your team does not have the closed beta feature. Contact PostHog support to request access rather than retrying with a different query.

Why does my export download URL stop working?

Download URLs are temporary signed URLs that expire after a period. Call the REST download endpoint again to receive a fresh redirect with a new signed URL.