Data Collection

Configuration for what data SDKs collect by default, including technical context, PII, and sensitive data.

Statuscandidate
Version0.16.0(changelog)

This spec defines how SDKs control what data is collected automatically from the runtime (device, requests, responses, user context). It replaces the single sendDefaultPii (or platform-equivalent) flag with a structured dataCollection configuration so users can enable or restrict collection by category and by field.

Previously, sendDefaultPii acted as a broad binary toggle that controlled a wide range of data types without offering granular control. The new dataCollection configuration collects rich context for debugging by default — including user identity and HTTP bodies — while giving users granular control to opt out of any category or field.

Related specs:

  • Data Scrubbing — structuring data for scrubbing (spans, breadcrumbs), variable size limits
  • Client — client lifecycle and event pipeline
  • Configuration — top-level init options including send_default_pii (deprecated in favor of this spec)

Candidatespecified since 0.1.0

Collected data is grouped into three sensitivity levels. These levels form the organizing principle for dataCollection defaults and user configuration.

Non-identifying context used for debugging and performance. Examples include, but are not limited to:

  • Device and environment context (OS, runtime, non-PII identifiers)
  • Performance and error context (stack frames, breadcrumbs, span metadata)
  • Framework/routing context where it does not contain PII or secrets
  • Generative AI metadata (model name, token counts, tool names, etc.)
  • Generative AI inputs and outputs (system instructions, prompt content, tool definitions, completion content)
  • MCP request and response content (tool call arguments, tool results, prompt arguments and messages)

For the full list of supported context types (device, OS, runtime, app, browser, GPU, culture, cloud resource, memory info, and more), see the Contexts Interface.

Personally Identifiable Information (PII) or user-linked data. Examples include, but are not limited to:

  • Identity (name, email, user ID, username)
  • Contact (email, phone number, address)
  • IP address
  • Cookies and headers that identify the user or session
  • File and directory paths that identify a user, tenant, or document
  • HTTP request data or database query parameters (TBD)
  • Arguments passed to tasks within a queue

For context types that may carry PII fields (e.g. device_unique_identifier in Device Context, or fields in the User Interface), see the linked specs.

Credentials and secrets that must never be sent by default. Examples include, but are not limited to:

  • Passwords, tokens, API keys, bearer tokens
  • Header or cookie values matching known sensitive names (auth, token, secret, password, key, jwt, etc.)

For the canonical list of terms used to detect sensitive values at collection time, see the Sensitive Denylist in this spec.


Candidatespecified since 0.1.0

All data-collection options reside under a single top-level key: dataCollection. Each option has a fixed default and is independent of all other options. Users MAY supply only the options they want to override; the SDK MUST apply the documented defaults for any omitted fields.

SDKs MUST support at least the userInfo option, key-value collection modes, HTTP header collection, body type collection, and Boolean option types defined in Option Types. SDKs MAY omit body types that do not apply to their platform (e.g., a client-only SDK MAY omit "incomingRequest" and "outgoingResponse" from the httpBodies array).

Candidatespecified since 0.2.0

The three sensitivity levels determine whether data is collected by default:

  • Technical Context Data: SDKs SHOULD collect this data automatically. This level is not gated by any dataCollection option.
  • PII Data: SDKs SHOULD automatically populate user identity fields (user.*) by default. Users can set the userInfo option to false to opt out. See dataCollection Options.
  • Sensitive Data: SDKs MUST never send sensitive values through automatic instrumentation. Values for keys matching the denylist MUST be replaced with "[Filtered]"; key names are always retained. Users can use beforeSend (or equivalent) to remove or redact keys if needed. See Sensitive Denylist.

SDK documentation MUST document the default value and behavior of each dataCollection option.

Candidatespecified since 0.12.0

Setup instructions MUST present dataCollection as its own set-up step (similar to source maps or tunneling). Initialization snippets SHOULD NOT carry a commented-out dataCollection override, because commented-out code is easy to overlook and makes the snippet harder to read.

