Docs/API Reference/Response Schema

Response Schema

Anatomy of the JSON object returned by every successful HTTP 200 response.

Full Response Example

json
{
  "risk_score": 85,
  "status": "rejected",
  "flags": [
    "PII detected: Full name identified",
    "PII detected: Credit card number suffix",
    "Financial commitment: unauthorized refund amount mentioned"
  ],
  "redacted_text": "Dear ****, your card ending in **** has been refunded $***."
}

Field Definitions

risk_scoreinteger0 – 100

Composite safety score. 0 means completely safe, 100 means maximum risk. Computed across all active detection modules. Any score above 70 triggers a "rejected" status.

statusstringapproved | flagged | rejected

"approved" = score 0–30. "flagged" = score 31–69 (monitor, may want to block). "rejected" = score 70–100 (strongly block). Use this field for simple allow/block logic.

flagsstring[]Array of strings

Human-readable explanation strings, one per violation detected. Empty array [] when no violations are found. Each flag identifies the specific rule that was violated.

redacted_textstringString

The original proposed_text with all sensitive fields replaced by **** placeholders. Safe to store in logs, display in admin UIs, or pass to downstream analytics.

Recommended Integration Pattern

python
result = call_guardrail(text)

if result["status"] == "approved":
    # Safe — deliver to user as-is
    deliver(result["redacted_text"])
    
elif result["status"] == "flagged":
    # Suspicious — log for review, optionally deliver with warning
    log_for_review(result)
    deliver_with_warning(result["redacted_text"])
    
elif result["status"] == "rejected":
    # Dangerous — block delivery, serve fallback
    deliver("I'm sorry, I cannot provide that information.")
    alert_team(result["flags"])