unstale

npm / posthog-node

posthog-node

What changed in posthog-node 5 to 6, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.

100 breaking2 security14 deprecations95 new APIs and options4 performance71 behavior and defaults82 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

posthog-node 6133 changes

Breaking changes 78

  • Transactional email requests now use /api/messaging/ instead of the /api/projects/@current/ alias. This requires PostHog Cloud or self-hosted PostHog from 2026-11-18; older self-hosted versions return 404.

    6.0.4release notes

  • alias no longer takes its alias target from context or register().

    6.0.0upgrade guide

  • Hooks receive copies of plain objects and arrays, so nested edits no longer mutate caller, register, or context values; class instances are not copied.

    6.0.0upgrade guide

  • Changing the message's disableGeoip field in the hook has no effect; edit properties instead.

    6.0.0release notes

  • An event is dropped if the hook leaves distinctId missing, null, or non-string; caller non-string IDs are converted to strings before the hook, while an empty string is still sent to capture and dropped there.

    6.0.0release notesupgrade guide

  • Changing the message's groups field in the hook has no effect; edit properties instead.

    6.0.0release notes

  • A throwing hook still drops the event, but its error log now names the event and error type, omits the error message, and appears even when debug is off.

    6.0.0upgrade guide

  • The 5.x.x name was ignored in 6.0.0 without a warning, so a before_send hook did not run there.

    6.0.0upgrade guide

  • Hooks now see SDK-added properties and an options object before sending. Hooks returning a new message must copy options; edits to groups or sendFeatureFlags no longer affect the preceding feature flag request.

    6.0.0upgrade guide

  • Hooks receive copies of plain objects and arrays, so nested mutations no longer alter caller, register, or context values.

    6.0.0upgrade guide

  • Hooks now see SDK-added properties and options before sending; returned messages must copy options to preserve them, and hook changes can affect or remove event values.

    6.0.0upgrade guide

  • Configuration uses beforeSend instead of before_send. The hook now sees SDK-added properties and options; hooks returning a new message must preserve options.

    6.0.0upgrade guide

  • Capture v1 batches are no longer split and retried after a 413; a 413 fails the whole batch and events are lost.

    6.0.0upgrade guide

  • A 2xx response without a results field fails the whole batch and reports through the error event without resending; an empty results object still means delivery succeeded.

    6.0.0release notes

  • Events now send only through capture v1, with AI events on their own lane.

    6.0.0release notes

  • Follows only same-origin 307 and 308 redirects; invalid event UUIDs are replaced with a warning, and dropped duplicate copies are reported.

    6.0.0release notes

  • Capture drops an invalid event instead of rejecting the whole request, allowing the rest of a batch to be delivered; drops are reported through error.

    6.0.0upgrade guide

  • AI events use a separate queue, batches, and requests; events with properties larger than 8 MiB are dropped, and event names must start with $ai_.

    6.0.0upgrade guide

  • Use captureAi or captureAiImmediate for $ai_ events; only these methods use the AI endpoint, while capture sends them to the analytics endpoint temporarily.

    6.0.0upgrade guide

  • Events sent with captureAi must have names starting with $ai_; other event names are dropped and reported as misrouted_event.

    6.0.0upgrade guide

  • AI events larger than 8 MiB of properties are dropped before sending and reported through error.

    6.0.0upgrade guide

  • On posthog-node 6.x.x, @posthog/ai sends every AI event with captureAi; enableFullAiCapture then controls only string truncation and media redaction.

    6.0.0upgrade guide

  • Replaces CaptureV1Error.

    6.0.0release notesupgrade guide

  • The SDK reports capture v1 dropped events as failures, including events dropped inside a successful 2xx response; a 402 fails the batch without retry.

    6.0.0upgrade guide

  • Reserved exception properties such as $exception_level passed in properties are ignored so the SDK's value is sent.

    6.0.0release notesupgrade guide

  • TypeScript callers must replace positional arguments after error with an options object containing fields such as distinctId, properties, and level; JavaScript positional calls still work.

    6.0.0upgrade guide

  • The method takes an options object after error instead of positional arguments; TypeScript callers must use the options object.

    6.0.0upgrade guide

  • Renamed to CaptureError.

    6.0.0release notesupgrade guide

  • Renames the configuration option custom_blocked_useragents to customBlockedUserAgents.

    6.0.0upgrade guide

  • Renames the configuration option disable_capture_url_hashes to disableCaptureUrlHashes.

    6.0.0upgrade guide

  • A personal API key used as the project token disables the client, as do missing or empty tokens. Pass disabled: true to build a client intentionally disabled.

    6.0.0upgrade guide

  • Property precedence changes: event, context, register, and before_send values for $geoip_disable can override the client setting; a per-call disableGeoip argument overrides context and register.

    6.0.0upgrade guide

  • The per-call setting now sends $geoip_disable: false when false, and takes precedence over context and register settings; a call property can still override it.

    6.0.0upgrade guide

  • An empty or whitespace distinct ID counts as missing; group identify falls back to the context ID, then $<type>_<key>.

    6.0.0release notes

  • A non-string distinctId passed to capture is converted to a string before before_send runs.

    6.0.0upgrade guide

  • Empty or whitespace-only IDs count as missing; IDs over 200 UTF-8 bytes cause the event to be dropped and reported, rather than shortened.

    6.0.0upgrade guide

  • Empty or whitespace-only IDs count as missing and fall back to the context ID or a generated personless ID; IDs over 200 UTF-8 bytes are dropped and reported.

    6.0.0upgrade guide

  • Removed; use withContext to scope async context to a callback.

    6.0.0release notesupgrade guide

  • Every delivery failure is emitted as a CaptureError on the error event, with details such as endpoint, requestId, drops, and retryExhausted.

    6.0.0upgrade guide

  • Events with missing, empty, non-string, malformed Unicode, or over-200-byte names are dropped and reported instead of being sent.

    6.0.0upgrade guide

  • Event, context, and registered values take precedence over SDK-added values, and before_send can see and change them.

    6.0.0release notesupgrade guide

  • An object with its own toJSON is kept whole during layered property merging, leaving its toJSON to decide what is sent.

    6.0.0upgrade guide

  • An event with a property value that throws during reading or serialization is dropped alone and reported as unserializable; the report contains no event content and the error is not kept or logged.

    6.0.0upgrade guide

  • Capture keeps only the first event for each UUID in a request and reports later copies; accepted UUID forms are normalized to lowercase hyphenated form, while other values are replaced with generated UUIDs.

    6.0.0upgrade guide

  • Missing, empty, non-string, or ill-formed Unicode event names and ill-formed Unicode IDs are dropped and reported; lone surrogates in property strings are replaced with U+FFFD.

    6.0.0release notes

  • Properties owned by the SDK, such as $exception_list and $exception_level, are ignored in properties; reserved properties the SDK does not set can still pass through context or register().

    6.0.0upgrade guide

  • This option no longer controls capture retry waits, but still applies to other requests.

    6.0.0upgrade guide

  • No longer rejects on delivery failures; failures arrive through the error event.

    6.0.0release notesupgrade guide

  • flush and shutdown now send analytics and AI lanes at the same time; shutdown uses one deadline for both.

    6.0.0upgrade guide

  • Group identification now falls back to the context distinct ID before generating a group ID, and never adds the context session ID.

    6.0.0upgrade guide

  • Call-level groups merge key by key into the call's $groups property, and groups wins when both set the same key.

    6.0.0upgrade guide

  • Analytics event methods, including captureImmediate, now send to this capture v1 endpoint; reverse proxies must forward it.

    6.0.0upgrade guide

  • These events default to process_person_profile: true; context and registered person-processing settings no longer turn that processing off for them.

    6.0.0upgrade guide

  • Capture drops events whose option value it cannot read and reports the error through the error event with details invalid_options.

    6.0.0release notesupgrade guide

  • Exception level sets $exception_level; the TypeScript type accepts fatal, error, warning, log, info, and debug, while runtime also maps documented aliases case-insensitively.

    6.0.0upgrade guide

  • A $lib set on the event, in context, or with register() now wins over the SDK's library identity values.

    6.0.0upgrade guide

  • Now applies to analytics events only.

    6.0.0release notesupgrade guide

  • NaN, Infinity, and -Infinity are sent as null; NaN under $set clears that person property.

    6.0.0upgrade guide

  • Every capture call takes a per-event options map sent unchanged; legacy option properties still work, but an option overrides its legacy property.

    6.0.0release notes

  • Capture and related methods accept processing options alongside properties. Options are sent as given; unreadable values drop the event, while non-object values are logged and ignored.

    6.0.0upgrade guide

  • A phx_... personal API key used as the project API key disables the client like a missing key, and the error log never includes the key.

    6.0.0release notesupgrade guide

  • With posthog-node 6.x.x, the integration sends every AI event with captureAi; enableFullAiCapture then controls only string truncation and media redaction.

    6.0.0upgrade guide

  • No longer read; capture always uses capture v1.

    6.0.0release notesupgrade guide

  • Returns a flat message with top-level options, uuid, timestamp, and disableGeoip.

    6.0.0release notes

  • The returned message is flat: uuid, timestamp, and disableGeoip are top-level fields, while options holds event options.

    6.0.0upgrade guide

  • Renames the configuration option __preview_capture_bot_pageviews to __previewCaptureBotPageviews.

    6.0.0upgrade guide

  • For listed identity and group events with a distinct ID not generated by the SDK, the property defaults to true unless the call sets it.

    6.0.0release notes

  • Identify-style events now default to person processing unless a personless distinct ID is generated; null counts as unset, and before_send can change the option.

    6.0.0upgrade guide

  • MCP events from sessions with no resolved identity carry process_person_profile: false; per-event values take precedence over registerOptions() or context values.

    6.0.0upgrade guide

  • Lone surrogates in property strings are replaced with U+FFFD so the event is kept.

    6.0.0upgrade guide

  • Lone surrogates in property strings are replaced with U+FFFD, and NaN and infinities are sent as null rather than failing the request.

    6.0.0upgrade guide

  • Now returns a promise.

    6.0.0release notes

  • SDK configuration names now use camelCase.

    6.0.0release notes

  • The /flags request now runs before before_send and uses the event's distinct ID; hook edits to groups or sendFeatureFlags no longer affect that request.

    6.0.0upgrade guide

  • Capture v1 sends this as a top-level event field rather than a property; string values pass through, null and undefined are unset, and other values cause the event to be dropped with a warning.

    6.0.0upgrade guide

  • An event with a property value that throws during reading or serialization is dropped alone and reported through error, without including event content.

    6.0.0upgrade guide

  • Use withContext to scope async context to a callback.

    6.0.0release notesupgrade guide

  • Using zstd compression requires Node 22.15 or later and falls back to gzip elsewhere, including the edge build.

    6.0.0upgrade guide