The step MUST be included in every surface that tells users how to set up the SDK, for example setup documentation, onboarding flows, and setup tools such as CLI wizards. The surfaces might differ per platform.

The step MUST:

  • state that the SDK collects all data, including user identity data by default
  • show an example snippet that disables an option. For example, userInfo.
  • link to the full dataCollection documentation of the applicable platform or guide
Copied
init({
  dsn: "...",
  dataCollection: { userInfo: false },
})
Candidatespecified since 0.1.0

For key-value data (HTTP headers, cookies, URL query params), key names are always included in the event. SDKs MUST apply a sensitive denylist to decide which values are sent in plaintext and which the SDK replaces with "[Filtered]". The denylist matches on key name. The SDK never removes or redacts keys themselves.

SDKs MUST perform a partial, case-insensitive match when comparing key names against the denylist. A key is treated as sensitive if any denylist term appears as a substring in the key name (e.g., the term auth matches Authorization and X-Auth-Token).

The following terms MUST be included in the sensitive denylist and applied to headers, cookie names, and query param keys. For cookies and URL query params that arrive as an unparsed string, see Cookies and URL Query Params.

["auth", "token", "secret", "password", "passwd", "pwd", "key", "jwt", "bearer", "sso", "saml", "csrf", "xsrf", "credentials", "session", "sid", "identity"]

Values for keys that match MUST be replaced with "[Filtered]".

The sensitive denylist covers credentials and secrets. Some headers additionally carry user-identifying information (IP address, user ID, origin host) without being credentials. If an application is subject to GDPR or similar privacy regulations, users can add these terms via a deny list for cookies, httpHeaders, and urlQueryParams.

The list of case-insensitive, partial-match terms SHOULD be documented in the user documentation of the respective SDK:

["forwarded", "-ip", "remote-", "via", "-user"]

Examples of headers matched by these terms: x-forwarded-for, x-real-ip, cf-connecting-ip, remote-addr, x-user-id.

Copied
init({
  dataCollection: {
    httpHeaders: {
      request: { mode: "denyList", terms: ["forwarded", "-ip", "remote-", "via", "-user"] },
      response: { mode: "denyList", terms: ["forwarded", "-ip", "remote-", "via", "-user"] },
    },
    cookies: { mode: "denyList", terms: ["forwarded", "-ip", "remote-", "via", "-user"] },
    urlQueryParams: { mode: "denyList", terms: ["forwarded", "-ip", "remote-", "via", "-user"] },
  },
})

URL strings in span descriptions follow the format defined in Structuring Data: METHOD scheme://host/path — query strings and fragments are excluded.

The urlQueryParams option controls query parameter filtering wherever query strings appear — including url.full, url.query, and request.query_string. url.path and the span description are unaffected since they never contain query strings. For general data scrubbing rules (variable size limits, structuring for server-side scrubbing), see Data Scrubbing.

Encoded query parameters MUST be stored exactly as they appear in the URL.

Example: Given a request to https://example.com/api/users?token=abc123&q=a%20b%26c&page=5:

AttributeurlQueryParams enabledurlQueryParams off
Span descriptionGET https://example.com/api/userssame
url.fullhttps://example.com/api/users?token=[Filtered]&q=a%20b%26c&page=5https://example.com/api/users
url.path/api/userssame
url.querytoken=[Filtered]&q=a%20b%26c&page=5not collected
request.query_stringtoken=[Filtered]&q=a%20b%26c&page=5not collected

Cookies and URL query params may arrive as a single unparsed string (e.g., Cookie: user_session=abc; theme=dark-mode) rather than pre-split key-value pairs. SDKs MAY handle both cases:

When the string can be parsed into individual key-value pairs, apply the denylist per-key.

For cookies: the rules and terms as specified in cookies in the dataCollection configuration apply to cookie names. The SDK replaces values for sensitive keys with "[Filtered]" while keeping non-sensitive values as-is. This selective filtering retains harmless contextual information for debugging while protecting sensitive fields.

