Skip to main content
A
Docs

Guard API reference

Endpoints, request and response examples, and errors for the Guard API: evaluations, policies, personal data, audit, alerts and reports.

Authentication

Send a token as Authorization: Bearer <token>. Read API conventions.

Endpoints

MethodPathPurposeRole
POST/api/v1/governance/evaluateCheck content against all active policiesAny
GET/api/v1/policiesList policiesAny
POST/api/v1/policiesCreate a policyadmin
GET/api/v1/policies/statsPolicy statisticsAny
GET/api/v1/policies/{policy_id}Get a policyAny
PUT/api/v1/policies/{policy_id}Change a policyadmin
DELETE/api/v1/policies/{policy_id}Delete a policyadmin
POST/api/v1/policies/batch-deleteDelete more than one policyadmin
POST/api/v1/policies/batch-toggleTurn more than one policy on or offadmin
POST/api/v1/pii/detectFind personal data in textAny
POST/api/v1/pii/redactReplace personal data in text with labelsAny
POST/api/v1/pii/detect-batchFind personal data in more than one textAny
POST/api/v1/safety/checkClassify content with the content safety modelAny
POST/api/v1/proxy/chat/completionsSend a chat request through a safety check to the GatewayAny
GET/api/v1/monitoring/metricsCheck counts and ratesAny
GET/api/v1/monitoring/safety-metricsSafety check counts by categoryAny
GET/api/v1/monitoring/alertsList monitoring alertsAny
PUT/api/v1/monitoring/alerts/{alert_id}/resolveResolve a monitoring alertadmin
GET/api/v1/audit/trailRead the audit trailAny
GET/api/v1/audit/trail/exportExport the audit trail to CSVAny
GET/api/v1/compliance/reportCompliance summaryAny
GET/api/v1/compliance/reports/frameworksList the report frameworksAny
POST/api/v1/compliance/reports/generateMake a compliance reportAny
GET/api/v1/compliance/reportsList compliance reportsAny
GET/api/v1/compliance/reports/{report_id}Get a compliance reportAny
GET/api/v1/compliance/reports/{report_id}/exportExport a compliance reportAny
GET/api/v1/compliance/reports/{report_a_id}/diff/{report_b_id}Compare two reports for the same frameworkAny
POST/api/v1/alerts/rulesCreate an alert ruleadmin
GET/api/v1/alerts/rulesList alert rulesAny
PUT/api/v1/alerts/rules/{rule_id}Change an alert ruleadmin
DELETE/api/v1/alerts/rules/{rule_id}Delete an alert ruleadmin
GET/api/v1/alertsList alerts that rules raisedAny
POST/api/v1/alerts/{alert_id}/acknowledgeAcknowledge an alertAny
POST/api/v1/webhooksAdd a webhookadmin
GET/api/v1/webhooksList webhooksAny
DELETE/api/v1/webhooks/{webhook_id}Delete a webhookadmin
POST/api/v1/webhooks/{webhook_id}/testSend a test event to a webhookadmin
GET/api/v1/healthHealth checkNone

Check content

curl https://guard.example.gov/api/v1/governance/evaluate \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"content": "My Emirates ID is 784-1990-1234567-1", "user_id": "u-102", "model": "provider/your-model"}'
FieldTypeRequiredMeaning
contentstringYesThe text to check. Up to 100,000 characters.
user_idstringNoThe user, for the audit trail
modelstringNoThe model, for the audit trail
contextstringNoOther text about the request

Response

{
  "allowed": true,
  "action": "pass",
  "violations": [],
  "pii_detected": [
    {"type": "NATIONAL_ID", "value": "784-1990-1234567-1", "start": 18, "end": 36}
  ],
  "content_score": 0.0,
  "redacted_content": "My Emirates ID is [REDACTED_NATIONAL_ID]"
}
FieldMeaning
allowedfalse when the action is block
actionpass, log, warn or block
violationsThe policies that matched, with the reason
pii_detectedThe personal data found, with its position
redacted_contentThe content with personal data replaced. null when Guard finds no personal data.

Create a policy

rule_config is a JSON string. A keyword rule needs a keywords list. A regex rule needs a patterns list.

curl https://guard.example.gov/api/v1/policies \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Block classified markings",
    "rule_type": "keyword",
    "rule_config": "{\"keywords\": [\"سري للغاية\", \"top secret\"]}",
    "action": "block",
    "is_active": true
  }'

Guard refuses a rule with an empty list or a pattern that is not valid. The response is 422 with the reason.

Errors

StatusCause
403Your role cannot change policies, alert rules or webhooks
422A field or a rule is not valid
503The content safety model is not available