Skip to main content

De-identify a Word document

Send a .docx file and get the same document back with personal data replaced. The formatting, layout and styles are kept.

from custodian_labs import GuardianLayer

result = GuardianLayer().deidentify_file("contract.docx", masking_type="transform")
with open(result.filename or "deid_contract.docx", "wb") as f:
f.write(result.content)
Prefer no code? Use the Dashboard

Everything on this page also works in the Dashboard. Open API Testing, pick your key, paste text or upload a file, choose the mode and the types of data, then click Mask Now.

What's covered​

Guardian Layer processes all the text in the document:

  • Body paragraphs
  • Tables, including tables inside tables
  • Headers and footers
  • Footnotes and endnotes
  • Comments

Older .doc files​

Only .docx is supported. To use an older .doc file, open it in Word and choose File → Save As → Word Document (.docx) first.

See also​

De-identify a PDF · De-identify a CSV or Excel file · File de-identification