When SDKs parse a cookie header, the following rules apply:

  • Split the Cookie header on ";". The space after the semicolon is not guaranteed. Splitting on "; " could leak the previous cookie's value.
  • A segment without "=" is a nameless cookie: the bare token is its value, not its name (RFC 6265bis). The SDK MUST replace the element with "[Filtered]".
  • Set-Cookie attributes such as Max-Age, Path, or HttpOnly are metadata, not cookies, and MUST NOT appear as cookie pairs.

For example, Cookie: user_session=abc; theme=dark-mode;opaque-token and Set-Cookie: theme=light-mode; HttpOnly become (based on http.request.header.<key>):

Copied
http.request.header.cookie: ["user_session=[Filtered]", "theme=dark-mode", "[Filtered]"]
http.request.header.set-cookie: ["theme=light-mode"]
  • user_session=[Filtered] matches "session" in the sensitive denylist
  • theme=dark-mode not sensitive, value sent as-is
  • [Filtered] nameless cookie, where the bare token is a value and is always filtered

For URL query parameters: the rules and terms as specified in urlQueryParams in the dataCollection configuration apply to query parameters. The SDK replaces values for sensitive keys with "[Filtered]" while keeping non-sensitive values as-is (see URLs).

When individual key-value pairs cannot be extracted (e.g., malformed or opaque cookie string), the entire Cookie or Set-Cookie header value MUST be replaced with "[Filtered]". This value is used as a fallback:

Copied
http.request.header.cookie: ["[Filtered]"]   // fallback: cookie header could not be parsed

Unfiltered, raw cookie header values MUST NOT be sent. When in doubt, treat the entire cookie header as sensitive and use the fallback.

When bodies are collected via the httpBodies option (enabled by default; see Body Type Collection):

  • Parseable as JSON or form data: SDKs MAY extract key-value pairs and apply the same denylist rules to keys. Values for matching keys MUST be replaced with "[Filtered]". This allows selective scrubbing while retaining non-sensitive fields.
  • Not parseable (raw bodies): The body MUST NOT be attached to the event. When the SDK cannot parse the body into a key-value structure, the entire body MUST be replaced with "[Filtered]".

No built-in option scrubs keys; users who need to hide header or cookie names MUST use beforeSend (or equivalent).

Candidatespecified since 0.1.0

The global dataCollection object is the single source of truth for data collection. SDKs SHOULD NOT require users to configure data collection in multiple places.

However, some integrations collect data that warrants independent control. For example, a Replay integration that captures network requests, or when every AI integration should capture generative AI inputs and outputs case-by-case. These integrations MAY expose their own options for controlling which data they collect. Integrations are not required to use the same option names or structure as the global dataCollection object. They SHOULD use whatever is most natural for their API surface.

When an integration exposes data-collection options, the values set on the integration MUST take precedence over the corresponding global dataCollection values for the data that integration collects.

Session Replay is not gated by dataCollection (or its predecessor sendDefaultPii). It is a privacy-sensitive feature with its own opt-in privacy model — by default it masks all text, images, and user input — which is the opposite of the dataCollection opt-out model. Wiring the two together would flip privacy-sensitive defaults for the majority of existing Replay users and create confusion about which layer controls masking.

Because of this, SDKs MUST NOT change what Session Replay captures based on dataCollection. Replay's masking and network-capture behavior MUST continue to be controlled exclusively by the Replay integration's own privacy options. SDK documentation SHOULD explicitly state that dataCollection does not affect Session Replay so users are not surprised by the exception.

Candidatespecified since 0.1.0

Data explicitly set by the user on the scope (user, request, response, tags, contexts, etc.) or on a span, log, or other telemetry is not gated by dataCollection. It MUST always be attached to outgoing telemetry. This also applies to data provided via beforeSend or event processors.

SDKs SHOULD only replace sensitive values with "[Filtered]" when the data is gathered automatically through instrumentation. If the user explicitly provides data (e.g., by setting a request object on the scope), the SDK MUST NOT modify it; the user is responsible for the data they attach.