Deprecations 5

  • Accepted again as a deprecated alias for its camelCase name; the camelCase option wins if both are set.

    6.0.2release notes

  • The 5.x.x name is a deprecated alias that still works after 6.0.0, logs one deprecation error per process, and will be removed in the next major version. beforeSend wins if both are set.

    6.0.0upgrade guide

  • JavaScript positional calls still work but log one deprecation error per method per process; use the options object instead, as positional calls will be removed in the next major version.

    6.0.0upgrade guide

  • JavaScript positional calls still work but log one deprecation error per method per process and will be removed in the next major version; arguments after the options object are ignored with one warning per process.

    6.0.0upgrade guide

  • The 5.x.x name is a deprecated alias that still works after 6.0.0, logs one deprecation error per process, and will be removed in the next major version. disableCaptureUrlHashes wins if both are set.

    6.0.0upgrade guide

New APIs and options 17

  • New AI capture compression configuration option.

    6.0.0release notesupgrade guide

  • New AI capture queue-size configuration option.

    6.0.0release notesupgrade guide

  • New AI capture request-timeout configuration option.

    6.0.0release notesupgrade guide

  • New capture compression configuration option.

    6.0.0release notesupgrade guide

  • The exported error type represents delivery failures and exposes endpoint, requestId, drops, retryExhausted, and cause details.

    6.0.0upgrade guide

  • Now takes an options object with distinctId, properties, options, uuid, flags, and level; the old positional form still works in 6.x and logs a deprecation error once per method.

    6.0.0release notesupgrade guide

  • New capture retry configuration option.

    6.0.0release notesupgrade guide

  • New client option, defaulting to true, controls whether Express and NestJS integrations read tracing headers into request context.

    6.0.0release notesupgrade guide

  • Defaults to true.

    6.0.0release notes

  • Pass disabled: true to intentionally build a disabled client, for example in tests.

    6.0.0upgrade guide

  • Event options are typed booleans with support for additional JSON-valued options.

    6.0.0release notesupgrade guide

  • @posthog/mcp accepts per-event options per call or from an instrument() callback and passes them as the event's options; its beforeSend hook can change them.

    6.0.0upgrade guide

  • Pass per-event options to the LangChain callback handler and the OpenAI Agents, Claude Agent SDK, Google ADK, and Genkit integrations.

    6.0.0upgrade guide

  • Set per-event options on wrapped provider calls and withTracing() in @posthog/ai.

    6.0.0upgrade guide

  • Sets options on every event, like register() does for properties; it returns a promise.

    6.0.0upgrade guide

  • Removes one registered option and returns a promise.

    6.0.0upgrade guide

  • Accepts options that apply to every event in the context.

    6.0.0upgrade guide

