Protect API

Analyze content and optionally redact sensitive information in a single call.

Endpoint

POST /v1/protect

Request Body

ParameterTypeRequiredDescription
contentstringYesThe content to protect
redactbooleanNoWhether to redact PII (default: true)
redactTypesstring[]NoSpecific PII types to redact
replacementstringNoReplacement text (default: "[REDACTED]")

Example Request

curl https://api.talonai.io/v1/protect \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "My email is john@example.com and SSN is 123-45-6789",
    "redact": true,
    "redactTypes": ["email", "ssn"]
  }'

Response

{
  "id": "protect_xyz789",
  "original": "My email is john@example.com and SSN is 123-45-6789",
  "protected": "My email is [EMAIL] and SSN is [SSN]",
  "analysis": {
    "riskScore": 45,
    "riskLevel": "medium",
    "isSafe": true
  },
  "redactions": [
    {
      "type": "email",
      "original": "john@example.com",
      "replacement": "[EMAIL]",
      "start": 12,
      "end": 28
    },
    {
      "type": "ssn",
      "original": "123-45-6789",
      "replacement": "[SSN]",
      "start": 41,
      "end": 52
    }
  ],
  "piiTypes": ["email", "ssn"]
}

Supported PII Types

email
ssn
credit_card
phone
address
ip_address
passport
driver_license
bank_account
api_key