
PostHog CaptureBatch
CertifiedCapture a batch of PostHog events
PostHog CaptureBatch
Capture a batch of PostHog events
Sends many analytics events in a single task, using the PostHog SDK's internal batching (POST /batch). Each item of from is an event with a required distinctId and event, and optional properties and timestamp. All items are validated before anything is sent, so an invalid item means that nothing is captured. Uses the project API key (phc_).
type: io.kestra.plugin.posthog.CaptureBatchExamples
Capture several events at once
id: posthog_capture_batch
namespace: company.analytics
tasks:
- id: capture_batch
type: io.kestra.plugin.posthog.CaptureBatch
apiKey: "{{ secret('POSTHOG_API_KEY') }}"
host: "https://us.i.posthog.com"
from:
- distinctId: user_1
event: pipeline_completed
properties:
pipeline_name: etl
- distinctId: user_2
event: pipeline_completed
timestamp: "2026-01-01T00:00:00Z"
Properties
apiKey *string
PostHog project API key
The project API key (starts with phc_). Use a Kestra secret, e.g. {{ secret('POSTHOG_API_KEY') }}.
from *object
Structured data items, either as a map, a list of map, a URI, or a JSON string.
Structured data items can be defined in the following ways:
- A single item as a map (a document).
- A list of items as a list of maps (a list of documents).
- A URI, supported schemes are
kestrafor internal storage files,filefor host local files, andnsfilefor namespace files. - A JSON String that will then be serialized either as a single item or a list of items.
Each item is an event with the following keys: distinctId (required), event (required), properties (optional map) and timestamp (optional ISO-8601 date-time with an offset, e.g. 2026-01-01T00: 00: 00Z). Any other key is ignored.
assets
Assets this task consumes as inputs or produces as outputs, for lineage tracking and the asset graph (Enterprise Edition). A flow declaring this property on a task is rejected in the open-source edition.
io.kestra.core.models.assets.AssetsDeclaration
IGNOREFAILWARNAsset failure behavior
Behavior applied to the task state when a declared asset fails to render, emit, or be persisted (e.g. a lock conflict): FAIL escalates it to FAILED, WARN (default) warns it if it would otherwise succeed, IGNORE leaves the state untouched.
Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.
The assets consumed as inputs.
io.kestra.core.models.assets.AssetIdentifier
1The assets produced as outputs.
io.kestra.plugin.ee.assets.Dataset
1150{}1150io.kestra.plugin.ee.assets.File
1150{}1150io.kestra.plugin.ee.assets.Table
1150{}1150io.kestra.plugin.ee.assets.VM
1150{}1150io.kestra.core.models.assets.External
1150{}1150io.kestra.core.models.assets.Custom
11501Custom asset type
{}1150batchSize integerstring
1000Maximum number of events per request
Maximum number of events the PostHog SDK sends in one POST /batch request. Must be at least 1. Inputs with at most this many events are sent in a single request.
host string
PostHog host
The PostHog ingestion host, e.g. https://us.i.posthog.com (US Cloud), https://eu.i.posthog.com (EU Cloud) or a self-hosted URL. Defaults to US Cloud when empty.
Outputs
eventsCount integer
Number of events handed to the PostHog SDK
The number of events handed to the PostHog SDK, which sent them and waited for the requests to finish. This is not a confirmation that PostHog accepted them: the SDK does not report delivery failures.