Behavior and default changes 27

  • Analytics and AI events are batched and sent on separate lanes, in batches of about 5 MiB at most; network-failed events are retained and retried on the next flush.

    6.0.0release notesupgrade guide

  • A throwing hook is logged with console.error even when debug is off; the log names only the event and error type.

    6.0.0release notes

  • Capture now drops only the malformed event before sending, allowing the rest of the batch to be delivered.

    6.0.0upgrade guide

  • Retries only 404, 408, 429, 500, 502, 503, 504, and network errors, with exponential backoff, jitter, a 30-second maximum, and at least Retry-After.

    6.0.0release notesupgrade guide

  • Sends to /i/v1/ai/events.

    6.0.0release notesupgrade guide

  • Generated event UUIDs and personless distinct IDs now take their random bits from crypto.getRandomValues instead of Math.random.

    6.0.0release notesupgrade guide

  • Debug mode logs event names, UUIDs, and counts instead of whole events; capture errors can still include server or proxy response text.

    6.0.0release notes

  • Every delivery failure is reported on this event as a CaptureError, with endpoint, request ID, dropped-event details, retry state, and any underlying request error.

    6.0.0upgrade guide

  • Call evaluateFlags() yourself and pass its snapshot as flags to avoid the automatic /flags request.

    6.0.0upgrade guide

  • An unparseable timestamp is replaced with the current time and now logs a warning that never includes the value.

    6.0.0release notesupgrade guide

  • The fallback distinct ID now uses the passed ID, then context ID, then a generated group ID; groupIdentify also receives context and register properties and options.

    6.0.0upgrade guide

  • captureAi and captureAiImmediate now send to this endpoint; reverse proxies must forward it.

    6.0.0upgrade guide

  • identify and alias now add the context session ID as $session_id, and context and register properties and options reach these events.

    6.0.0upgrade guide

  • Exception level is read case-insensitively, aliases critical to fatal and warn to warning, and defaults unknown values to error.

    6.0.0release notes

  • The field sets $exception_level, defaults to error, and accepts the documented TypeScript levels; runtime aliases are normalized case-insensitively and unknown values are ignored.

    6.0.0upgrade guide

  • Events send $lib and $lib_version in properties; a $lib supplied on the event, in context, or with register wins, and before_send can change or remove them.

    6.0.0release notes

  • Event and context values can override the SDK library label; relayed events keep their library identity, and before_send now sees the SDK-filled result.

    6.0.0upgrade guide

  • The zstd compression option requires Node 22.15 or later and falls back to gzip elsewhere, including the edge build.

    6.0.0upgrade guide

  • A non-object options value is logged as an error and ignored while the event is still sent.

    6.0.0upgrade guide

  • The client sends its library name and version in this request header; PostHog uses it to fill missing or invalid event library identity fields.

    6.0.0upgrade guide

  • Disabling captureTracingHeaders does not disable the cookie fallback; leave readPostHogCookie off as well to stop all request linking.

    6.0.0upgrade guide

  • Proxies must forward both capture routes and required headers, accept request bodies up to 20 MB, and pass capture responses through. Capture requests follow only same-origin 307 and 308 redirects, up to five times.

    6.0.0upgrade guide

  • Logs no longer print whole events or hook error messages; debug logs show event names, UUIDs, and counts instead.

    6.0.0upgrade guide

  • A non-string value is dropped with a warning.

    6.0.0release notes

  • Timestamps are sent in UTC with millisecond precision, and invalid timestamps are replaced with the current time with a warning that omits the value.

    6.0.0upgrade guide

  • Now returns a promise.

    6.0.0release notes

  • Generated personless distinct IDs and event UUIDs are now UUIDv7, with random bits from crypto.getRandomValues instead of Math.random.

    6.0.0upgrade guide

