Documents

Redact Document

Make a copy of a document without email addresses, phone and card numbers, IBANs, other personal data, chosen words or custom patterns.

Redact Document (doc_redact) makes a redacted copy of a file; the original is not changed. It removes what the presets detect, the words and phrases you list, and matches of your own patterns, and reports how many of each it replaced.

  • Word, PowerPoint and Excel files are redacted in place: the text inside the file is replaced and the formatting, layout and images are kept. The author fields in the file properties are cleared too.
  • Text formats (plain text, Markdown, CSV, TSV, JSON, XML, YAML) keep their format.
  • PDF, HTML and OpenDocument files are rebuilt from the redacted text: a PDF (or HTML) with the text, headings, lists and tables, but not the original layout or images. Nothing redacted is left in the file — the original text layer is gone.

Inputs

Document (source): a file object, a list (the first file), a storage:// reference, a URL, base64 content or text. See File inputs.

Options

SettingKeyDefaultWhat it does
RemovepresetsnoneAny of the presets below
Words and phrasestermsnoneComma-separated (or a list), matched anywhere, ignoring case: Project Falcon, {{customer.company_name}}
PatternspatternsnoneA list of { "pattern": "…" } regular expressions, matched line by line, ignoring case: ACC-\d{6}
Replace withreplacementblockblock: █ for every character (spaces kept, so the length shows); label: the kind in brackets ([EMAIL], [PHONE], [CREDIT_CARD], [IBAN], [TERM], [PATTERN]…); text: your own text
Replacement textreplacement_text[REDACTED]With replacement: "text"
Redacted copyoutputsamesame (Word, PowerPoint, Excel and text formats keep their format; anything else becomes PDF, HTML stays HTML), pdf, html or text
Clear the author in the file propertiesclear_authortrueWord, PowerPoint and Excel: empty the Author and Last modified by properties
Pages, OCRpages, ocr, ocr_languagesall, off, engPDFs rebuilt from text: which pages, and OCR for scans (not shown in the designer)
Output file nameoutput_name<source>-redacted
Output variableoutput_varredacted

At least one preset, term or pattern is required.

Presets

Presetpresets valueFinds
EmailsemailEmail addresses
Phone numbersphone7–15 digits with spaces, dots, dashes, brackets or a leading +
Card numberscredit_card13–19 digits (spaces or dashes allowed) that pass the Luhn check
IBANsibanIBANs that pass the mod-97 check
US SSNsssn123-45-6789 style numbers (invalid ranges excluded)
IP addressesip_addressIPv4 addresses
URLsurlhttp and https links
DatesdateISO, numeric and written dates

The checksums keep order numbers and other long numbers that merely look like card numbers or IBANs out of the result.

Outputs

VariableContents
{{redacted}}{ file, text, counts, total }
{{redacted_file}}The redacted copy as a file object
{{redacted_text}}The redacted text
{{redacted_count}}Number of redactions
{{redacted}} for a Word file, replacement: label
{
  "file": { "_file": true, "name": "customer-onboarding-redacted.docx", "mime_type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "size": 14876, "url": "…", "storage_ref": "storage://task-files/workflow-files/…", "checksum_sha256": "…" },
  "text": "Customer onboarding\nOrders: Nancy Davolio <[EMAIL]>, phone [PHONE].\nAccounts: [EMAIL], [PHONE].\nCard on file: [CREDIT_CARD]\nBank account: [IBAN]",
  "counts": { "email": 2, "phone": 2, "credit_card": 1, "iban": 1 },
  "total": 6
}

counts is keyed by preset, plus term and pattern. The run history shows the file name, redactions and counts, never the text.

On the canvas

The presets (or the number of rules) and the output variable: email, phone, credit_card, iban → redacted.

Limits

  • PDFs are rebuilt from their text: the layout, fonts and images of the original are not kept (a warning says so), and the standard PDF fonts show only Latin (Windows-1252) characters — others become "?". Where the layout matters and you have the Word original, redact that (it is redacted in place) and convert the copy to PDF.
  • Word, PowerPoint and Excel: the body, headers, footers, footnotes, endnotes and comments (Word), slides, notes and comments (PowerPoint), and text cells and comments (Excel) are redacted. Numbers stored as numeric Excel cells, text inside images and embedded objects, and the names of comment and tracked-change authors are not.
  • Patterns match within one line. Text inside an image is only seen with OCR, and then only in the rebuilt PDF.
  • Reading follows the read limits.

Pattern-based detection finds what looks like personal data; it is not a guarantee. Check a sample of redacted copies before you rely on them, and add terms (names, account numbers) the presets cannot know.

Security notes

Custom patterns go through the ReDoS guard. Redacted HTML is sanitised. The original file is not changed or moved. See Security.

Example

json
{
  "type": "doc_redact",
  "label": "Redact customer file",
  "config": {
    "source": "{{form.customer_file}}",
    "presets": ["email", "phone", "credit_card", "iban"],
    "terms": "{{customer.contact_name}}",
    "patterns": [{ "pattern": "ACC-\\d{6}" }],
    "replacement": "label",
    "output": "same",
    "clear_author": true
  }
}

Canvas: email, phone, credit_card, iban → redacted.

Works well with