-
Notifications
You must be signed in to change notification settings - Fork 0
Quick Start
Get started with Masker API in 5 minutes.
Request:
curl -X POST "https://masker.kikuai.dev/v1/redact" \
-H "Content-Type: application/json" \
-d '{
"text": "Contact John Doe at john@example.com or call 555-123-4567",
"mode": "placeholder"
}'Response:
{
"redacted_text": "Contact <PERSON> at <EMAIL> or call <PHONE>",
"redacted_json": null,
"items": [
{
"entity_type": "PERSON",
"start": 8,
"end": 16,
"score": 0.85
},
{
"entity_type": "EMAIL",
"start": 20,
"end": 36,
"score": 1.0
},
{
"entity_type": "PHONE",
"start": 45,
"end": 57,
"score": 1.0
}
],
"processing_time_ms": 15.29
}import requests
from openai import OpenAI
# Step 1: Redact PII
masker_url = "https://masker.kikuai.dev/v1/redact"
response = requests.post(
masker_url,
json={"text": user_message, "mode": "placeholder"}
)
safe_message = response.json()["redacted_text"]
# Step 2: Send to ChatGPT
client = OpenAI()
chat_response = client.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": safe_message}]
)import requests
data = {
"json": {
"user": {
"name": "John Doe",
"email": "john@example.com",
"phone": "555-123-4567"
}
},
"mode": "placeholder"
}
response = requests.post(
"https://masker.kikuai.dev/v1/redact",
json=data
)
cleaned_data = response.json()["redacted_json"]
# Result: {"user": {"name": "<PERSON>", "email": "<EMAIL>", "phone": "<PHONE>"}}Replaces PII with ***
{
"text": "Contact john@example.com",
"mode": "mask"
}Result: "Contact ***"
Replaces PII with type placeholders like <EMAIL>, <PERSON>, etc.
{
"text": "Contact john@example.com",
"mode": "placeholder"
}Result: "Contact <EMAIL>"
Only redact specific PII types:
{
"text": "John Doe's email is john@example.com and phone is 555-123-4567",
"mode": "placeholder",
"entities": ["EMAIL", "PHONE"]
}Result: "<PERSON>'s email is <EMAIL> and phone is <PHONE>"
Note: PERSON is not redacted because it's not in the entities filter.
| Type | Description | Example |
|---|---|---|
| Email addresses | john@example.com |
|
| PHONE | Phone numbers | +1-555-123-4567 |
| CARD | Credit card numbers | 4111-1111-1111-1111 |
| PERSON | Person names | John Doe |
Default language is English. For Russian text:
{
"text": "Иван Иванов, email: ivan@example.com",
"language": "ru"
}Average processing time: 15-25ms
Check processing_time_ms in the response for actual time.
Q: What's the maximum request size?
A: 64KB for the entire JSON payload, 32KB for text field.
Q: Is my data stored?
A: No. Masker is completely stateless - no data is stored or logged. Your data is processed in-memory and immediately discarded.
Q: Can I use this for production?
A: Yes! The API is production-ready.
Q: What happens if I exceed rate limits?
A: You'll receive a 429 Too Many Requests error. Wait a minute and try again.
- API Documentation: https://masker.kikuai.dev/docs
- GitHub: https://github.com/KikuAI-Lab/masker
- Wiki: https://github.com/KikuAI-Lab/masker/wiki
Ready to start? Make your first request! 🚀