POST /v1/evaluate. This page
explains what happens between the request and the verdict.
1. Authenticate and resolve the collector
The caller sendsAuthorization: Bearer <api-key>. TrustGuard verifies the key,
checks it is active and not expired, and resolves the
collector it belongs to. The collector is
never sent in the request body — it comes from the key.
A missing or invalid key returns 401; an inactive/expired key is rejected
before any evaluation runs.
2. Resolve the policy
TrustGuard picks the policy for this request:- if the request’s
consumer_idhas a per‑consumer policy, use it; - otherwise use the collector’s default policy.
status: "allow" with no findings. The policy’s Enforcement mode
(Report vs Enforce) is read here — in Report mode every action below is
downgraded to a non‑blocking record.
3. Run gates
Gates are evaluated before any detector. Each gate matches request attributes (consumer, model, collector, protocol, session) and takes an action:
All gates are evaluated and the most restrictive outcome wins.
4. Run the detector rules
For the request’sdirection (input or output), TrustGuard runs the
policy’s matching detector rules — the same Input / Output phases
you configure on the policy. Rules are filtered
by direction and by their optional conditions, then split by capability:
The caller supplies direction on /v1/evaluate.
TrustGate sets it from the request/response
stage; application and other collectors
must set it explicitly (default input if omitted).
Each rule’s action — Monitor (
report), Block, or Transform — sets
the outcome.action on the findings it produces. A block rule also stops the
remaining detector chain.
File attachments (payload.attachments) are decoded once and shared with the
detectors that consume them (doc_analyzer, url_analyzer). Remote attachment
URLs are fetched server‑side under a strict SSRF guard (HTTPS only; loopback,
private, link‑local, CGNAT, and cloud‑metadata addresses blocked) and are
never stored.
5. Reduce to a status
Everything that fired is reduced to one top‑levelstatus, most to least
restrictive:
report.
6. The response
A detection is always
HTTP 200 — including a block status. Your
integration acts on status / findings; it never relies on TrustGuard to
reject the request.
Failure behavior
If a detector hits an infrastructure error (an upstream provider is down, a timeout, etc.), behavior follows your deployment’s fail‑open / fail‑closed setting:- Fail‑open — TrustGuard drops that detector’s result and the request still succeeds, so a TrustGuard issue never breaks your traffic.
- Fail‑closed — the request returns
500so the caller can decide to hold traffic.