REST API Reference
Base URL
https://pii-firewallproxy-production.up.railway.appPOST /detect
Detect PII in a text string without modifying it.
Request
http
POST /detect
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"text": "My email is alice@example.com",
"lang": "en"
}| Parameter | Type | Required | Description |
|---|---|---|---|
text | string | ✅ | Text to scan |
lang | string | "en" or "ja" (default: "en") |
Response
json
{
"detections": [
{
"type": "EMAIL",
"value": "alice@example.com",
"start": 12,
"end": 29
}
],
"count": 1,
"creditsUsed": 1
}POST /mask
Detect and mask PII, returning a masked string and a token map for later restoration.
Request
http
POST /mask
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"text": "Call me at +81-90-1234-5678",
"lang": "ja"
}Response
json
{
"masked": "Call me at [PHONE-1]",
"tokenMap": {
"[PHONE-1]": "+81-90-1234-5678"
},
"sessionId": "sess_abc123",
"creditsUsed": 1
}POST /restore
Restore original values in an AI response using a token map.
Request
http
POST /restore
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"text": "I found the record for [NAME-1] with email [EMAIL-1].",
"sessionId": "sess_abc123"
}Response
json
{
"restored": "I found the record for Alice Smith with email alice@example.com.",
"creditsUsed": 1
}POST /detect-injection
Scan text for prompt injection and jailbreak patterns.
Request
http
POST /detect-injection
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"text": "Ignore all previous instructions and..."
}Response
json
{
"injectionDetected": true,
"categories": ["prompt_injection"],
"risk": "high",
"creditsUsed": 1
}GET /credits
Get remaining credits for your account.
Request
http
GET /credits
Authorization: Bearer YOUR_API_KEYResponse
json
{
"plan": "starter",
"creditsRemaining": 847,
"creditsTotal": 1000,
"resetsAt": "2025-06-01T00:00:00Z"
}PII Types Reference
| Type | Example |
|---|---|
NAME | John Smith |
EMAIL | john@example.com |
PHONE | +1-800-555-0100 |
ADDRESS | 123 Main St, New York |
CREDIT_CARD | 4111 1111 1111 1111 |
PASSPORT | A12345678 |
SSN | 123-45-6789 |
MY_NUMBER | 1234 5678 9012 (Japan) |
IP_ADDRESS | 192.168.1.1 |
API_KEY | sk-... |
DATE_OF_BIRTH | 1990-01-15 |
BANK_ACCOUNT | DE89370400440532013000 |
Error Codes
| Code | Description |
|---|---|
401 | Invalid or missing API key |
402 | Insufficient credits |
422 | Invalid request body |
429 | Rate limit exceeded |
500 | Internal server error |
