POST /api/v1/deidentify/text/proprietary/outputs/txt
De-identifies a plain-text file using Guardian Layer. Returns a de-identified .txt file.
Request
POST /api/v1/deidentify/text/proprietary/outputs/txt
X-API-Key: cai_your_key_here
Content-Type: multipart/form-data
Form fields
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
file | file | Yes | — | A .txt 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. Leave empty for all |
Response
Returns text/plain; charset=utf-8. The filename is prefixed with deid_.
Example
import requests
with open("notes.txt", "rb") as f:
response = requests.post(
"https://api.custodianai.com/api/v1/deidentify/text/proprietary/outputs/txt",
headers={"X-API-Key": "cai_your_key_here"},
files={"file": ("notes.txt", f, "text/plain")},
data={"domain": "Medical", "masking_type": "transform"},
)
with open("deid_notes.txt", "wb") as out:
out.write(response.content)
Error responses
| Status | Description |
|---|---|
400 | File is not a .txt |
401 | Missing or invalid API key |
403 | Key expired or character limit reached |