Skip to main content

POST /api/v1/deidentify/text

De-identifies a text string using MASKED or PROPRIETARY (Guardian Layer) mode.

:::warning Coming soon GDPR, HIPAA, and CUSTOM modes are not yet publicly released and will be available in a future update. :::


Request

POST /api/v1/deidentify/text
X-API-Key: cai_your_key_here
Content-Type: application/json

Body

{
"text": "Call Sarah at (415) 555-0123 or email sarah@example.com.",
"compliance_mode": "MASKED",
"domain": "General"
}
FieldTypeRequiredDefaultDescription
textstringYesThe text to de-identify
compliance_modestringYesMASKED or PROPRIETARY (Guardian Layer). GDPR, HIPAA, CUSTOM coming soon
domainstringNo"General"General, Medical, Finance, or Custom. Used with PROPRIETARY mode
replacementsobjectNonullOptional replacement map {original: replacement} for use with PROPRIETARY mode

Response 200 OK

{
"output_text": "Call S**** at (***) ***-**** or email s***@example.com.",
"original_text": "Call Sarah at (415) 555-0123 or email sarah@example.com.",
"mode": "MASKED",
"meta": {
"plan_name": "professional"
},
"spans": [
{"start": 5, "end": 10, "label": "PERSON"},
{"start": 14, "end": 28, "label": "PHONE_NUMBER"},
{"start": 38, "end": 55, "label": "EMAIL_ADDRESS"}
],
"analysis": null
}
FieldTypeDescription
output_textstringThe de-identified text
original_textstringThe original input text
modestringThe compliance mode used
metaobjectRequest metadata including plan name
spansarrayEntity spans detected (position, label). May be null for some modes
analysisobjectReturned when compliance_mode is PROPRIETARY and no replacements were supplied. Contains the same fields as the /analyze/text/proprietary response

Examples

MASKED

import requests

requests.post(
"https://api.custodianai.com/api/v1/deidentify/text",
headers={"X-API-Key": "cai_your_key_here"},
json={"text": "Email me at jane@acme.com", "compliance_mode": "MASKED"},
).json()
# {"output_text": "Email me at *************", ...}

PROPRIETARY — Guardian Layer

requests.post(
"https://api.custodianai.com/api/v1/deidentify/text",
headers={"X-API-Key": "cai_your_key_here"},
json={
"text": "The Meridian account exceeded Q3 targets.",
"compliance_mode": "PROPRIETARY",
"domain": "Finance",
},
).json()

When compliance_mode is PROPRIETARY and no replacements are provided, the analysis field in the response contains the detected sensitive words and suggestions.


Error responses

StatusDescription
401Missing or invalid API key
403Key expired or character limit reached
422Missing required fields or invalid compliance_mode