← Back to app

PII Engineer API

Multilingual PII detection. Single endpoint, JSON response.

Endpoint

POST /api/detect

Request

POST /api/detect
Content-Type: application/json

{
  "text": "John Doe lives at 123 Main St, NRIC S1234567A",
  "labels": null,
  "boost": ["government_id", "street_address"]
}
FieldTypeDefaultDescription
textstringrequiredText to analyze
labelsstring[]nullEntity types to detect (null = auto-select all)
booststring[][]Labels to boost for higher accuracy (adds latency per label)

Supported Labels

person_name
phone_number
government_id
street_address
date_of_birth
email_address
passport_number
license_plate
bank_account_number

Response

{
  "entities": [
    {
      "type": "person_name",
      "value": "John Doe",
      "start": 0,
      "end": 8,
      "score": 0.99,
      "needs_review": false
    },
    {
      "type": "government_id",
      "value": "S1234567A",
      "start": 15,
      "end": 24,
      "score": 0.98,
      "needs_review": false
    }
  ],
  "redacted": "[PERSON_NAME], NRIC [GOVERNMENT_ID]",
  "original": "John Doe, NRIC S1234567A"
}
FieldDescription
entitiesArray of detected PII entities with type, value, span, score
redactedText with high-confidence PII replaced by [LABEL] tags
originalOriginal input text
needs_reviewtrue if entity score is below auto-redact threshold

Accuracy Booster

The boost parameter enables deeper detection for selected labels at the cost of additional latency (~30ms per label).

Recommended defaults: government_id and street_address — these benefit most from boosting due to varied formats across countries.

Examples

JavaScript

const r = await fetch("https://pii.engineer/api/detect", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    text: "John Doe, phone 0123456789",
    boost: ["government_id", "street_address"],
  }),
});
const data = await r.json();
console.log(data.redacted);   // "[PERSON_NAME], phone [PHONE_NUMBER]"
console.log(data.entities);   // [{type, value, start, end, score}, ...]

Python

import requests

r = requests.post(
    "https://pii.engineer/api/detect",
    json={
        "text": "John Doe, NRIC S1234567A",
        "boost": ["government_id"],
    },
)
data = r.json()
print(data["redacted"])   # [PERSON_NAME], NRIC [GOVERNMENT_ID]
print(data["entities"])   # [{type, value, start, end, score}, ...]

cURL

curl -X POST https://pii.engineer/api/detect \
  -H "Content-Type: application/json" \
  -d '{"text": "My name is Ahmad, IC T1234567G", "boost": ["government_id"]}'