Skip to main content

De-identify Text

Send text to Guardian Layer, get a safer version back. Use fictional data to try it.

from custodian_labs import GuardianLayer

out = GuardianLayer().deidentify_text_outputs(
"Contact Jane Smith at jane.smith@example.com or call (415) 555-0123.",
masking_type="transform",
)
print(out.outputs[0].text)
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.

Pick a mode​

masking_typeOutput
transform (used if you don't set one)Readable stand-in values
redact*****
placeholderLabels such as [NAME] and [EMAIL]

Limit which entities​

GuardianLayer().deidentify_text_outputs(text, pii_entities=["PERSON", "EMAIL_ADDRESS"])

Omit or ["ALL"] processes everything. See Supported Entities.

out.outputs holds one or two candidates; use outputs[0] by default.

See also​

Transform · Masking · Guardian Layer client