POST /api/v1/deidentify/text/proprietary/outputs/csv
De-identifies every cell in a CSV file using Guardian Layer. Returns a de-identified CSV with the same structure as the input.
Request
POST /api/v1/deidentify/text/proprietary/outputs/csv
X-API-Key: cai_your_key_here
Content-Type: multipart/form-data
Form fields
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
file | file | Yes | — | A .csv file |
domain | string | No | General | General, Medical, Finance, or Custom |
masking_type | string | No | transform | redact or transform |
pii_entities | string | No | all | Comma-separated entity types, e.g. "PERSON,EMAIL_ADDRESS". Leave empty for all |
Response
Returns text/csv. The filename is prefixed with deid_.
| Header | Value |
|---|---|
Content-Type | text/csv |
Content-Disposition | attachment; filename="deid_<original-filename>.csv" |
Example
import requests
with open("employees.csv", "rb") as f:
response = requests.post(
"https://api.custodianai.com/api/v1/deidentify/text/proprietary/outputs/csv",
headers={"X-API-Key": "cai_your_key_here"},
files={"file": ("employees.csv", f, "text/csv")},
data={
"domain": "General",
"masking_type": "redact",
"pii_entities": "PERSON,EMAIL_ADDRESS,PHONE_NUMBER",
},
)
with open("deid_employees.csv", "wb") as out:
out.write(response.content)
Error responses
| Status | Description |
|---|---|
400 | File is not a .csv or is invalid |
401 | Missing or invalid API key |
403 | Key expired or character limit reached |