Users can register callbacks (e.g., beforeSend, event processors) to remove or redact any data (including keys) before events are sent. This spec does not replace those hooks; they remain the primary mechanism for custom filtering and key removal.

dataCollection (and its predecessor sendDefaultPii) guards writing data to the scope through auto-instrumentation. It does not guard reading data from the scope when attaching it to outgoing telemetry (events, logs, metrics, etc.).

Concretely:

  • Auto-instrumentation writes to scope — When SDK instrumentation automatically populates scope data (e.g., inferring user.ip_address from an HTTP request), the write MUST be gated by the relevant dataCollection option (e.g., userInfo). If the option is disabled, the SDK MUST NOT write that data to the scope.
  • Reading from scope to attach to telemetry — When the SDK reads data already present on the scope to attach it as attributes on logs, metrics, or other telemetry, it MUST NOT re-apply dataCollection gating. The data was already accepted at write time.
  • User-set data — Data the user explicitly sets (e.g., via Sentry.setUser(), scope.setTag(), or direct attribute assignment) is never gated by dataCollection. The user has made a deliberate choice to include that data.

This means if a user calls Sentry.setUser({ email: "jane@example.com" }), that email MUST appear on logs, metrics, and events regardless of dataCollection.userInfo or sendDefaultPii. The gate only applies to auto-instrumentation that would populate user fields without the user's explicit action.


Candidatespecified since 0.2.0

Boolean Options — used where data cannot be meaningfully filtered at the key level. The SDK either collects the entire category or skips it.

ValueBehavior
trueCollect and attach this data category.
falseDo not collect this data category.

For key-value data (cookies, headers, URL query params), key names are always included in the event. SDKs MUST support the following collection modes to control which values are sent in plaintext vs. replaced with "[Filtered]":

ModeBehavior
OffDo not collect this category at all — no keys or values are attached.
DenyList (default)Collect all key names and values. Replace values for keys matching the built-in sensitive denylist with "[Filtered]". When additional terms are provided, they extend the built-in denylist.
AllowListCollect all key names. Only keys in the provided terms list send their real value; all others are replaced with "[Filtered]". Sensitive denylist scrubbing still applies — keys matching a sensitive pattern are always scrubbed even if they appear in the allow list.

DenyList and AllowList modes are mutually exclusive. The type SHOULD make it impossible to set both simultaneously.

Reference type:

Copied
struct KeyValueCollectionBehavior {
    mode: "off" | "denyList" | "allowList"  // default: "denyList"
    terms?: string[]  // deny or allow terms depending on mode; omit when mode is "off" or when
                      // using denyList mode with only the built-in denylist
}
ExampleEquivalent behavior
{ mode: "denyList" } or omittedCollect all. Built-in denylist scrubs sensitive values.
{ mode: "off" }Do not collect — no keys or values attached.
{ mode: "denyList", terms: ["x-custom"] }Collect all. Built-in denylist + "x-custom" scrub values.
{ mode: "allowList", terms: ["x-request-id"] }Only x-request-id sends its real value; all others filtered.
Language-specific type examples for key-value collection

TypeScript

Copied
// TS SDKs MAY also accept this shorthand union type:
type CollectBehavior = boolean | { allow: string[] } | { deny: string[] };
// true         → { mode: "denyList" }
// false        → { mode: "off" }
// { deny: [] } → { mode: "denyList", terms: [] }
// { allow: [] }→ { mode: "allowList", terms: [] }

Go

Copied
type CollectionMode string

const (
    CollectionOff       CollectionMode = "off"
    CollectionDenyList  CollectionMode = "denyList"
    CollectionAllowList CollectionMode = "allowList"
)

type KeyValueCollectionBehavior struct {
    Mode  CollectionMode
    Terms []string // nil = no extra terms
}

Python

Copied
@dataclass
class KeyValueCollectionBehavior:
    mode: Literal["off", "denyList", "allowList"] = "denyList"
    terms: list[str] = field(default_factory=list)

Java

Copied
public class KeyValueCollectionBehavior {
    public enum Mode { OFF, DENY_LIST, ALLOW_LIST }

