Skip to main content

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

FieldTypeRequiredDefaultDescription
filefileYesA .txt file
domainstringNoGeneralGeneral, Medical, Finance, or Custom
masking_typestringNotransformredact or transform
pii_entitiesstringNoallComma-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

StatusDescription
400File is not a .txt
401Missing or invalid API key
403Key expired or character limit reached