Command Palette

Search for a command to run...

Back to skills
skill № 42732

building-on-capture-v1

How to build on capture v1, PostHog's batch event intake API (`/i/v1/analytics/events`, `/i/v1/ai/events`). Use when sending events to capture from PostHog…

FreeNo executable scripts
PostHogby PostHog★ 41,278 GitHub stars

Install building-on-capture-v1 in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

About this skill

Building on capture v1

Capture v1 is the batch intake API that the v1 SDKs and PostHog's internal senders use. Legacy capture (/batch, /e, /capture, /i/v0/e) still serves older SDKs and stays supported, but new senders use v1.

Sources of truth, in the order to read them:

Send events from PostHog code

  • On behalf of a customer team, from Django: use capture_internal or capture_batch_internal for analytics events, and capture_ai_internal for $ai_* events, from posthog/api/capture.py. They implement the headers, retries and per-event results, so do not write a new HTTP client.
  • From Node: follow push-capture.ts. From Rust: follow batch-import-worker/src/emit/capture.rs.
  • PostHog's own telemetry (team 2): use the PostHog SDK for the language, on its v1 major.
  • Never produce to the ingestion Kafka topics directly. Capture owns quotas, restrictions, deduplication and routing.
  • Some internal senders and internal SDK installs still use legacy capture at the first v1 release. references/internal-senders.md lists every sender and which capture it uses. Those move to v1 soon after the release; update the list and this skill when they do. Do not move one in an unrelated PR.

Compose a v1 event

  • Put settings in options explicitly, for example {"process_person_profile": false}. Never set them as $process_person_profile, $cookieless_mode, $ignore_sent_at or $product_tour_id properties. An HTTP sender has no SDK to move those properties into options, and capture ignores $ignore_sent_at and $product_tour_id in properties.
  • Send session_id and window_id as event fields, not as $session_id and $window_id properties.
  • For events sent on a customer's behalf, set "capture_internal": true on the batch, not in properties. Capture then records 127.0.0.1 instead of the PostHog server's IP. Capture v1 ignores a capture_internal property, which is where legacy capture reads it.
  • Send $ai_* events to /i/v1/ai/events and every other event to /i/v1/analytics/events. Capture still routes $ai_* events from the analytics endpoint to the AI topic, but only for now. Do not rely on it. The AI endpoint, and an SDK's AI capture call, drop every event that is not $ai_* with misrouted_event. That includes $mcp_* events: send them to the analytics endpoint.
  • Give every event its own UUID. On a retry, resend only the events with result retry, with the same uuid, PostHog-Request-Id and created_at, PostHog-Attempt plus one, and a new PostHog-Request-Timestamp.
  • Set PostHog-Sdk-Info to <sender>/<version>. Ingestion uses it as $lib and $lib_version only when the event has no $lib.

Choose an option or a property

Why options exist. Legacy capture took settings as $ properties inside the event data. Capture forwards properties to Kafka as raw JSON, and the client controls them, so capture could not act on a setting and ingestion could not trust one. Capture v1 moves settings into a separate options object. Capture validates each option, acts on it, and publishes it beside the event in the Kafka message, outside the client-controlled data. Ingestion then writes the matching $ property, so products and queries read the same property as before.

The rule:

  • Add an option when capture must read, act on or change the value: timestamps, partitioning, quotas, routing or a drop decision. If services after capture also need the value, ingestion copies the option into a property.
  • Add a property when only ingestion or later services read or change the value. A new property needs no capture change.

Any v1 sender can put any string key with any JSON value in options, as with properties. Every v1 SDK passes unknown option keys through unchanged, so a new option needs no SDK change. The v1 SDKs move the four legacy $ properties into options under the option names (see the mapping in the capture v1 API docs and the [sdk-specs capture spec](https://github.com/

Full SKILL.md on GitHub

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

Bundled files

  • references/internal-senders.md
  • references/sdk-implementations.md

FAQ

What does the building-on-capture-v1 skill do?

How to build on capture v1, PostHog's batch event intake API (`/i/v1/analytics/events`, `/i/v1/ai/events`). Use when sending events to capture from PostHog code, changing any capture code under `rust/capture/` (legacy or v1) or the `capture_internal` helpers, adding a per-event option (`event.options`) or a property that capture or ingestion must read, changing how Node ingestion or livestream applies capture `options`, changing the v1 request, batch, header or event schema, or checking whether an SDK or internal service uses capture v1 or legacy capture (`/batch`, `/e`, `/capture`, `$process_person_profile` or `$cookieless_mode` set as properties). Covers when to add an option versus a property and why options exist, the files to change for a new option, how to compose a v1 event at a call site, internal senders, and how to tell a v1 SDK from a legacy one.

How do I install the building-on-capture-v1 skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the building-on-capture-v1 skill run scripts?

No, this skill is instructions only (SKILL.md) with no executable scripts.

Related skills

Compare building-on-capture-v1 with