POST /v1/sanitize

Strip PII from text before sending to external LLMs.

POSThttps://api.ambientmeta.com/v1/sanitize

Authentication

Authorization: Bearer am_live_your_key_here

Request Body

FieldTypeRequiredDescription
textstringYesText to sanitize (max 100KB)
config.entitiesarrayNoEntity types to detect (default: all)
config.custom_patternsbooleanNoInclude org's custom patterns (default: true)

Example Request

curl -X POST https://api.ambientmeta.com/v1/sanitize \
  -H "Authorization: Bearer am_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Email John Smith at john@acme.com about the NYC merger",
    "config": {"entities": ["PERSON", "EMAIL", "LOCATION"]}
  }'

Response

FieldTypeDescription
sanitizedstringText with PII replaced by placeholders
session_idstringID to use for rehydration (valid 24 hours)
entities_foundintegerNumber of entities detected
entitiesarrayDetails of each detected entity
processing_msintegerProcessing time in milliseconds

Example Response

{
  "sanitized": "Email [PERSON_1] at [EMAIL_1] about the [LOCATION_1] merger",
  "session_id": "ses_a1b2c3d4e5f6",
  "entities_found": 3,
  "entities": [
    {"placeholder": "[PERSON_1]", "type": "PERSON", "confidence": 0.97},
    {"placeholder": "[EMAIL_1]", "type": "EMAIL", "confidence": 0.99},
    {"placeholder": "[LOCATION_1]", "type": "LOCATION", "confidence": 0.92}
  ],
  "processing_ms": 12
}

Entity Types

TypeDescriptionExamples
PERSONNames of peopleJohn Smith, Dr. Jane Doe
EMAILEmail addressesjohn@acme.com
PHONEPhone numbers(555) 123-4567
SSNSocial Security Numbers123-45-6789
CREDIT_CARDCredit card numbers4532-1234-5678-9012
LOCATIONPlaces, addressesNYC, 123 Main St

Errors

CodeHTTP StatusDescription
invalid_api_key401API key is missing or invalid
empty_text400Text field is empty
text_too_large413Text exceeds 100KB limit
rate_limited429Too many requests

View all error codes →