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
| Field | Type | Required | Description |
text | string | Yes | Text to sanitize (max 100KB) |
config.entities | array | No | Entity types to detect (default: all) |
config.custom_patterns | boolean | No | Include 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
| Field | Type | Description |
sanitized | string | Text with PII replaced by placeholders |
session_id | string | ID to use for rehydration (valid 24 hours) |
entities_found | integer | Number of entities detected |
entities | array | Details of each detected entity |
processing_ms | integer | Processing 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
| Type | Description | Examples |
PERSON | Names of people | John Smith, Dr. Jane Doe |
EMAIL | Email addresses | john@acme.com |
PHONE | Phone numbers | (555) 123-4567 |
SSN | Social Security Numbers | 123-45-6789 |
CREDIT_CARD | Credit card numbers | 4532-1234-5678-9012 |
LOCATION | Places, addresses | NYC, 123 Main St |
Errors
| Code | HTTP Status | Description |
invalid_api_key | 401 | API key is missing or invalid |
empty_text | 400 | Text field is empty |
text_too_large | 413 | Text exceeds 100KB limit |
rate_limited | 429 | Too many requests |
View all error codes →