PII Redactor

Strips PII (emails, SSNs, phones, credit cards, URLs, IPs, addresses, DOBs) from text before LLM calls. Returns redacted text + optional re-hydration mapping.

POST /api/redact
Security
<200ms latency
API Key auth
Free tier available

What is PII Redactor?

The PII Redactor API automatically detects and removes personally identifiable information (PII) from text content before sending it to third-party services like LLMs, logging systems, or external APIs. This ensures compliance with privacy regulations like GDPR, CCPA, and HIPAA while maintaining the utility of your data.

Using high-performance compiled regex patterns for structured PII (emails, SSNs, credit cards, phone numbers, URLs, IP addresses, street addresses, and dates of birth), the API provides comprehensive protection with sub-200ms response times and zero external dependencies.

8 Entity Types

Emails, SSNs, phones, credit cards, URLs, IP addresses, street addresses, and dates of birth

Re-hydration Mapping

Optional mapping to restore original values after processing

Regex Detection

Compiled regex patterns for maximum speed and accuracy

Consistent Placeholders

Same PII value always maps to the same placeholder

Code Examples

curl -X POST https://api.atomicapis.dev/api/redact \
  -H "X-RapidAPI-Proxy-Secret: YOUR_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Contact John Doe at [email protected] or call 555-123-4567. His SSN is 123-45-6789.",
    "includeMapping": true
  }'

Request Parameters

Parameter Type Required Description
text string Yes The text content to analyze and redact PII from
includeMapping boolean No If true, returns a mapping object for re-hydrating redacted values later. Default: false.

Detected Entity Types

email

Email addresses

ssn

US Social Security Numbers

phone

US & international phone numbers

credit_card

Credit/debit card numbers

url

HTTP/HTTPS URLs

ip_address

IPv4 and IPv6 addresses

street_address

US street addresses

dob

Dates of birth (various formats)

Response Format

200 OK - Application/JSON
{
  "redactedText": "Contact John Doe at [EMAIL_1] or call [PHONE_1]. His SSN is [SSN_1].",
  "totalPiiFound": 3,
  "piiCounts": {
    "email": 1,
    "phone": 1,
    "ssn": 1
  },
  "mapping": {
    "[EMAIL_1]": "[email protected]",
    "[PHONE_1]": "555-123-4567",
    "[SSN_1]": "123-45-6789"
  }
}

Response Fields

Field Type Description
redactedText string The input text with all detected PII replaced with placeholders
totalPiiFound integer Total number of PII entities detected
piiCounts object Counts of each PII type detected (e.g., email, phone, ssn, credit_card, url, ip_address, street_address, dob)
mapping object Key-value pairs for re-hydration (only if includeMapping is true)

Use Cases

LLM Privacy

Sanitize user inputs before sending to third-party LLM providers like OpenAI, Anthropic, or Google. Prevent sensitive data from being stored in training datasets or logs.

// Pre-process user messages
const safeInput = await redactPII(
  userMessage
);
const response = await openai.chat(
  safeInput
);

Log Sanitization

Automatically scrub PII from application logs before shipping to centralized logging systems like Splunk, Datadog, or ELK. Maintain compliance with data retention policies.

# Sanitize before logging
sanitized = redact_pii(log_entry)
logger.info(sanitized)

Data Sharing

Share datasets with partners or analytics teams while preserving privacy. Use the re-hydration mapping to restore original values when data returns to your secure environment.

// Share anonymized data
const { redactedText, mapping } = 
  await redactPII(data, true);
// Later: restore with mapping

Build Constraints

Technical Implementation

Regex Detection Engine

Uses high-performance compiled regex patterns to detect structured PII including emails, SSNs, credit cards, phone numbers, URLs, IP addresses, street addresses, and dates of birth.

Single-Pass Processing

All entity detection happens in a single pass through the text, minimizing latency and maximizing throughput for high-volume applications.

Sub-200ms Response Time

Optimized for real-time applications. Average processing time is 40-80ms for typical text lengths up to 10,000 characters.

Zero External Dependencies

All detection uses AOT-safe compiled regex patterns that run efficiently with zero external dependencies and no GPU required.

<200ms
Max Latency
0
External Deps
8
Entity Types

Error Codes

Code Status Description Resolution
400 Bad Request Missing or invalid parameters Check that text is provided and valid
401 Unauthorized Invalid or missing API key Include a valid Authorization header
429 Rate Limited Too many requests Wait before retrying or upgrade your plan
413 Payload Too Large Text exceeds 100KB limit Split text into smaller chunks
500 Server Error Internal processing error Retry the request; contact support if persistent

Ready to protect your data?

Start redacting PII from your text data in minutes. Free tier includes 1,000 requests per month.

MCP Integration MCP Ready

What is MCP?

Model Context Protocol (MCP) allows AI assistants like Claude to call this API as a native tool during conversation. Instead of writing HTTP requests, the AI invokes the tool directly — no API keys or boilerplate needed on the client side.

Tool Details

Tool Class
PiiRedactorTools
Method
RedactPii()

Description

Detects and redacts personally identifiable information from text