Skip to content

REST API Reference

Base URL

https://pii-firewallproxy-production.up.railway.app

POST /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"
}
ParameterTypeRequiredDescription
textstringText to scan
langstring"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_KEY

Response

json
{
  "plan": "starter",
  "creditsRemaining": 847,
  "creditsTotal": 1000,
  "resetsAt": "2025-06-01T00:00:00Z"
}

PII Types Reference

TypeExample
NAMEJohn Smith
EMAILjohn@example.com
PHONE+1-800-555-0100
ADDRESS123 Main St, New York
CREDIT_CARD4111 1111 1111 1111
PASSPORTA12345678
SSN123-45-6789
MY_NUMBER1234 5678 9012 (Japan)
IP_ADDRESS192.168.1.1
API_KEYsk-...
DATE_OF_BIRTH1990-01-15
BANK_ACCOUNTDE89370400440532013000

Error Codes

CodeDescription
401Invalid or missing API key
402Insufficient credits
422Invalid request body
429Rate limit exceeded
500Internal server error

Privacy by Design.