    private final Mode mode;
    private final List<String> terms;

    public static KeyValueCollectionBehavior off() { ... }
    public static KeyValueCollectionBehavior denyList(String... extraTerms) { ... }
    public static KeyValueCollectionBehavior allowList(String... terms) { ... }
}

PHP

Copied
class KeyValueCollectionBehavior {
    public function __construct(
        public string $mode = 'denyList', // 'off', 'denyList', 'allowList'
        public array $terms = [],
    ) {}
}

File and directory paths can contain user names, tenant identifiers, document names, and other PII. SDKs that automatically instrument file-system operations MUST gate any collected path arguments with filePaths.

When filePaths is false, SDKs MUST NOT attach full paths, file names or base names obtained from file-system operation arguments. SDKs MAY retain non-identifying metadata such as the operation name, file extension, byte count, or whether the target is a file or directory.

This option does not apply to:

  • Source-code locations in stack frames, profile frames, or debug images
  • Attachment names or paths explicitly supplied by the user
  • SDK-internal paths used only for local storage and never attached to telemetry

Examples:

  • /home/usr1/file.txt may become [Filtered].txt
  • some-file.md may become [Filtered].md

SDKs MUST allow users to configure request and response header collection independently. Each direction supports the same key-value collection modes described above.

Reference type:

Copied
httpHeaders: {
    request?: KeyValueCollectionBehavior   // default: { mode: "denyList" }
    response?: KeyValueCollectionBehavior  // default: { mode: "denyList" }
}

SDKs MAY additionally accept a single KeyValueCollectionBehavior for httpHeaders (applying to both directions) as a language-specific shorthand.

Language-specific type examples for HTTP header collection

TypeScript

Copied
// With type union shorthand (type `CollectBehavior` also used for key-value filtering):
type CollectBehavior = boolean | { allow: string[] } | { deny: string[] };

type HeaderConfig = {
  request?: CollectBehavior;
  response?: CollectBehavior;
};

type HttpHeadersOption = CollectBehavior | HeaderConfig;

Go

Copied
type HeaderConfig struct {
  Request  *KeyValueCollectionBehavior
  Response *KeyValueCollectionBehavior
}

Python

Copied
@dataclass
class HeaderConfig:
  request: KeyValueCollectionBehavior | None = None
  response: KeyValueCollectionBehavior | None = None

SDKs MUST support configuring body collection for specific body types. The option accepts an array of body type strings. An omitted array defaults to all body types valid for the platform; an empty array ([]) collects no bodies and is the explicit opt-out.

Valid body type values: "incomingRequest", "outgoingRequest", "incomingResponse", "outgoingResponse".

Body collection MAY not support allow/deny filtering. Unlike cookies or headers, body content has no predictable key structure for the SDK to filter at collection time. The entire body is either collected (and scrubbed based on the key if parseable as JSON or form data) or not. Body data can still be redacted in beforeSend or event processors if needed.

Language-specific type examples for body collection

TypeScript

Copied
type BodyType =
  | "incomingRequest"
  | "outgoingRequest"
  | "incomingResponse"
  | "outgoingResponse";

// SDKs MAY also accept boolean shorthand:
// true  → all body types
// false → [] (off)
type BodyCollectionOption = boolean | BodyType[];

Go

Copied
type BodyType string

const (
    BodyIncomingRequest  BodyType = "incomingRequest"
    BodyOutgoingRequest  BodyType = "outgoingRequest"
    BodyIncomingResponse BodyType = "incomingResponse"
    BodyOutgoingResponse BodyType = "outgoingResponse"
)

// HttpBodies: []BodyType — nil = all valid types (default); empty slice = off

Python

Copied
# http_bodies: list[str] | None — None = all valid types (default); [] = off; e.g., ["incomingRequest"]

Java

Copied
public enum BodyType {
    INCOMING_REQUEST("incomingRequest"),
    OUTGOING_REQUEST("outgoingRequest"),
    INCOMING_RESPONSE("incomingResponse"),
    OUTGOING_RESPONSE("outgoingResponse");
}
// httpBodies: List<BodyType> — null = all valid types (default); empty = off

