POST
/v1/guardrail/check
The primary guardrail evaluation endpoint. Submit an AI agent's proposed output for analysis. Returns a complete risk assessment including a numeric score, violation flags, and a redacted version of the text.
Base URL
https://llmfence.vercel.appFull Endpoint
POST /v1/guardrail/checkAuthentication
All requests must include your API key as a Bearer token in the Authorization header.
header
Authorization: Bearer sk_your_api_key_here⚠️ Never expose your API key in client-side code, public repositories, or logs. Treat it like a password.
Request Body
Send a JSON body with Content-Type: application/json.
| Parameter | Type | Description |
|---|---|---|
agent_id | string | A label for the agent making the call, stored against the request so you can see which of your agents produced a verdict. 1-128 characters of A-Z a-z 0-9 _ . -, and never used for authorisation. |
proposed_textrequired | string | The raw text generated by your AI agent that needs to be evaluated. Maximum payload size is 32KB per request. |
json (request body)
{
"agent_id": "customer-support-v2",
"proposed_text": "Based on your account, I can offer you a full $500 refund immediately."
}Response Schema
On success, the API returns HTTP 200 with the following JSON body.
| Field | Type | Description |
|---|---|---|
risk_score | integer | 0–100. Composite danger score. 0 = completely safe. 100 = maximum risk. Evaluated across all active detection modules. |
status | string | One of: `approved` (score 0–30), `flagged` (score 31–69), or `rejected` (score 70–100). Use this for simple allow/block logic. |
flags | string[] | Array of human-readable explanation strings. One entry per violation detected. Empty array if no violations found. |
redacted_text | string | The original proposed_text with all sensitive data replaced by anonymized placeholders. Safe to log, store, and display. |
json (response)
{
"risk_score": 72,
"status": "rejected",
"flags": [
"Financial commitment: unauthorized refund of $500 mentioned",
"Brand safety: language may create false expectations with customer"
],
"redacted_text": "Based on your account, I can offer you a full $*** refund immediately."
}HTTP Error Codes
| Code | Status | Cause |
|---|---|---|
| 200 | OK | Evaluated. Read status and risk_score from the body; X-LLMFence-Source names which stage answered. |
| 400 | Bad Request | The request body is not valid JSON. |
| 401 | Unauthorized | The API key is missing, invalid or revoked. Revoked and never-existed are deliberately indistinguishable. |
| 402 | Payment Required | Your included calls are exhausted on a plan that stops, or your monthly spend cap has been reached. The key is fine. |
| 403 | Forbidden | The account is suspended. |
| 413 | Payload Too Large | proposed_text exceeds your plan's maximum request size. |
| 422 | Unprocessable Entity | proposed_text is missing or empty, or agent_id is not 1-128 characters of [A-Za-z0-9_.-]. |
| 429 | Too Many Requests | The per-minute ceiling for your plan. Retry-After gives the seconds until the window resets. Not counted or charged. |
| 503 | Service Unavailable | Authorisation could not be completed. The API fails closed rather than serving an unauthenticated request. |