BETA

alGuardrail

One endpoint: send text and get back the personal data in it, or the same text with that data redacted. Use an API key with the alguardrail scope; each call counts as one request.

Path
/v1/alGuardrail
Key scope
alguardrail

POSTDetect Personal Data

Detect

Find personal data in Arabic, English or mixed text.

POST

Endpoint:

POST /v1/alGuardrail/detect

Request Body:

{
  "text": "جوالي 0551234567 وايميلي sara@example.sa",
  "mode": "redact"
}

Parameters:

NameTypeRequiredDescription
textstringYesArabic, English or mixed text, of any length.
modestringNodetect (default) returns the spans only. redact adds output, with every span replaced by [REDACTED]. tokenize adds output with <LABEL_N> tokens and a tokens map, to put the original values back after the model call.
thresholdnumberNoDrop spans whose confidence is below this value, from 0 to 1.
custom_labelsarrayNoUp to three extra labels, each with a short description, with no retraining.

Response (200 OK):

{
  "text": "جوالي 0551234567 وايميلي sara@example.sa",
  "spans": [
    {"label": "phone number", "text": "0551234567", "start": 6, "end": 16, "confidence": 1.0},
    {"label": "email", "text": "sara@example.sa", "start": 25, "end": 40, "confidence": 1.0}
  ],
  "output": "جوالي [REDACTED] وايميلي [REDACTED]",
  "latency_ms": 1467.4
}

Response fields:

NameDescription
spansEach span has label, text, start and end (its character offsets in text) and confidence.
outputPresent in the redact and tokenize modes; the text after processing.
tokensPresent in the tokenize mode; maps each <LABEL_N> token to its original value.
latency_msThe model's processing time for this request.

Code Examples:

curl -s -X POST "https://alapi.deep.sa/v1/alGuardrail/detect" \
  -H "Authorization: Bearer $ALAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "جوالي 0551234567 وايميلي sara@example.sa", "mode": "redact"}'

Errors:

Errors are returned as JSON with a message in the error field. Usage limits follow the key's settings.

401The key is missing, invalid or expired.
402The account has no requests left.
403The key does not have the alguardrail scope, or the account is not active.
413The request body is larger than 1 MiB.
429Rate limit or daily limit exceeded. See the Retry-After and X-RateLimit-Remaining headers; the body's code field is rate_limited or daily_limit_exceeded.
502The detection service could not be reached.

Ready to Get Started?

Generate an API key from your dashboard and start building

Activate account?

Activate this account?