PHP

Copied
// httpBodies: ?string[] — null = all valid types (default); [] = off; e.g., ['incomingRequest']

The stackFrameVariables option accepts a Boolean by default (true collects all local variables, false collects none). SDKs MUST also accept a KeyValueCollectionBehavior to filter which variables are sent by name. Filtering follows the same collection modes as Key-Value Collection Behavior, matching against variable names.

Candidatespecified since 0.2.0

Pass the dataCollection option to the SDK's init function. All fields are optional and omitted fields MUST use the documented default.

Copied
struct KeyValueCollectionBehavior {
    mode: "off" | "denyList" | "allowList"  // default: "denyList"
    terms?: string[]
}

init({
  dataCollection: {
    userInfo?: boolean,                            // default: true
    cookies?: KeyValueCollectionBehavior,          // default: { mode: "denyList" }
    httpHeaders?: {
      request?: KeyValueCollectionBehavior,        // default: { mode: "denyList" }
      response?: KeyValueCollectionBehavior,       // default: { mode: "denyList" }
    },
    httpBodies?: string[],                         // default: all valid body types
    urlQueryParams?: KeyValueCollectionBehavior,   // default: { mode: "denyList" }
    graphQL?: {
      document?: boolean,                          // default: true
      variables?: boolean,                         // default: true
    },
    genAI?: {
      inputs?: boolean,                            // default: true
      outputs?: boolean,                           // default: true
    },
    mcp?: {
      inputs?: boolean,                            // default: true
      outputs?: boolean,                           // default: true
    },
    databaseQueryData?: boolean,                   // default: true
    queues?: boolean,                              // default: true
    filePaths?: boolean,                           // default: true
    stackFrameVariables?: boolean | KeyValueCollectionBehavior, // default: true
    frameContextLines?: integer,                   // default: 5 (see boolean fallback below)
  },
})
KeyOption TypeDefaultSinceDescription
userInfoBooleantrue0.1.0Automatically populate user.* fields (user.id, user.email, user.username, user.ip_address) from auto-instrumentation (e.g., inferring user.ip_address from an incoming HTTP request, or deriving user identity from framework session/auth context). Does not gate data explicitly set via Sentry.setUser(), which is always attached (see User-Set Data and Scrubbing). Does not affect any other data category. Default changed to true in 0.2.0.
cookiesKey-value collection{ mode: "denyList" }0.1.0Collect cookies. All key names are always included; the SDK scrubs values for keys matching the sensitive denylist or custom allow/deny terms.
httpHeaders{ request?, response? }Both { mode: "denyList" }0.1.0Collect HTTP headers. Configure request and response independently using key-value collection modes. All key names are always included.
httpBodiesstring[] (body types)all valid body types0.1.0List of body types to collect. Omitted = all body types valid for the platform; empty array ([]) = off. Valid values: "incomingRequest", "outgoingRequest", "incomingResponse", "outgoingResponse". Default changed from [] (off) to all valid body types in 0.2.0.
urlQueryParamsKey-value collection{ mode: "denyList" }0.8.0Collect URL query parameters. All key names are always included; the SDK scrubs values for keys matching the sensitive denylist or custom allow/deny terms.
graphQL{ document?, variables? }Both true0.5.0For document: Collect the GraphQL document.

For variables: Collect the variables that are passed to GraphQL operations.
genAI{ inputs?, outputs? }Both true0.1.0For inputs: Include the content of generative AI inputs. This gates system instructions, prompt messages, tool definitions, and tool call arguments.

For outputs: Include the content of generative AI outputs (e.g. completion text, tool call results).

Metadata such as model name and token counts is always collected regardless of these settings.

Content collected by MCP instrumentation is gated by mcp, not genAI (see below).
mcp{ inputs?, outputs? }Both true0.14.0For inputs: Include the content of incoming MCP requests. This gates tool call arguments (tools/call), prompt arguments (prompts/get), and the message payload of MCP logging notifications.

