# RequestData | Sentry for Koa

This integration only works inside server environments (Node.js, Bun, Deno).

*Import name: `Sentry.requestDataIntegration`*

This integration is enabled by default. If you'd like to modify your default integrations, read [this](https://docs.sentry.io/platforms/javascript/guides/koa/configuration/integrations.md#modifying-default-integrations).

This integration adds data from incoming requests to transaction and error events that occur during request handling.

```javascript
import * as Sentry from "@sentry/node";

Sentry.init({
  dsn: "https://examplePublicKey@o0.ingest.sentry.io/0",
  integrations: [Sentry.requestDataIntegration()],
});
```

## [Options](https://docs.sentry.io/platforms/javascript/guides/koa/configuration/integrations/requestdata.md#options)

### [`include`](https://docs.sentry.io/platforms/javascript/guides/koa/configuration/integrations/requestdata.md#include)

By passing an `include` option, you can define what data from a request you want to capture:

```javascript
requestDataIntegration({
  // Controls what types of data are added to the event
  include: {
    cookies: boolean  // default: true,
    data: boolean  // default: true,
    headers: boolean  // default: true,
    ip: boolean  // default: false,
    query_string: boolean  // default: true,
    url: boolean  // default: true,
    user: boolean | {
      id: boolean  // default: true,
      username: boolean  // default: true,
      email: boolean  // default: true,
    },
  },
  // Controls how the transaction will be reported. Options are 'path' (`/some/route`),
  // 'methodPath' (`GET /some/route`), and 'handler' (the name of the route handler
  // function, if available)
  transactionNamingScheme: string  // default: 'methodPath',
})
```
