Skip to main content
Every inspection goes through one runtime endpoint, POST /v1/evaluate. This page explains what happens between the request and the verdict.

1. Authenticate and resolve the collector

The caller sends Authorization: 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_id has a per‑consumer policy, use it;
  • otherwise use the collector’s default policy.
If the collector has no matching policy, the request is unguarded: TrustGuard returns 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’s direction (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‑level status, most to least restrictive:
In Report mode, blocks and transforms are downgraded, so the status never exceeds 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 500 so the caller can decide to hold traffic.
A structured block decision (from a gate or a Block rule) always applies regardless of this setting. The default is configured per deployment — ask NeuralTrust which mode your environment uses.