/downloading-batch-export-files
Export PostHog events, persons, or sessions on demand and download the resulting files. Use when the user asks to download/export raw PostHog data, create a one-off file export, fetch a Parquet or JSONLines export, or use the file_download_batch_exports API. Covers starting the
$ npx -y skills add posthog/posthog --skill downloading-batch-export-files --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/downloading-batch-export-files
Context preview
The summary Claude sees to decide when to auto-load this skill.
Export PostHog events, persons, or sessions on demand and download the resulting files. Use when the user asks to download/export raw PostHog data, create a one-off file export, fetch a Parquet or JSONLines export, or use the file_download_batch_exports API. Covers starting the
SKILL.md
downloading-batch-export-files.SKILL.mdname: downloading-batch-export-files
description: >
Export PostHog events, persons, or sessions on demand and download the resulting files. Use when the user asks to
download/export raw PostHog data, create a one-off file export, fetch a Parquet or JSONLines export, or use the
file_download_batch_exports API. Covers starting the export with MCP, polling completion, and downloading via the
existing REST redirect endpoint.
Downloading batch export files
Use this skill when a user wants a one-off downloadable export of PostHog data. The export is started and monitored through MCP, but the final file download uses the existing REST endpoint directly.
Available MCP tools
| Tool | Purpose | | ---------------------------------------------- | -------------------------------------------------------- | | `posthog:file-download-batch-exports-create` | Start an on-demand export and return the run ID | | `posthog:file-download-batch-exports-retrieve` | Poll the run status and return file IDs after completion |
Do not rely on a generated MCP tool for the `/download/` endpoint. That endpoint is a redirecting file download endpoint, so raw HTTP/download handling is the right interface until MCP has explicit redirect support.
Workflow
1. Choose the export shape
Ask a short clarifying question if the user did not specify the required inputs:
- `model`: one of `events`, `persons`, or `sessions`
- `data_interval_start` and `data_interval_end`: ISO 8601 datetimes; the range must be at most one week
- `file.format`: `Parquet` or `JSONLines`; prefer `Parquet` for compact analytics exports and `JSONLines` for line-oriented text processing
- `file.compression`: optional, one of `zstd`, `gzip`, `brotli`, `lz4`, or `snappy`. If `JSONLines` was chosen as format, only `gzip` and `brotli` are supported.
- `file.max_size_mb`: optional maximum part size in MB; set this when the user wants multiple smaller files instead of a single (potentially large) file.
For `events`, `include` and `exclude` are optional event-name filters. Use them only when the user asks for specific events or wants to omit specific events.
2. Start the export
Call `posthog:file-download-batch-exports-create` with the selected shape. The response contains an `id` for the export run.
Example request:
{
"model": "events",
"file": {
"format": "JSONLines",
"compression": "gzip"
},
"include": ["$pageview"],
"data_interval_start": "2026-05-25T00:00:00Z",
"data_interval_end": "2026-05-26T00:00:00Z"
}3. Poll until completion
Call `posthog:file-download-batch-exports-retrieve` with the returned `id`.
Status handling:
| Status | Action | | ------------------------------------------------------------------------- | --------------------------------------------- | | `Starting` or `Running` | Wait briefly and poll again | | `Completed` | Read the `files` array and download each file | | `Cancelled` | Stop and report that the run was cancelled | | `Failed`, `FailedRetryable`, `FailedBilling`, `Terminated`, or `TimedOut` | Stop and report the `error` field |
When `Completed`, the `files` array contains file UUIDs. For single-file exports it usually contains one UUID. For split exports, download every UUID unless the user asked for a specific part.
4. Optionally, cancel a running export
If required by the user, a running export can be cancelled by calling `posthog:file-download-batch-exports-cancel-create` with the returned `id`.
An export that has already finished or has already failed may not be cancelled.
After cancelling an export, the `id` may not be used anymore and the export must start again from the beginning. However, you may still use the `id` to retrieve the export status (which will always be `Cancelled`).
5. Download files through REST
Use a direct authenticated HTTP request to the existing endpoint:
GET /api/projects/{project_id}/file_download_batch_exports/{run_id}/download/{part}/`part` can be either:
- a file UUID from the `files` array returned by `file-download-batch-exports-retrieve`
- a zero-based file index, ordered by key
If there is only one file, this also works without `part`:
GET /api/projects/{project_id}/file_download_batch_exports/{run_id}/download/Let the HTTP client follow the redirect, or inspect the `Location` header if you need the temporary signed URL. Use the same PostHog authentication context as other API calls.
6. Save, do not print, file contents
Treat the result as a file download, not a chat response. Parquet is binary and must be written as bytes. JSONLines may still be large; save it to a file rather than pasting the contents unless the user explicitly asks for a tiny sample.
Use a filename that includes the model, run ID, and part identifier when possible, for example:
posthog-events-<run_id>-<part>.jsonl.gz
posthog-persons-<run_id>-<part>.parquet
Watch-outs
- The maximum export interval is one week. Split longer user requests into separate export runs or ask which week to export.
- A run can briefly report `Running` after completion while file records are being created. Poll again instead of failing immediately.
- Download URLs are temporary. If a URL expires, call the REST download endpoint again for a fresh redirect.
- Do not send the signed URL to unrelated services unless the user explicitly asks; it grants temporary access to the exported file.
- If the user wants all parts of a split export, iterate over every UUID in `files`; do not assume part `0`
Read more
name: downloading-batch-export-files description: > Export PostHog events, persons, or sessions on demand and download the resulting files. Use when the user asks to download/export raw PostHog data, create a one-off file export, fetch a Parquet or JSONLines export, or use the file_download_batch_exports API. Covers starting the export with MCP, polling completion, and downloading via the existing REST redirect endpoint.
Downloading batch export files
Use this skill when a user wants a one-off downloadable export of PostHog data. The export is started and monitored through MCP, but the final file download uses the existing REST endpoint directly.
Available MCP tools
| Tool | Purpose | | ---------------------------------------------- | -------------------------------------------------------- | | `posthog:file-download-batch-exports-create` | Start an on-demand export and return the run ID | | `posthog:file-download-batch-exports-retrieve` | Poll the run status and return file IDs after completion |
Do not rely on a generated MCP tool for the `/download/` endpoint. That endpoint is a redirecting file download endpoint, so raw HTTP/download handling is the right interface until MCP has explicit redirect support.
Workflow
1. Choose the export shape
Ask a short clarifying question if the user did not specify the required inputs:
- `model`: one of `events`, `persons`, or `sessions`
- `data_interval_start` and `data_interval_end`: ISO 8601 datetimes; the range must be at most one week
- `file.format`: `Parquet` or `JSONLines`; prefer `Parquet` for compact analytics exports and `JSONLines` for line-oriented text processing
- `file.compression`: optional, one of `zstd`, `gzip`, `brotli`, `lz4`, or `snappy`. If `JSONLines` was chosen as format, only `gzip` and `brotli` are supported.
- `file.max_size_mb`: optional maximum part size in MB; set this when the user wants multiple smaller files instead of a single (potentially large) file.
For `events`, `include` and `exclude` are optional event-name filters. Use them only when the user asks for specific events or wants to omit specific events.
2. Start the export
Call `posthog:file-download-batch-exports-create` with the selected shape. The response contains an `id` for the export run.
Example request:
{
"model": "events",
"file": {
"format": "JSONLines",
"compression": "gzip"
},
"include": ["$pageview"],
"data_interval_start": "2026-05-25T00:00:00Z",
"data_interval_end": "2026-05-26T00:00:00Z"
}3. Poll until completion
Call `posthog:file-download-batch-exports-retrieve` with the returned `id`.
Status handling:
| Status | Action | | ------------------------------------------------------------------------- | --------------------------------------------- | | `Starting` or `Running` | Wait briefly and poll again | | `Completed` | Read the `files` array and download each file | | `Cancelled` | Stop and report that the run was cancelled | | `Failed`, `FailedRetryable`, `FailedBilling`, `Terminated`, or `TimedOut` | Stop and report the `error` field |
When `Completed`, the `files` array contains file UUIDs. For single-file exports it usually contains one UUID. For split exports, download every UUID unless the user asked for a specific part.
4. Optionally, cancel a running export
If required by the user, a running export can be cancelled by calling `posthog:file-download-batch-exports-cancel-create` with the returned `id`.
An export that has already finished or has already failed may not be cancelled.
After cancelling an export, the `id` may not be used anymore and the export must start again from the beginning. However, you may still use the `id` to retrieve the export status (which will always be `Cancelled`).
5. Download files through REST
Use a direct authenticated HTTP request to the existing endpoint:
GET /api/projects/{project_id}/file_download_batch_exports/{run_id}/download/{part}/`part` can be either:
- a file UUID from the `files` array returned by `file-download-batch-exports-retrieve`
- a zero-based file index, ordered by key
If there is only one file, this also works without `part`:
GET /api/projects/{project_id}/file_download_batch_exports/{run_id}/download/Let the HTTP client follow the redirect, or inspect the `Location` header if you need the temporary signed URL. Use the same PostHog authentication context as other API calls.
6. Save, do not print, file contents
Treat the result as a file download, not a chat response. Parquet is binary and must be written as bytes. JSONLines may still be large; save it to a file rather than pasting the contents unless the user explicitly asks for a tiny sample.
Use a filename that includes the model, run ID, and part identifier when possible, for example:
posthog-events-<run_id>-<part>.jsonl.gz posthog-persons-<run_id>-<part>.parquet
Watch-outs
- The maximum export interval is one week. Split longer user requests into separate export runs or ask which week to export.
- A run can briefly report `Running` after completion while file records are being created. Poll again instead of failing immediately.
- Download URLs are temporary. If a URL expires, call the REST download endpoint again for a fresh redirect.
- Do not send the signed URL to unrelated services unless the user explicitly asks; it grants temporary access to the exported file.
- If the user wants all parts of a split export, iterate over every UUID in `files`; do not assume part `0`
:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Repo: posthog/posthog
Other skills on posthog.
- /analyzing-expensive-users
Analyze the most expensive users in AI observability and explain why they cost so much. Use when the user asks about top spenders, expensive users, per-user LLM cost, user-level cost drivers, or patterns behind high AI observability spend.
Open skill - /creating-online-evaluations
Author continuously-running online evaluations in PostHog AI observability, grounded in real failure modes you've identified. Use when the user wants evaluations that automatically score new generations or whole traces going forward — "create an eval to catch X", "continuously
Open skill - /exploring-ai-failures
Find where an AI/LLM application is failing in production and surface the failure patterns, working from real traces. Use when someone wants to understand what's going wrong with an AI feature, find and categorize failure modes, triage errors, or investigate quality issues
Open skill - /exploring-llm-clusters
Investigate AI observability clusters — understand usage patterns in AI/LLM traffic, compare cluster behavior, compute cost/latency metrics, and drill into individual traces within clusters.
Open skill - /exploring-llm-costs
Investigate LLM spend in PostHog — total cost over time, cost by model, provider, user, trace, or custom dimension, token and cache-hit economics, and cost regressions. Use when the user asks "how much are we spending on LLMs?", "which model / user / feature is most expensive?",
Open skill - /exploring-llm-evaluations
Investigate AI observability evaluations — `hog` (deterministic code-based), `llm_judge` (LLM-prompt-based), and `sentiment` (user-message sentiment). Find existing evaluations, inspect their configuration, run them against specific generations, query individual results, and
Open skill

