AI Security
Security API

PII & Secrets Detection

Find emails, phone numbers, API keys, private keys, and other sensitive data in text.

Definition

PII & Secrets Detection scans text for personally identifiable information and credential leaks — emails, phone numbers, API keys, private keys, and common secret formats.

Use cases

  • Redact sensitive data before sending context to external LLM providers
  • Audit agent logs and conversation history for credential exposure
  • Compliance pre-checks on user uploads in document AI workflows
  • Scan outbound model responses before displaying to end users

How it works

  1. Submit text with optional redact flag for masked output
  2. Regex and format validators identify PII and secret patterns
  3. Findings include category labels and match positions
  4. Verdict reflects severity based on detected sensitive data types

Request example

curl -X POST "https://www.identicapi.com/api/v1/security/pii-secrets" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "text": "Contact me at john@example.com. My API key is sk-live-abc123xyz.",
  "redact": true
}'
{
  "text": "Contact me at john@example.com. My API key is sk-live-abc123xyz.",
  "redact": true
}

Response example

{
  "request_id": "req_01HXYZ",
  "api": "pii-secrets-detection",
  "verdict": "unsafe",
  "risk": "high",
  "findings": [
    {
      "category": "email",
      "reason": "Email address detected"
    },
    {
      "category": "api_key",
      "reason": "API key pattern detected"
    }
  ],
  "reasons": [
    "PII and secrets detected in text"
  ],
  "redacted_text": "Contact me at [REDACTED]. My API key is [REDACTED].",
  "usage_units": 1,
  "processing_time_ms": 8,
  "detector_version": "1.0.0"
}

Verdict semantics

safe

No PII or secrets detected.

suspicious

Low-confidence or partial matches. Verify before proceeding.

unsafe

Confirmed sensitive data present. Redact or block.

Limitations

  • Pattern-based detection — custom secret formats may not be recognized
  • Redaction replaces matches with placeholders; does not guarantee complete anonymization
  • Not a replacement for data classification policies or encryption at rest

Ready to integrate?

Read the full API reference or create a free account to get your API key.