---
description: "Sets the page's (or the server process's) redaction rules; every library sink follows them from the next value on."
---

# `configureRedaction`

Sets the page's redaction rules, or the process's on a server. Every library sink follows them from the next value on: the devtools log and its "copy as code", the chat's tool card, URLs and console lines leaving the page, server logs. With React, [`<WebAgentsProvider redact>`](/docs/reference/react/web-agents-provider#props) calls it for you.

## Import

```ts
import { configureRedaction } from "@webmcp-agents/core/redact";
```

## Example

```ts
import { configureRedaction } from "@webmcp-agents/core/redact";

configureRedaction({
  keys: (defaults) => [...defaults, "loyaltyId"],
  allowQuery: ["page", "sort"],
});
```

## Options

`configureRedaction(options)`.

| Name | Type | Default | Description |
|---|---|---|---|
| `options` | `RedactOptions \| Redactor` | required | The [options of `createRedactor`](/docs/reference/core/create-redactor#options), or a redactor you built. `{}` restores the defaults. |

## Returns

Nothing.

## Notes

- A second call replaces the first: options are not merged. To build on the current rules, pass `getRedactor().extend({ … })`.
- A sink reads the rules when it writes, so a call made after a tool already ran applies to the next call, not to what was already logged.
- The page and the server are separate: [`createChatHandler({ redact })`](/docs/reference/chat/create-chat-handler#options) gives a handler its own rules, whatever the process configured.

## See also

- [`getRedactor`](/docs/reference/core/get-redactor)
- [`createRedactor`](/docs/reference/core/create-redactor)
- [`@webmcp-agents/core/redact`](/docs/reference/core/redact)
