De-identify Text
Use this guide to send text to Guardian Layer and receive a safer version back.
For your first test, use fictional data.
Before You Start
You need:
- A Custodian Labs API key.
- The API base URL for your environment.
- A backend, terminal, or secure server-side place to make the request.
export CUSTODIAN_API_KEY="your_api_key_here"
export CUSTODIAN_API_BASE_URL="<your_api_base_url>"
Transform Text
Use transform when you want readable de-identified output.
curl -X POST "$CUSTODIAN_API_BASE_URL/api/v1/deidentify/text/proprietary/outputs" \
-H "X-API-Key: $CUSTODIAN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Please contact Jane Smith at jane.smith@example.com or call (415) 555-0123.",
"domain": "General",
"masking_type": "transform",
"pii_entities": ["ALL"]
}'
Redact Text
Use redact when you want sensitive values hidden with masking marks.
curl -X POST "$CUSTODIAN_API_BASE_URL/api/v1/deidentify/text/proprietary/outputs" \
-H "X-API-Key: $CUSTODIAN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Please contact Jane Smith at jane.smith@example.com or call (415) 555-0123.",
"domain": "General",
"masking_type": "redact",
"pii_entities": ["ALL"]
}'
Use Only Selected Entity Types
Limit processing with pii_entities:
{
"pii_entities": ["PERSON", "EMAIL_ADDRESS"]
}
This tells Guardian Layer to process names and email addresses while leaving other supported categories unchanged.
Check the Result
The response includes:
original_text: the input text.outputs: one or more de-identified output candidates.mode: the response mode.meta: processing metadata.
Use the first item in outputs for most application flows.