---
title: "Use this when scrubbing test/dev text: replaces each occurrence of the given terms with block characters (████)."
method: POST
path: "/v1/redact_text"
tags: ["text"]
---

# Use this when scrubbing test/dev text: replaces each occurrence of the given terms with block characters (████).

`POST /v1/redact_text`

## Request

- Base URL: `https://api.clean.tools`
- URL: `https://api.clean.tools/v1/redact_text`
- Auth: none declared

Use this when scrubbing test/dev text: replaces each occurrence of the given terms with block characters (████). Provide `text` plus `terms` (a comma-separated string or an array of strings). By default it matches whole words only using Unicode boundaries (so "ann" will not match inside "annual") and is case-insensitive; set `caseSensitive` to match exactly, `wholeWords: false` to match substrings, or `fixedWidth: true` to hide each term's length behind a constant-width bar. Returns the redacted text and a replacement count, and never echoes the original terms. Deterministic: same input, same output. Truly sensitive text is better redacted client-side at clean.tools/text-redact/. Example: {text: "Contact Jane Doe", terms: "Jane Doe"} -> redacted "Contact ████████", redactedCount 1.

## Request body

- object
  - `text` string, required: The text to redact terms from.
  - `terms` union, required: The sensitive terms to redact, given either as a comma-separated string (e.g. "Jane Doe, jane@x.com") or an array of strings.
    - string
    - string[]
  - `wholeWords` boolean: When true (default), only match terms as whole words using Unicode word boundaries (so "ann" will not match inside "annual").
  - `caseSensitive` boolean: When true, match terms case-sensitively. Defaults to false (case-insensitive).
  - `fixedWidth` boolean: When true, replace every matched term with a constant-width block bar so the redacted length does not leak the original term length. Defaults to false (block length equals term length).

## Response `200`

Structured tool result.

- object
  - `tool` string
  - `result` object
    - `redacted` string, required: The text with all matched terms replaced by block characters; identical to the input when no terms matched.
    - `redactedCount` integer, required: The number of replacements made.

## Other responses

- `400`: Invalid input or the tool reported an error.
- `413`: Request body exceeds the 128 KB limit.
- `429`: Rate limit exceeded; the response carries Retry-After and RateLimit-* headers — honor them and add jitter.

---

[API](https://skmtc.dev/clean/apis/clean-tools-api.md) · [All operations](https://skmtc.dev/clean/apis/clean-tools-api/llms.txt) · [OpenAPI document](https://skmtc.dev/clean/apis/clean-tools-api/revisions/a24a01d2833c?raw)
