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.
- Python
- TypeScript
- curl
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)
import { writeFile } from "node:fs/promises";
import { GuardianLayer } from "@custodianlabs/sdk";
const result = await new GuardianLayer().deidentifyFile("contract.docx", { maskingType: "transform" });
await writeFile(result.filename ?? "deid_contract.docx", result.content);
curl -X POST "https://privacy.custodianlabs.io/api/v1/deidentify/text/proprietary/outputs/docx" \
-H "X-API-Key: $CUSTODIAN_API_KEY" \
-F "file=@contract.docx" \
-F "masking_type=transform" \
-o deid_contract.docx
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