Opami Protect API
Detect private and sensitive data in text with one API call. This page gets you to a first request.
1. Create a key
Sign in to the console, open API keys, and create a key. The secret starts with opk_ and is shown once. Copy it somewhere safe. Keep it out of source control.
2. Make a call
Replace $OPAMI_API_KEY with your key. The model field is required on every call.
curl
curl https://api-protect.opami.ai/v1/detect \
-H "Authorization: Bearer $OPAMI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"protect-v1","text":"Write to Zoë Müller at zoe@example.com."}'Python
import os
import requests
response = requests.post(
"https://api-protect.opami.ai/v1/detect",
headers={"Authorization": f"Bearer {os.environ['OPAMI_API_KEY']}"},
json={"model": "protect-v1", "text": "Write to Zoë Müller at zoe@example.com."},
timeout=35,
)
print(response.status_code, response.json())JavaScript
const response = await fetch("https://api-protect.opami.ai/v1/detect", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.OPAMI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ model: "protect-v1", text: "Write to Zoë Müller at zoe@example.com." }),
});
console.log(response.status, await response.json());3. Read the response
{
"request_id": "6f1c0a52-3c1e-4a53-9d1d-0a8f2e5b7c11",
"model": "protect-v1",
"detections": [
{ "text": "Zoë Müller", "type": "person.name.full", "start": 9, "end": 19 },
{ "text": "zoe@example.com", "type": "contact.email", "start": 23, "end": 38 }
],
"usage": { "characters": 39, "cost_eur": "0.00003900", "cost_usd": "0.00003900" }
}Each detection has the text found, its type, and where it sits in your text. An empty detections list means nothing was found. The values above are an illustration. See the API reference for every field, the limits and the errors.
protect-v1 is the current model and supports 52 languages.