> For the complete documentation index, see [llms.txt](https://docs.teleskope.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.teleskope.ai/the-platform/api-service/redaction-api/v1-scrub-file.md).

# v1/scrub-file

Redact sensitive information from an uploaded file. The file is parsed to extract its text content, which is then scrubbed and returned as a string. To redact a text string directly, use [v1/scrub](https://docs.teleskope.ai/the-platform/api-service/redaction-api/v1-scrub.md).

{% openapi src="/files/cGyOSqpybs6wM3Oy8JMJ" path="/v1/scrub-file" method="post" %}
[{"openapi":"3.12.json](https://2383928706-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgO8NOoWqwRd6MduHoEy7%2Fuploads%2Fgit-blob-18e852072a6b5bf9502f7f1b2e692056518efd67%2F%7B%22openapi%22%3A%223.12.json?alt=media)
{% endopenapi %}

## Request

The request must be `multipart/form-data` with two parts:

| Part      | Type   | Description                                                                |
| --------- | ------ | -------------------------------------------------------------------------- |
| `file`    | file   | The file to scrub. Required.                                               |
| `content` | string | JSON object with filter options. Required (send `{}` to apply no filters). |

### Query parameters

| Parameter        | Description                                                                                                                                                |
| ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `redactionStyle` | How to replace detected values. See [Redaction styles](#redaction-styles) below. Defaults to `class`.                                                      |
| `key`            | Encryption key for the `encrypted` style. Must be exactly 32, 48, or 64 bytes. The raw query string value is used as the key — no hex decoding is applied. |

### `content` filter options

Only `filters` is supported in the `content` part.

| Field     | Type      | Description                                                                                            |
| --------- | --------- | ------------------------------------------------------------------------------------------------------ |
| `filters` | string\[] | Allow-list of element labels to redact. Omit or pass an empty array to redact every supported element. |

### Limits

| Limit               | Value |
| ------------------- | ----- |
| Multipart form size | 32 MB |

***

## Redaction styles

Set `?redactionStyle=` on the request. The value is case-insensitive. See [Redaction Methodologies](https://docs.teleskope.ai/specifications/redaction-methodologies.md) for details on each style.

| Style            | Result                                                                                                                          |
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| `class`          | Replaces the value with its entity label, e.g. `<EMAIL>`. Default.                                                              |
| `class_numbered` | Numbered labels, e.g. `<email_1>`. Identical values share a number.                                                             |
| `empty`          | Drops the matched value.                                                                                                        |
| `masked`         | Replaces characters with `*`.                                                                                                   |
| `encrypted`      | AES-SIV, reversible. Always pass a `key` — it is not enforced server-side, and output produced without one cannot be decrypted. |
| `tokenized`      | Format-preserving tokens for email, IPv4, IPv6, MAC, and phone. All other elements fall back to `<CLASS>`.                      |

***

## Response fields

| Field             | Type              | Description                                                                                                                                                       |
| ----------------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `content`         | string            | The file's text content with sensitive values redacted.                                                                                                           |
| `classifications` | Classification\[] | Detected matches that were redacted. Same shape as [v1/classify](https://docs.teleskope.ai/the-platform/api-service/scanning-api/v1-classify.md#response-fields). |
| `scanner_version` | string            | Version of the scanner that produced the result.                                                                                                                  |

***

## Related

* [v1/scrub](https://docs.teleskope.ai/the-platform/api-service/redaction-api/v1-scrub.md) — redact a text string directly.
* [v1/classify-file](https://docs.teleskope.ai/the-platform/api-service/scanning-api/v1-classify-file.md) — detect without redacting.
* [Redaction Methodologies](https://docs.teleskope.ai/specifications/redaction-methodologies.md) — how each redaction style transforms a detected value.