Fixes and other changes 6

  • Null-valued custom exception properties are dropped after beforeSend without undoing redaction or changing array positions.

    6.0.3release notes

  • F alsey JSON payloads from legacy flag responses are preserved in feature flag snapshots.

    6.0.3release notes

  • Context and register() properties and options now reach identify, alias, and groupIdentify events, not only capture.

    6.0.0upgrade guide

  • identify and alias now add the context session ID as $session_id, like capture.

    6.0.0upgrade guide

  • Applications using the listed wrapper packages should declare posthog-node in their own dependencies to control when they upgrade to 6.x.x.

    6.0.0upgrade guide

  • An event whose property value throws during reading or serialization is dropped alone and reported through the error event as a local drop, covering analytics and AI lanes.

    6.0.0release notes

posthog-node 5235 changes

Breaking changes 22

  • Failed flag evaluations are omitted from the returned flags.

    5.74.0release notes

  • Failed flag evaluations return undefined instead of exposing failed values or payloads.

    5.74.0release notes

  • For config version 2 flags, events now include the reason code and rule attribution instead of $feature_flag_reason.

    5.73.0release notes

  • A flag record with a field of the wrong JSON type now reads as disabled: getters return false and the flag has no payload.

    5.73.0release notes

  • Sends a flat request body with template_id and distinct_id at the top level.

    5.61.2release notes

  • A condition with a filter local evaluation cannot check and a filter that does not match resolves locally as no match, rather than falling back to a server request or staying unresolved.

    5.57.0release notes

  • $feature_flag_called events from snapshot reads report local_evaluation_inconclusive instead of flag_missing for these flags.

    5.57.0release notes

  • Returns a snapshot, so changing individual keys no longer affects deduplication; the cache evicts only the least recently used distinct IDs instead of clearing entirely.

    5.55.1release notes

  • Server-side feature flags now resolve in posthog-node even when a proxy rewrites the request's User-Agent; flags restricted to the client runtime resolve to undefined.

    5.52.4release notes

  • Bigint attributes on logs, metrics, and spans are now sent as int64 rather than as strings.

    5.51.5release notes

  • Local evaluation now honors evaluationContexts; flags whose evaluation contexts do not overlap the configured list resolve to undefined instead of being evaluated locally.

    5.51.4release notes

  • Events are dropped when the before-send hook throws, rather than being sent unmodified.

    5.49.2release notes

  • Replaces the internal AI capture options; when set, wrappers route through the AI endpoint and skip redaction and truncation, while privacy mode still takes precedence.

    5.49.0release notes

  • Shutdown timeouts are logged without rejecting, so callers do not receive a rejection for a timeout.

    5.48.2release notes

  • No longer suppresses Node's default crash on unhandled promise rejections; fatal rejections in strict or warn-with-error-code mode and rejections handled by another unhandledRejection listener are no longer captured.

    5.47.9release notes

  • Semver values with leading zeros are rejected in both flag and override values; invalid inputs surface as InconclusiveMatchError and do not match targeting conditions.

    5.34.10release notes

  • An inactive flag now short-circuits to false even when ensure_experience_continuity is true, instead of throwing InconclusiveMatchError and resolving to undefined.

    5.34.6release notes

  • Cohort property groups containing a flag-type property now mark cohort evaluation inconclusive, so the flag returns undefined instead of a wrong definitive answer.

    5.34.6release notes

  • is_set now returns true when a property key is present, even if its value is null or undefined.

    5.34.6release notes

  • Use evaluationContexts in posthog.init to specify evaluation contexts instead of deployment environments.

    5.23.0release notes

  • The minimum supported Node.js version is now ^20.20.0 || >=22.22.0 due to an async-hooks DoS vulnerability.

    5.22.0release notes

  • Contexts inherit by default, changing how context values are passed to child contexts.

    5.17.0release notes

Security 2

  • A send with templateKey accepts sensitive to mark an email as sensitive; sensitive emails keep content out of PostHog's logs.

    5.71.0release notes

  • The client privacyMode option now applies to AI integrations, keeping prompts out of errors, provider metadata and OTel spans in privacy mode, and redacting MCP tool credentials.

    5.57.1release notes

Deprecations 9

  • captureEngagement is deprecated in favor of tracking: { engagement: false }. It continues to work, but a send cannot set both.

    5.71.0release notes

  • The Node SDK Sentry integration is deprecated; users are directed to PostHog Error Tracking for Node.

    5.38.3release notes

  • Imports from posthog-node/experimental are deprecated.

    5.35.0release notes

  • The sendFeatureFlags option is deprecated; it continues to work but logs a deduped warning the first time it is used, and removal is planned for the next major version.

    5.33.0release notes

  • Deprecated; it continues to work but logs a deduped warning the first time it is used, and removal is planned for the next major version.

    5.33.0release notes

  • Manual capture('$exception') now emits a warning.

    5.24.17release notes

  • The posthog.init option is deprecated in favor of evaluationContexts; it continues to work and logs a deprecation warning.

    5.23.0release notes

  • A warning is emitted when local evaluation encounters flags with experience continuity enabled, explaining that they cause server requests on every evaluation.

    5.21.0release notes

  • The package is deprecated.

    5.14.0release notes

