Skip to main content
POST
/
v1
/
guard
Evaluate and Protect
curl --request POST \
  --url https://api.guardion.ai/v1/guard \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "messages": [
    {
      "role": "user",
      "content": "<string>"
    }
  ],
  "application": "<string>",
  "policy": "<string>",
  "session": "<string>",
  "metadata": {},
  "fail_fast": false,
  "breakdown_all": false
}
'
{
  "time": 123,
  "created": 123,
  "flagged": true,
  "id": "<string>",
  "breakdown": [
    {
      "policy_id": "<string>",
      "detector": "<string>",
      "detected": true,
      "threshold": 123,
      "score": 123,
      "result": [
        {}
      ]
    }
  ],
  "correction": {
    "choices": [
      {
        "role": "user",
        "content": "<string>"
      }
    ]
  }
}

Authorizations

Authorization
string
header
required

Use your Guardion API Key as a Bearer token.

Body

application/json
messages
object[]
required
application
string

The unique ID of the application calling the API.

policy
string

Specific policy ID to enforce. Defaults to application global policy if null.

session
string

A unique identifier to track conversations across multiple turns.

metadata
object

Key-value pairs for custom filtering in the dashboard.

fail_fast
boolean
default:false

If true, stops processing and returns immediately after the first policy violation.

breakdown_all
boolean
default:false

If true, returns details for all detectors, including those that did not flag.

Response

200 - application/json

Evaluation complete. Returns flagged status and corrections.

time
number
required

Processing time in milliseconds.

created
integer
required

Unix timestamp of evaluation.

flagged
boolean
required

True if any policy violation was detected.

id
string
breakdown
object[]
correction
object