# redactSession

Canonical: <https://test-proxy-recorder.dev/docs/reference/api/functions/redactsession/>
Docs index: <https://test-proxy-recorder.dev/docs/> · All docs as one file: <https://test-proxy-recorder.dev/llms-full.txt>

---

> **redactSession**(`session`, `config?`): [`RecordingSession`](/docs/reference/api/interfaces/recordingsession/)

Defined in: [utils/redact.ts:444](https://github.com/asmyshlyaev177/test-proxy-recorder/blob/d1bacb3b39a3cf6f7f5a5391a8201868e4629861/packages/test-proxy-recorder/src/utils/redact.ts#L444)

Return a redacted copy of a recording session. Sensitive headers are
stripped and any configured body patterns replaced. The input is not
mutated. Redaction is opt-in: a config object (even `{}`) enables it, while
`false`/`undefined` returns the session unchanged.

## Parameters

### session

[`RecordingSession`](/docs/reference/api/interfaces/recordingsession/)

### config?

`false` \| [`RedactionConfig`](/docs/reference/api/interfaces/redactionconfig/)

## Returns

[`RecordingSession`](/docs/reference/api/interfaces/recordingsession/)