New APIs and options 78

  • Send email with cc, bcc, and attachments. The SDK uploads files PostHog does not have yet and sends the email with their hashes; emails support at most 10 files and 40 MB after Base64 encoding.

    5.72.0release notes

  • A send with templateKey accepts tracking to control opens, clicks, and engagement events. Without it, existing tracking behavior remains.

    5.71.0release notes

  • Opt a recipient out of email topics, or back in, with one call that sends the whole change in one request using the client's secretKey.

    5.70.0release notes

  • posthog.emails.send() accepts a React Email element through react and renders it with the optional @react-email/render peer dependency.

    5.69.0release notes

  • The NestJS interceptor can take the request's distinct ID from a getDistinctId option or from identity already set in the PostHog context.

    5.68.0release notes

  • Adds a metrics flush callers can request once per unit of work; concurrent calls share one queued send, and the flush waits out metrics backoff.

    5.67.0release notes

  • Adds request instrumentation for fetch-API servers, including request context, server spans, 5xx error marking, and HTTP server metrics.

    5.67.0release notes

  • Adds middleware for fetch-API servers such as Hono, Bun, Deno, and Next route handlers, with request context, server spans, error marking, and HTTP server metrics.

    5.67.0release notes

  • Adds a logs API, including posthog.logger.info(...) and posthog.captureLog(...), configured with the logs option; records attach active span trace and span ids and withContext distinctId and sessionId.

    5.65.0release notes

  • The Span handle exposes a spanId getter, allowing correlation of logs from other loggers with a trace without parsing traceparent().

    5.64.0release notesrelease notes

  • The Span handle exposes a traceId getter, allowing correlation of logs from other loggers with a trace without parsing traceparent().

    5.64.0release notesrelease notes

  • metrics.histogram() accepts a bounds option for setting bucket boundaries; beforeSend can see and change them.

    5.63.0release notes

  • Set appHost to your PostHog app URL when self-hosting PostHog or sending through a reverse proxy.

    5.62.0release notes

  • Pass your own idempotencyKey so job runner retries are safe and do not send the email twice.

    5.62.0release notes

  • Set migratedFrom on the client to tell PostHog which email provider you moved from.

    5.62.0release notes

  • Send emails with content rendered by your code by providing a templateKey, subject, and html, text, or both. Sends also support from, replyTo, and captureEngagement.

    5.62.0release notes

  • Pass a project secret API key as secretKey to the client to send emails or read statuses, depending on its Transactional email scope.

    5.62.0release notes

  • A new client option for sending transactional email from a PostHog email template.

    5.61.0release notes

  • Read what happened to a sent email using the message ID returned by send().

    5.61.0release notes

  • Send transactional email from a PostHog email template.

    5.61.0release notes

  • The Express and NestJS integrations can read session and identified-user IDs from the posthog-js cookie when requests have no tracing headers, linking backend events to browser sessions on same-site requests without frontend configuration.

    5.60.0release notes

  • isEnabled() and getFlag() accept sendFeatureFlagEvents to override the setting for one read, allowing experiment exposures to be sent from snapshot reads when sendFeatureFlagEvent is false.

    5.59.0release notes

  • Adds an optional OpenTelemetry context processor.

    5.58.0release notes

  • Adds an optional signal that ends a context's lifetime.

    5.58.0release notes

  • evaluateFlags() snapshots report flags whose local evaluation could not resolve via unresolvedFlags.

    5.57.0release notes

  • Local feature flag evaluation can use a shared definition cache without a secret or personal API key.

    5.56.2release notes

  • Feature flag evaluation reasons are exposed and preserved in OpenFeature resolution metadata.

    5.54.0release notes

  • Adds an API to read a feature flag's evaluation runtime.

    5.53.0release notes

  • Adds an API to get feature flag keys by evaluation runtime.

    5.53.0release notes

  • Adds a hook that sees every span before export and may edit or drop it.

    5.52.0release notes

  • Bounds how many attributes a single span may hold.

    5.52.0release notes

  • Bounds attribute value length for spans.

    5.52.0release notes

  • Bounds how many events a single span may hold.

    5.52.0release notes

  • Bounds how many spans a single process may hold.

    5.52.0release notes

  • Bounds how long a span may be held by a single process.

    5.52.0release notes

  • Adds experimental distributed tracing that records spans using the traces client option.

    5.52.0release notes

  • Adds a client option for recording experimental distributed tracing spans.

    5.52.0release notes

  • Exception capture methods are now exposed through the IPostHog interface.

    5.51.6release notes

  • Accepts an optional defaultValue returned when a flag has no value; present flag values still take precedence, and omitting the option preserves false-on-miss behavior.

    5.50.0release notes

  • Public beta API for sending AI events to a dedicated isolated endpoint and receiving the event UUID.

    5.49.0release notes

  • The property is added to $feature_flag_called events when the server explicitly reports has_experiment; it is omitted when the value is unknown.

    5.45.0release notes

  • Adds an alpha metrics API for recording count, gauge, and histogram metrics from backend services, with in-memory aggregation and OTLP/JSON flushing.

    5.43.0release notes

  • Exposes the error tracking rate-limiter bucket size so customers with high-cardinality exception types can tune the per-type allowance.

    5.42.0release notes

  • Exposes the error tracking rate-limiter refill rate so customers with high-cardinality exception types can tune the per-type allowance.

    5.42.0release notes

  • Dropped and undelivered Capture V1 events are surfaced on the client error channel as CaptureV1Error.

    5.41.0release notes

  • Set POSTHOG_CAPTURE_MODE=v1 to send analytics events to Capture V1 instead of the legacy /batch/ endpoint. Capture V1 uses Bearer auth and per-event partial retries; the default remains v0.

    5.41.0release notes

  • Adds secretKey as the canonical alias for personalApiKey; it accepts a Personal API Key or Project Secret API Key.

    5.40.0release notes

  • Adds groupIdentifyImmediate() to await the network request when identifying a group, useful in edge/serverless environments where the background queue may not flush.

    5.39.0release notes

  • Adds a helper to manage person properties from the Node.js SDK.

    5.38.0release notes

  • Local evaluation now supports the early_exit condition option, stopping with false when matching property filters are excluded by the rollout percentage instead of falling through to later groups.

    5.37.0release notes

  • Adds configurable isServer behavior, defaulting to true, to set the $is_server event property; set it to false for client or CLI use so the device OS is attributed normally.

    5.36.0release notes

  • Exposes UUID and cookie helpers from posthog-node so users can manage distinct_id outside the browser SDK.

    5.34.0release notes

  • Accepts a flags snapshot so the same flag evaluations used for branching can enrich a captured event.

    5.33.0release notes

  • Accepts a flags argument so $exception events carry the same flag context as the rest of the request's events.

    5.33.0release notes

  • Evaluates feature flags in one /flags request and returns a FeatureFlagEvaluations snapshot with methods for branching and filtering flags attached to captured events.

    5.33.0release notes

  • Pass flagKeys to scope the underlying /flags request to selected flags.

    5.33.0release notes

  • Adds Express and NestJS request context support for PostHog tracing headers.

    5.31.0release notes

  • Adds a NestJS integration with an interceptor for context propagation.

    5.28.0release notes

  • Local feature flag evaluation now supports semver_caret for semantic version comparisons.

    5.27.1release notes

  • Local feature flag evaluation now supports semver_eq for semantic version comparisons.

    5.27.1release notes

  • Local feature flag evaluation now supports semver_gt for semantic version comparisons.

    5.27.1release notes

  • Local feature flag evaluation now supports semver_gte for semantic version comparisons.

    5.27.1release notes

  • Local feature flag evaluation now supports semver_lt for semantic version comparisons.

    5.27.1release notes

  • Local feature flag evaluation now supports semver_lte for semantic version comparisons.

    5.27.1release notes

  • Local feature flag evaluation now supports semver_neq for semantic version comparisons.

    5.27.1release notes

  • Local feature flag evaluation now supports semver_tilde for semantic version comparisons.

    5.27.1release notes

  • Local feature flag evaluation now supports semver_wildcard for semantic version comparisons.

    5.27.1release notes

  • Accepts a waitUntil method for serverless environments.

    5.27.0release notes

  • Adds enterContext() to attach a context to the current async execution context.

    5.26.0release notes

  • Adds an /edge subpath export for use with non-standard edge runtimes.

    5.24.13release notes

  • Adds a method to retrieve a feature flag value and payload in a single API call.

    5.21.2release notes

  • Set strictLocalEvaluation: true at client init to prevent server fallback for flag evaluations; flags that cannot be evaluated locally return undefined.

    5.21.0release notes

  • Adds the overrideFeatureFlags() method for local testing and development.

    5.19.0release notes

  • Adds $feature_flag_error to $feature_flag_called events to track flag evaluation failures.

    5.18.0release notesrelease notes

  • Context support was added.

    5.15.0release notes

  • Adds a client configuration option for the flag definition cache provider.

    5.12.0release notes

  • Adds the FlagDefinitionCacheProvider interface for providing a flag definition cache.

    5.12.0release notes

  • Enables tracking bot traffic as $bot_pageview events when enabled.

    5.11.0release notes

