Multilingual PII detection. Single endpoint, JSON response.
POST /api/detect
POST /api/detect
Content-Type: application/json
{
"text": "John Doe lives at 123 Main St, NRIC S1234567A",
"labels": null,
"boost": ["government_id", "street_address"]
}
| Field | Type | Default | Description |
|---|---|---|---|
text | string | required | Text to analyze |
labels | string[] | null | Entity types to detect (null = auto-select all) |
boost | string[] | [] | Labels to boost for higher accuracy (adds latency per label) |
{
"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"
}
| Field | Description |
|---|---|
entities | Array of detected PII entities with type, value, span, score |
redacted | Text with high-confidence PII replaced by [LABEL] tags |
original | Original input text |
needs_review | true if entity score is below auto-redact threshold |
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.
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}, ...]
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 -X POST https://pii.engineer/api/detect \
-H "Content-Type: application/json" \
-d '{"text": "My name is Ahmad, IC T1234567G", "boost": ["government_id"]}'