Skip to main content

De-identify CSV

Use this guide to upload a CSV file and download a de-identified CSV.

This workflow also applies to .xlsx and .xls files through the same endpoint.

Before You Start

You need:

  • A Custodian Labs API key.
  • The API base URL for your environment.
  • A CSV file with text values to de-identify.
export CUSTODIAN_API_KEY="your_api_key_here"
export CUSTODIAN_API_BASE_URL="<your_api_base_url>"

Create a Sample CSV

Create a small file named customers.csv:

name,email,phone,notes
Jane Smith,jane.smith@example.com,(415) 555-0123,Requested a follow-up call.
Alex Chen,alex.chen@example.com,(212) 555-0198,Interested in enterprise support.

Upload the CSV

curl -X POST "$CUSTODIAN_API_BASE_URL/api/v1/deidentify/text/proprietary/outputs/csv" \
-H "X-API-Key: $CUSTODIAN_API_KEY" \
-F "file=@customers.csv" \
-F "domain=General" \
-F "masking_type=transform" \
-F "pii_entities=PERSON,EMAIL_ADDRESS,PHONE_NUMBER" \
--output deid_customers.csv

The response is a downloadable file. In this example, it is saved as deid_customers.csv.

Use Redaction Instead

Change masking_type to redact:

-F "masking_type=redact"

Use redaction when the file should clearly hide sensitive values.

Tips

  • Use pii_entities=ALL or omit the field to process all supported entities.
  • Keep the original file in a secure location.
  • Review the output before sending it to another system.
  • Use .xlsx or .xls with the same endpoint when you need spreadsheet formats.

Next Steps