Performance 4

  • Client-only flag warnings and unnecessary server fallback are skipped during bulk evaluation.

    5.61.3release notes

  • Node SDK payloads use Node's zlib gzip implementation to avoid sustained memory growth from frequent Web Streams compression.

    5.48.1release notes

  • Local evaluation polling sends the latest etag in an If-None-Match header to reduce bandwidth when no flags have changed.

    5.17.2release notes

  • Cache initialization performance was improved.

    5.15.0release notes

Behavior and default changes 44

  • Config version 2 experiment splits now send $experiment_exposure events.

    5.73.0release notes

  • Requests now use /flags/?v=4 and read typed flag records; well-formed responses preserve existing getter and event values.

    5.73.0release notes

  • With POSTHOG_CAPTURE_MODE=v1, capture retries 404 and 429 responses like 408 and 5xx instead of failing the batch immediately.

    5.68.2release notes

  • Convex functions in the default runtime can now import posthog-node without requiring the "use node" directive.

    5.66.0release notes

  • The configured serviceName from traces or metrics is stamped on events as service_name.

    5.65.0release notes

  • The experimental duration histogram uses new bucket boundaries, allowing its p50 and p95 to resolve between 50ms and 5s.

    5.63.0release notes

  • The SDK retries requests that hit a network error, rate limit, or outage twice by default.

    5.62.0release notes

  • A failed email call returns an EmailError containing PostHog's code and the HTTP statusCode.

    5.62.0release notes

  • The load-time warning also logs when strictLocalEvaluation is true.

    5.57.0release notes

  • Captured exceptions are linked to active OpenTelemetry traces when the API is available.

    5.56.1release notes

  • Metrics recorded inside sampled spans now have trace exemplars attached.

    5.56.0release notes

  • Setting featureFlagsPollingInterval to null disables automatic local flag polling while retaining initialization and manual refresh.

    5.55.0release notes

  • Feature flag cache payloads now support snake_case while preserving compatibility with camelCase providers and cached data.

    5.54.1release notes

  • Error capture now includes causes and AggregateError members with relationship metadata and individual stacks, limited to 50 entries and 1,000 member inspections.

    5.52.3release notes

  • Batches over 10 MiB or too large to serialize are stopped before making a request.

    5.52.0release notes

  • Logs and metrics retries honor Retry-After, extend waits up to five minutes, add jitter, and metrics back off exponentially across consecutive failures.

    5.52.0release notes

  • A false value means a conclusive off evaluation, while undefined means no evaluation is available. Remote evaluation omits globally inactive flags; backend local evaluation can resolve cached inactive definitions to false.

    5.51.7release notes

  • When a requested flag is missing from loaded local definitions, scoped calls now fall back to remote evaluation instead of omitting the flag without making a request.

    5.51.0release notes

  • Feature flag local evaluation now supports ends_with property filters, with case-insensitive matching, so matching flags no longer fall back to remote evaluation.

    5.48.0release notes

  • Feature flag local evaluation now supports not_ends_with property filters, with case-insensitive matching, so matching flags no longer fall back to remote evaluation.

    5.48.0release notes

  • Feature flag local evaluation now supports not_starts_with property filters, with case-insensitive matching, so matching flags no longer fall back to remote evaluation.

    5.48.0release notes

  • Feature flag local evaluation now supports starts_with property filters, with case-insensitive matching, so matching flags no longer fall back to remote evaluation.

    5.48.0release notes

  • Local feature flag polls are scheduled after each request settles.

    5.47.8release notes

  • Feature flag methods now accept numeric and boolean group property values through the shared Properties type, matching local evaluation.

    5.47.5release notes

  • Feature flag methods now accept numeric and boolean person property values through the shared Properties type, matching local evaluation.

    5.47.5release notes

  • Exception events include the injected release id as $release_id when one can be read, allowing PostHog to attach exceptions to a release without joining through symbol sets.

    5.47.0release notes

  • When the server enables minimal events, evaluations of flags not linked to experiments emit events rebuilt from an allowlist; missing signals and experiment-linked flags retain the full event.

    5.46.0release notes

  • The default maxQueueSize increases from 1000 to 10000 to reduce silent event drops during bursty workloads; an explicit option still overrides the default.

    5.44.0release notes

  • Pending metrics are flushed when shutdown() is called.

    5.43.0release notes

  • In v1 mode, $ai_* events continue to use the legacy submitter and an isolated in-memory queue, flushed independently so the transports do not share batches.

    5.41.0release notes

  • before_send is now called for identify, group identify, and alias events.

    5.39.1release notes

  • Feature flag requests are retried only after transient network errors. The retry count defaults to 1 and can be set to 0 to disable retries.

    5.38.7release notes

  • Batch payloads no longer send the top-level type, library, and library_version fields. SDK metadata uses properties.$lib and properties.$lib_version, falling back to legacy queued values when those properties are missing.

    5.38.1release notes

  • Feature flag definition cache provider types are now available from the main posthog-node export.

    5.35.0release notes

  • Local evaluation now supports mixed targeting.

    5.32.0release notes

  • Frames are sent with relative file paths.

    5.30.0release notes

  • Sends $device_id as a top-level field in /flags requests, enabling device-based bucketing during remote evaluation.

    5.29.2release notes

  • The config query parameter is omitted by default so requests retrieve only the necessary data.

    5.28.2release notes

  • Locally evaluated flags now include timing information in $feature_flag_called events, helping debug cache TTL and timing issues.

    5.26.1release notes

  • A context-sensitive override no longer requires distinctId as a parameter and instead reads it from the current context.

    5.26.0release notes

  • Traces now track the exception_id, helping correlate traces with exceptions.

    5.20.0release notes

  • Exceptions now track the LLM trace_id, helping correlate exceptions with traces.

    5.20.0release notes

  • Adds $feature_flag_evaluated_at properties to $feature_flag_called events.

    5.16.0release notes

  • The Express error handler now forwards session and distinct id.

    5.14.1release notes