For outputs: Include the content of MCP responses. This gates tool result content and prompt result messages.

Metadata is always collected (method name, tool or prompt name, session and protocol version, content counts, error status).

Content collected by MCP instrumentation is gated by the mcp option even when it is stored on the gen_ai.* attribute namespace (e.g. gen_ai.tool.call.result).
databaseQueryDataBooleantrue0.6.0Include data that's associated with database queries. This controls collection of bound query parameters, data payloads for write operations, and returned result data.

Sanitized or parameterized DB statements (db.query.text) are not controlled by this property. Structural metadata such as the database system, query summary, operation name, or the table being acted upon is also always collected.
queuesBooleantrue0.7.0Include arguments passed to tasks within queues.
filePathsBooleantrue0.13.0Include file and directory paths collected automatically by file-system instrumentation, such as paths passed to file read, write, move, copy, or delete operations. This option does not control source-code locations in stack frames, profile frames, or debug images, and it does not gate attachment names or paths explicitly supplied by the user.
stackFrameVariablesBoolean or key-value collectiontrue0.1.0Include local variable values captured within stack frames. Accepts a Boolean (true collects all variables, false collects none) or a KeyValueCollectionBehavior to filter which variables are sent by name (see Filtering Stack Frame Variables). Key-value collection added in 0.9.0.
frameContextLinesInteger (Boolean fallback)5 (true)0.1.0Number of source code lines to include above and below each stack frame.
Boolean fallback: Not all platforms support integer configuration values. SDKs MAY accept a boolean, where true is equivalent to the platform default (typically 5) and false is equivalent to 0 (no context lines). SDKs SHOULD prefer accepting an integer when their platform supports it.

Omitting dataCollection entirely is equivalent to passing an empty object — the SDK applies all defaults:

Copied
init({ dsn: "..." });

Result: Cookies, headers, URL query params, HTTP bodies, generative AI inputs/outputs, MCP inputs/outputs, stack frame variables, and user identity fields (user.*) are all collected. The sensitive denylist scrubs sensitive values.

Opt out of automatic population of user.* fields from instrumentation:

Copied
init({
  dsn: "...",
  dataCollection: { userInfo: false },
});

Result: The SDK no longer populates user.id, user.email, user.username, or user.ip_address from instrumentation sources. User data explicitly set via Sentry.setUser() is still attached. All other options use their defaults.

All valid body types are collected by default. Pass a narrower list to collect only specific body types:

Copied
init({
  dsn: "...",
  dataCollection: { httpBodies: ["incomingRequest"] },
});

To disable body collection entirely, pass an empty array:

Copied
init({
  dsn: "...",
  dataCollection: { httpBodies: [] },
});

All header key names are always present in events. This configuration sends real values only for the listed headers; every other header value is replaced with "[Filtered]":

Copied
init({
  dsn: "...",
  dataCollection: {
    httpHeaders: { allow: ["x-request-id", "x-trace-id", "content-type"] },
  },
});

Extend the sensitive denylist with GDPR-sensitive headers that may carry user-identifying information:

Copied
init({
  dsn: "...",
  dataCollection: {
    httpHeaders: { deny: ["forwarded", "-ip", "remote-", "via", "-user"] },
    cookies: { deny: ["forwarded", "-ip", "remote-", "via", "-user"] },
    urlQueryParams: {
      deny: ["forwarded", "-ip", "remote-", "via", "-user"],
    },
  },
});

  • Previous sendDefaultPii: true → users can omit dataCollection entirely; the new defaults already populate user.* and collect HTTP bodies. Add overrides only to restrict collection.
  • Previous sendDefaultPii: false → users should opt out of the categories the new defaults collect.

The new defaults collect more data than either legacy setting did. User identity, generative AI content, HTTP request/response bodies, and file paths are now on by default, and more HTTP headers and cookies are collected. This config restricts collection to roughly match the previous behavior of sendDefaultPii: false:

