POST /v1/guard is the only runtime endpoint. A collector
calls it to evaluate one request against the policy
it routes to. See How it works for the pipeline
behind it.
Authentication
The collector is resolved from the API key, so you don’t send a collector id
in the body. (When TrustGuard runs behind TrustGate, the
gateway authenticates and calls this endpoint for you.)
Request
| Field | Type | Required | Notes |
|---|
payload | object | ✅ | The content to inspect. Accepts a minimal { "input": "…" } or a full provider body (OpenAI, Anthropic, Gemini, MCP). payload.attachments is extracted separately (not sent to text detectors). |
direction | enum | — | input (default) or output. Selects which detector rules run. |
protocol | enum | — | all (default) · llm · mcp · a2a. Available as the protocol gate/rule condition. |
session_id | string | — | Conversation key for the multi‑turn detector. Synthesised if omitted (treated as single‑turn). |
consumer_id | string | — | Actor identifier — drives per‑consumer policy routing and anomaly_detector. |
attributes | object | — | Extra dimensions for gate/detector conditions: consumer.{name,tag,type}, model.{name,provider}, collector.type. |
Unknown top‑level fields are rejected with 400 (strict decoding). There is no
input, metadata, or collector_id field.
Callers that authenticate with a service token instead of an API key must
also send exactly one of gateway_id or collector_key to select the
collector. With a collector API key (the common case, and the focus of this
page) the collector comes from the key.
Attachments & SSRF
Each attachment in payload.attachments provides either base64 data
or a url:
- URL fetches are HTTPS‑only and bounded (timeout, size cap, redirect limit).
- A strict SSRF guard resolves DNS before dialing and rejects loopback,
private, link‑local, multicast, CGNAT (
100.64/10), 0.0.0.0/8, and
cloud‑metadata (169.254.169.254) targets.
- Attachment bytes are never persisted.
Response
Always 200 for a detection — TrustGuard never drops traffic.
| Field | Type | Notes |
|---|
status | enum | The reduced verdict: allow · report · transform · block, most restrictive wins. |
transformed_payload | object | null | The rewritten payload; null/absent unless a Transform rule (mutable detector) changed it. |
findings[] | array | One entry per gate or detector that fired. |
trace_id / request_id | string | Correlation IDs (also on logs and telemetry). |
The finding object
| Field | Type | Notes |
|---|
source.kind | enum | gate or detector. |
source.gate_name | string | Gate findings only. |
source.plugin | string | Detector findings — the catalog detector slug (e.g. prompt_guard). |
source.detector_id / source.detector_name | string | The detector instance that fired. |
source.policy_id | string | The policy that produced the finding. |
signal.type | string | What was detected — e.g. jailbreak, pii, secret, code_injection, anomaly, multiturn_attack, a toxicity category, or gate_block / gate_report. |
signal.confidence | number | Detector‑specific score in [0, 1] (optional). |
outcome.action | enum | report, transform, or block — the action the rule applied (optional on observational runs). |
evidence | object | Free‑form, detector‑specific context (e.g. matched entities, masked count, matched rule). |
Status codes
| Code | When |
|---|
200 | Always, for any detection — including a block status. The caller enforces. |
400 | Invalid body, unknown fields, bad direction/protocol, or a bad collector reference. |
401 | Missing or invalid API key. |
403 | Key found but inactive/expired. |
500 | A detector errored and the deployment is fail‑closed. With fail‑open you get 200. |
Error responses carry { "error", "trace_id", "request_id" }.
Enforcing the verdict
TrustGuard is advisory. Your collector inspects the status and decides:
When TrustGuard runs behind TrustGate, the gateway
performs this enforcement for you.