Fixes and other changes 76

  • shutdown() now also sends logs captured while its logs flush was in flight, instead of dropping them.

    5.73.1release notes

  • Fixes matching for empty OR conditions and legacy cohort groups.

    5.68.1release notes

  • Falls back to the server for unsupported group types.

    5.68.1release notes

  • Fixes nested cohort not_in conditions in local feature flag evaluation.

    5.67.2release notes

  • Relative date filters no longer roll past the end of a shorter month; for example, 1m on March 31 resolves to February 28, matching the flags service.

    5.67.1release notes

  • A response whose flags field is not an object is treated as a failed request instead of throwing a TypeError, and is reported to error event listeners.

    5.63.2release notes

  • Node stack frames for functions named async are parsed when the filename has no leading parenthesis.

    5.63.1release notes

  • Unhandled promise rejections are captured even when the app or framework has an unhandledRejection listener, with deduplication across clients and within an event-loop turn. Capture timing, flush and shutdown behavior, and control-flow error handling are also adjusted.

    5.61.1release notes

  • Later conditions can resolve a flag locally when an unexpected error follows a filter that local evaluation cannot check, instead of failing the whole flag.

    5.60.1release notes

  • When a flag depends on one that only the server can evaluate, evaluation falls back to the server and unresolvedFlags reports the flag as unresolved_dependency.

    5.60.1release notes

  • Reads from an evaluateFlags() snapshot now honor sendFeatureFlagEvent: false, so snapshot reads no longer send feature flag events when that setting is disabled.

    5.59.0release notes

  • esbuild no longer fails to bundle posthog-node when the optional peer is not installed.

    5.57.2release notes

  • Falls back instead of returning inconsistent local regex flag results for Unicode and advanced patterns.

    5.57.1release notes

  • Falls back from local flag evaluation when a required property value is undefined.

    5.56.4release notes

  • Local flag evaluation now matches null properties with string operators, so negated operators such as not_icontains match instead of failing.

    5.56.3release notes

  • Types now accept non-null events while still allowing null returns to drop events.

    5.55.3release notes

  • Local feature flag evaluation now honors filters.holdout before release conditions, assigning held-out users the holdout variant and matching server evaluation.

    5.52.6release notes

  • Spans that run past the age limit and then end are exported; maxSpanAgeMs now evicts spans only once maxLiveSpans is reached, preventing their children from being orphaned.

    5.52.5release notes

  • Local feature flag evaluation respects the definitions response version: version 2 uses explicit boolean/string equality and per-member array matching, while missing or other versions retain service legacy matching.

    5.52.5release notes

  • Express exception events now report the final HTTP status instead of the initial response status.

    5.52.2release notes

  • Child spans now share their parent's clock, preventing them from appearing to start before or end after their parent, including when the system clock changes mid-trace.

    5.52.1release notes

  • A throwing getter no longer breaks every metrics export; its key is recorded as [Unserializable] instead.

    5.52.0release notes

  • Logs and metrics always send service.name and telemetry.sdk.* even when a resourceAttributes value is too large to encode in full.

    5.52.0release notes

  • Parsed stack traces now collapse repeated frame cycles to reduce grouping differences caused by recursion depth while preserving distinct throw locations.

    5.51.8release notes

  • Local feature flag evaluation now matches the flags service for string operators, exact-value coercion, and JSON stringification.

    5.51.5release notes

  • Narrows the bot-detection blocklist entry to pinterestbot so users of Pinterest's in-app browser are no longer misclassified as bots and excluded from analytics.

    5.51.4release notes

  • Omitted local evaluation properties are treated as inconclusive for is_not_set.

    5.51.3release notes

  • Empty feature flag evaluation key scopes are handled without running local or remote evaluation.

    5.51.2release notes

  • The Node SDK sends raw gzip bytes instead of wrapping them in a Blob, avoiding a native BlobReader leak on Node 24.16 and later. Compression behavior, headers, and wire format are unchanged.

    5.51.1release notes

  • Fixes remotely evaluated results to return an undefined variant instead of null.

    5.49.4release notes

  • Logs and metrics are no longer silently dropped for attributes containing certain unsupported or unusually large values; attributes are capped and excess content is marked as [Truncated].

    5.49.3release notes

  • OtlpAnyValue.intValue is typed as string | number, so code reading the field must handle both types.

    5.49.3release notes

  • Capture timestamp overrides are normalized to equivalent UTC ISO strings in the browser and Node.js SDKs and shared core.

    5.49.1release notes

  • The Node.js shutdown() return type is corrected to Promise<void>.

    5.48.2release notes

  • Configured request timeouts are now enforced while consuming Capture V1 response bodies.

    5.48.1release notes

  • Request timeouts remain active while the response body is consumed.

    5.47.11release notes

  • Minimal events retain $referring_domain and canonical utm_*/campaign parameters, preventing a flag-called event from setting session attribution and channel type to NULL.

    5.47.10release notes

  • Bounds stack source context reads and skips non-regular or oversized files.

    5.47.7release notes

  • Completed lifecycle timeout handles are cleared so successful shutdowns do not leave timers running.

    5.47.6release notes

  • Events added to a full queue are preserved while an earlier batch is being flushed.

    5.47.4release notes

  • The timeout remains active until the request settles, including while the response body is consumed.

    5.47.3release notes

  • When the supplied ID matches the persisted distinct ID, identify() now marks the user identified and captures a person-processed $set event.

    5.47.2release notes

  • NestJS request context is isolated per Observable subscription.

    5.47.1release notes

  • Normalizes V8 Promise combinator stack frames so input indexes are not treated as source filenames.

    5.46.1release notes

  • Avoids Edge runtime warnings related to native compression and fatal error handling.

    5.45.2release notes

  • The default Node.js event flush interval is fixed at 5 seconds.

    5.45.1release notes

  • Stops duplicating distinct_id inside /flags person properties.

    5.39.4release notes

  • Requests to /flags that receive HTTP 502 or 504 responses are retried across SDKs using the shared core flags client.

    5.39.3release notes

  • Node flush() waits for pending asynchronous SDK work before draining the event queue, so helper-produced events are not missed; pending work rejections no longer prevent queued events from flushing.

    5.39.2release notes

  • Event batches with circular property references are safely serialized instead of crashing during flush.

    5.39.1release notes

  • Local evaluation now applies the in/not_in operator to cohort membership, fixing inverted cohort-exclusion flags.

    5.38.8release notes

  • Only stamp $groups from the top-level groups when present.

    5.38.6release notes

  • Feature flag called events are deduplicated per returned flag value.

    5.38.5release notes

  • Respect disable_capture_url_hashes when capturing Express and NestJS request URLs.

    5.38.4release notes

  • Custom event UUID overrides are validated, and a new UUID is generated when an override is invalid.

    5.38.2release notes

  • Initialization paths with missing or blank PostHog project tokens now disable or no-op instead of throwing or sending requests.

    5.35.9release notes

  • captureException was unified in posthog core.

    5.35.6release notes

  • The deduplication key now includes group context, so events fire independently per group combination.

    5.35.2release notes

  • identifyImmediate now awaits the underlying network request, preventing the $identify event from being dropped when short-lived runtimes exit after await.

    5.34.8release notes

  • Local gt/gte/lt/lte evaluation now compares numerically when both sides parse as finite numbers, avoiding incorrect lexicographic comparisons.

    5.34.6release notes

  • Local evaluation resolves is_not_set as true when the property key is absent and false when present, rather than throwing InconclusiveMatchError.

    5.34.6release notes

  • Flag-level condition properties with negation: true are now inverted, matching the existing cohort-path behavior.

    5.34.6release notes

  • The fetch response body is consumed to prevent Cloudflare Workers runtime warnings.

    5.33.2release notes

  • Local evaluation polling now uses /flags/definitions instead of /api/feature_flag/local_evaluation.

    5.29.4release notes

  • Surrounding whitespace is trimmed from user-provided API keys, personal API keys, and host config values before they are used.

    5.29.3release notes

  • Local flag evaluation cache now preserves $set_once semantics.

    5.29.0release notes

  • captureException now uses distinctId from request context.

    5.28.6release notes

  • Fixed the return value of captureExceptionImmediate.

    5.28.3release notes

  • Client shutdown now awaits the feature flags poller stopping.

    5.28.2release notes

  • Super properties added with register now work.

    5.25.0release notes

  • In Node, before_send now infers its type as EventMessage or null instead of any.

    5.24.5release notes

  • getFeatureFlag() respects exponential backoff for HTTP 401, 403, and 429 responses.

    5.18.1release notes

  • Fixes the frame platform property for $exception events.

    5.13.0release notes

  • fetch is called without a bound context, preventing issues in edge runtimes such as Cloudflare.

    5.13.0release notes

  • Fixes a crash when calling getFeatureFlagPayloads for a flag that depends on a static cohort.

    5.10.2release notes

  • Fixes server fallback when a static cohort condition is followed by a matching condition.

    5.10.1release notes