Copied
init({
  dsn: "...",
  dataCollection: {
    userInfo: false,
    httpBodies: [],
    graphQL: {
      document: false,
      variables: false,
    },
    genAI: {
      inputs: false,
      outputs: false,
    },
    mcp: {
      inputs: false,
      outputs: false,
    },
    databaseQueryData: false,
    queues: false,
    filePaths: false,
    httpHeaders: { deny: ["forwarded", "-ip", "remote-", "via", "-user"] },
    cookies: { deny: ["forwarded", "-ip", "remote-", "via", "-user"] },
    urlQueryParams: {
      deny: ["forwarded", "-ip", "remote-", "via", "-user"],
    },
  },
});

If the SDK can cleanly map what sendDefaultPii did to data collection options, it MAY backfill data collection options from the configured sendDefaultPii value.

If the SDK cannot cleanly map the sendDefaultPii behavior to data collection options, it MUST NOT derive data collection options from the configured sendDefaultPii value. Instead, the following rules apply:

  • If the user sets at least one data collection option, the SDK MUST ignore sendDefaultPii. The SDK MUST apply the options the user set, and the spec defaults for all dataCollection options. This also means that the SDK might send more data when sendDefaultPii was set to false before, so users should be made aware of that.

  • If the user sets no data collection options, the SDK MUST keep the legacy sendDefaultPii behavior unchanged. This prevents breaking changes in PII filtering and allows customers to migrate to data collection at their own pace. Customers may keep using sendDefaultPii without changes to SDK behavior as long as they don't opt into data collection.

Examples of the SDK not cleanly mapping:

  • mixed behavior between integrations (e.g. one integration sent cookies even with sendDefaultPii = false while another did not)
  • hard coded filter terms that don't match the ones defined in data collection spec (e.g. sensitive http header names)
  • sensitive values were omitted and are now attached as [Filtered]

VersionDateSummary
0.16.02026-09-10Explain migration from `sendDefaultPii` for SDKs that can't cleanly map previous behavior to data collection.
0.15.02026-09-29Attach cookie headers as one string-array span attribute (`name=value` elements) instead of one attribute per cookie name. Filter nameless cookie segments and unparseable cookie strings.
0.14.02026-09-28Add `mcp`, defaulting to `{ inputs: true, outputs: true }`, to control collection of MCP request and response content independently of `genAI`.
0.13.02026-09-08Add `filePaths`, defaulting to `true`, to control automatic collection of file and directory paths.
0.12.02026-08-31Require `dataCollection` to be documented as an explicit setup step instead of a commented-out override in the init snippet.
0.11.02026-07-30Require encoded URL query parameters to be stored exactly as they appear in the URL.
0.10.02026-07-29Clarify that Session Replay is not gated by `dataCollection` or `sendDefaultPii` due to opposing defaults (opt-in vs. opt-out).
0.9.12026-07-29Clarify that `genAI.inputs` gates system instructions in addition to prompt messages and tool call arguments/definitions.
0.9.02026-07-21Allow `stackFrameVariables` to accept a `KeyValueCollectionBehavior` for filtering by variable name in addition to the Boolean default.
0.8.02026-07-13Update name of `queryParams` to `urlQueryParams` to reduce ambiguity with other query types.
0.7.02026-07-08Include configuration for queue/tasks data. Modify database config to accept a boolean value instead of a map of key/values. Update name of `graphql` to `graphQL`
0.6.02026-06-29Include configuration for database queries.
0.5.02026-06-26Include configuration options for controlling the inclusion of graphql documents and variables.
0.4.02026-06-12Added documentation requirements for default behavior and setup snippet opt-out comment with link to full dataCollection docs.
0.3.02026-06-05Promoted to candidate following the initial JavaScript SDK implementation. Version stays `0.x` until the contract is frozen at `stable`.
0.2.02026-06-05Collect more data by default. `userInfo` now defaults to `true` and `httpBodies` now defaults to all valid body types. Both can be disabled to opt out.
0.1.02025-03-05Initial spec; dataCollection config, three data sensitivity levels, cookies/headers denylist, replace sendDefaultPii.
Was this helpful?
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").