Skip to main content
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

FieldTypeRequiredNotes
payloadobjectThe 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).
directionenuminput (default) or output. Selects which detector rules run.
protocolenumall (default) · llm · mcp · a2a. Available as the protocol gate/rule condition.
session_idstringConversation key for the multi‑turn detector. Synthesised if omitted (treated as single‑turn).
consumer_idstringActor identifier — drives per‑consumer policy routing and anomaly_detector.
attributesobjectExtra 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.
FieldTypeNotes
statusenumThe reduced verdict: allow · report · transform · block, most restrictive wins.
transformed_payloadobject | nullThe rewritten payload; null/absent unless a Transform rule (mutable detector) changed it.
findings[]arrayOne entry per gate or detector that fired.
trace_id / request_idstringCorrelation IDs (also on logs and telemetry).

The finding object

FieldTypeNotes
source.kindenumgate or detector.
source.gate_namestringGate findings only.
source.pluginstringDetector findings — the catalog detector slug (e.g. prompt_guard).
source.detector_id / source.detector_namestringThe detector instance that fired.
source.policy_idstringThe policy that produced the finding.
signal.typestringWhat was detected — e.g. jailbreak, pii, secret, code_injection, anomaly, multiturn_attack, a toxicity category, or gate_block / gate_report.
signal.confidencenumberDetector‑specific score in [0, 1] (optional).
outcome.actionenumreport, transform, or block — the action the rule applied (optional on observational runs).
evidenceobjectFree‑form, detector‑specific context (e.g. matched entities, masked count, matched rule).

Status codes

CodeWhen
200Always, for any detection — including a block status. The caller enforces.
400Invalid body, unknown fields, bad direction/protocol, or a bad collector reference.
401Missing or invalid API key.
403Key found but inactive/expired.
500A 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.