REST API Reference
The PrivaiShield API provides programmatic access to PII redaction. Use it to integrate privacy protection into your applications, data pipelines, and workflows.
https://api.privaishield.com/v1Authentication
All API requests require authentication using an API key. Include your key in the Authorization header as a Bearer token.
Authorization: Bearer sk_live_your_api_key_here
Prefix: sk_test_
Use for development and testing. Rate limited to 100 req/min.
Prefix: sk_live_
Use for production. Higher rate limits based on your plan.
Generate API keys in your account dashboard. Keep your keys secure and never expose them in client-side code.
Endpoints
The API provides endpoints for text redaction, document processing, and batch operations.
/redactRedact PII from text/redact/documentProcess documents/redact/batchBatch processing/redact/streamStreaming redaction/entitiesList entity types/usageGet usage statsText Redaction
The primary endpoint for redacting PII from text. Supports both standard (pattern-based) and enhanced (ML-powered) detection modes.
curl -X POST https://api.privaishield.com/v1/redact \
-H "Authorization: Bearer sk_live_your_key" \
-H "Content-Type: application/json" \
-d '{
"text": "Contact John Smith at john@acme.com or 555-123-4567",
"mode": "enhanced",
"entities": ["PERSON", "EMAIL", "PHONE"],
"returnOriginal": false
}'textstringrequiredThe text to redact (max 100KB)mode"standard" | "enhanced"Detection mode (default: enhanced)entitiesstring[]Entity types to detect (default: all)returnOriginalbooleanInclude original values (default: false)confidencenumberMinimum confidence threshold (0-1){
"redacted": "Contact [PERSON_1] at [EMAIL_1] or [PHONE_1]",
"entities": [
{
"type": "PERSON",
"token": "[PERSON_1]",
"start": 8,
"end": 18,
"confidence": 0.97
},
{
"type": "EMAIL",
"token": "[EMAIL_1]",
"start": 22,
"end": 35,
"confidence": 0.99
},
{
"type": "PHONE",
"token": "[PHONE_1]",
"start": 39,
"end": 51,
"confidence": 0.95
}
],
"mode": "enhanced",
"processingTime": "47ms"
}Document Processing
Process documents (PDF, DOCX, TXT) and receive redacted content. Documents are processed page-by-page with full text extraction.
curl -X POST https://api.privaishield.com/v1/redact/document \ -H "Authorization: Bearer sk_live_your_key" \ -F "file=@contract.pdf" \ -F "mode=enhanced" \ -F "outputFormat=pdf"
{
"documentId": "doc_abc123",
"pages": 5,
"totalEntities": 23,
"processingTime": "1.2s",
"downloadUrl": "https://api.privaishield.com/v1/documents/doc_abc123/download",
"expiresAt": "2024-01-15T12:00:00Z"
}Streaming
Stream redaction results in real-time using Server-Sent Events (SSE). Ideal for long documents or when you want to show progress.
curl -X POST https://api.privaishield.com/v1/redact/stream \
-H "Authorization: Bearer sk_live_your_key" \
-H "Accept: text/event-stream" \
-H "Content-Type: application/json" \
-d '{"text": "Long document content...", "mode": "enhanced"}'event: entity
data: {"type":"PERSON","token":"[PERSON_1]","confidence":0.97}
event: entity
data: {"type":"EMAIL","token":"[EMAIL_1]","confidence":0.99}
event: progress
data: {"processed":50,"total":100}
event: complete
data: {"redacted":"...","totalEntities":5,"processingTime":"120ms"}Batch Processing
Process multiple texts in a single request. Ideal for high-volume pipelines with up to 100 items per batch.
curl -X POST https://api.privaishield.com/v1/redact/batch \
-H "Authorization: Bearer sk_live_your_key" \
-H "Content-Type: application/json" \
-d '{
"items": [
{"id": "1", "text": "Email: john@example.com"},
{"id": "2", "text": "Phone: 555-123-4567"},
{"id": "3", "text": "SSN: 123-45-6789"}
],
"mode": "enhanced"
}'{
"results": [
{"id": "1", "redacted": "Email: [EMAIL_1]", "entities": [...]},
{"id": "2", "redacted": "Phone: [PHONE_1]", "entities": [...]},
{"id": "3", "redacted": "SSN: [SSN_1]", "entities": [...]}
],
"totalItems": 3,
"totalEntities": 3,
"processingTime": "89ms"
}Rate Limits
Rate limits vary by plan. Headers in each response indicate your current usage and limits.
| Plan | Requests/min | Batch size | Max text size |
|---|---|---|---|
| Free | 60 | 10 | 10KB |
| Pro | 600 | 50 | 100KB |
| Business | 3,000 | 100 | 1MB |
| Enterprise | Custom | Custom | Custom |
X-RateLimit-LimitMaximum requests per minuteX-RateLimit-RemainingRequests remaining in current windowX-RateLimit-ResetUnix timestamp when limit resetsError Handling
The API uses standard HTTP status codes. Errors include a JSON body with details about what went wrong.
{
"error": {
"code": "invalid_request",
"message": "The 'text' field is required",
"param": "text",
"type": "validation_error"
}
}