Skip to main content

De-identify files

Upload a file and get a de-identified file back in the same format.

EndpointAcceptsNotes
POST /api/v1/deidentify/text/proprietary/outputs/csv.csv, .xlsx, .xlsEvery cell is processed. Returned in the same format.
POST /api/v1/deidentify/text/proprietary/outputs/docx.docxFormatting is kept. Convert .doc to .docx first.
POST /api/v1/deidentify/text/proprietary/outputs/pdf.pdfNeeds selectable text. Scanned PDFs are coming soon.
POST /api/v1/deidentify/text/proprietary/outputs/txt.txt

Request​

Send multipart/form-data:

FieldRequiredDescription
fileYesThe file to de-identify.
masking_typeNotransform (used if you don't set one), redact or placeholder.
pii_entitiesNoComma-separated categories, such as PERSON,EMAIL_ADDRESS. Leave empty or send ALL for everything.
curl -X POST "https://privacy.custodianlabs.io/api/v1/deidentify/text/proprietary/outputs/pdf" \
-H "X-API-Key: $CUSTODIAN_API_KEY" \
-F "file=@report.pdf" \
-F "masking_type=redact" \
-F "pii_entities=PERSON,PHONE_NUMBER" \
-o deid_report.pdf

Response​

The response body is the de-identified file. A Content-Disposition header names it with a deid_ prefix, such as deid_report.pdf.

A file of the wrong type returns 400.

SDK equivalents: deidentify_file() in Python and deidentifyFile() in TypeScript pick the endpoint from the file extension.