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.
Endpoint:
POST /v1/alGuardrail/detect
Request Body:
{
"text": "جوالي 0551234567 وايميلي sara@example.sa",
"mode": "redact"
}
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
text | string | Yes | Arabic, English or mixed text, of any length. |
mode | string | No | detect (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. |
threshold | number | No | Drop spans whose confidence is below this value, from 0 to 1. |
custom_labels | array | No | Up 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:
| Name | Description |
|---|---|
spans | Each span has label, text, start and end (its character offsets in text) and confidence. |
output | Present in the redact and tokenize modes; the text after processing. |
tokens | Present in the tokenize mode; maps each <LABEL_N> token to its original value. |
latency_ms | The 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.
| 401 | The key is missing, invalid or expired. |
| 402 | The account has no requests left. |
| 403 | The key does not have the alguardrail scope, or the account is not active. |
| 413 | The request body is larger than 1 MiB. |
| 429 | Rate 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. |
| 502 | The detection service could not be reached. |
Ready to Get Started?
Generate an API key from your dashboard and start building