API Documentation

API quickstart

Clean AI Prompts makes it simple to de-identify and re-identify sensitive data in text. Send your content via API, get it back with semantic placeholders, then re-identify when needed.

1

De-identify text

Send text and receive it back with sensitive data replaced by semantic placeholders

Request
curl -X POST $NEXT_PUBLIC_API_BASE/v1/text/deidentify \
  -H "X-API-Key: your-api-key-here" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Subject: Account Update\n\nDear John A. Example,\n\nWe need to verify your account.\nAccount Number: 12345678\nEmail: john@example.com\nPhone: +44 20 7946 0958"
  }'
Response
{
  "deidentified": "Subject: Account Update\n\nDear {{person_abc123...}},\n\nWe need to verify your account.\nAccount Number: {{account_number_def456...}}\nEmail: {{email_address_ghi789...}}\nPhone: {{phone_number_jkl012...}}",
  "mapping": {
    "{{person_abc123...}}": "John A. Example",
    "{{account_number_def456...}}": "12345678",
    "{{email_address_ghi789...}}": "john@example.com",
    "{{phone_number_jkl012...}}": "+44 20 7946 0958"
  }
}
2

Re-identify text

Send the de-identified text with placeholders to restore original values

Request
curl -X POST $NEXT_PUBLIC_API_BASE/v1/text/reidentify \
  -H "X-API-Key: your-api-key-here" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Subject: Account Update\n\nDear {{person_abc123...}},\n\nWe need to verify your account.\nAccount Number: {{account_number_def456...}}\nEmail: {{email_address_ghi789...}}\nPhone: {{phone_number_jkl012...}}",
    "mapping": {
      "{{person_abc123...}}": "John A. Example",
      "{{account_number_def456...}}": "12345678",
      "{{email_address_ghi789...}}": "john@example.com",
      "{{phone_number_jkl012...}}": "+44 20 7946 0958"
    }
  }'
Response
{
  "reidentified": "Subject: Account Update\n\nDear John A. Example,\n\nWe need to verify your account.\nAccount Number: 12345678\nEmail: john@example.com\nPhone: +44 20 7946 0958"
}
3

Anonymization methods

Choose how sensitive data is anonymized: replace, hash, or redact

Replace (default)

Replaces PII with semantic placeholders (e.g., {{full_name_abc123...}}). Reversible with mapping.

{
  "text": "My email is john@example.com",
  "method": "replace"
}
Hash

Replaces PII with SHA-256 hash values (e.g., <HASHED_abc123...>). Reversible with mapping.

{
  "text": "My email is john@example.com",
  "method": "hash"
}
Redact

Removes PII completely (e.g., <REDACTED>). Not reversible.

{
  "text": "My email is john@example.com",
  "method": "redact"
}

Automatic mapping lookup

When you de-identify text, the mapping is stored securely. To re-identify, simply send the de-identified text with placeholders. The API automatically retrieves the original values from your secure vault.

curl -X POST $NEXT_PUBLIC_API_BASE/v1/text/reidentify \
  -H "X-API-Key: your-api-key-here" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Dear {{person_abc123...}}, your account {{account_number_def456...}}..."
  }'

The API automatically looks up mappings from your vault - no need to send the mapping manually.

Ready to get started?

Start protecting sensitive data in your AI applications today. Learn more about how it works and explore use cases on our homepage.