POST /v1/guard. 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:| Gate action | Effect |
|---|---|
| Block | The request is blocked and detectors are skipped. Returns status: "block". |
| Report | Records a finding and continues to detection. |
| Skip | Stops gate evaluation and proceeds to detection — no finding. |
4. Run the detector rules
For the request’sdirection (input or output), TrustGuard runs the
policy’s matching detector rules. Rules are filtered by direction and by
their optional conditions, then split by capability:
| Phase | Detectors | Execution |
|---|---|---|
| Detect | Every detection‑only detector | Run concurrently; results merged deterministically. They read the payload but never modify it. |
| Transform | Mutable detectors (today data_loss_prevention) | Run sequentially after detection. With the Transform action they rewrite the payload, producing transformed_payload. |
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
| Field | Meaning |
|---|---|
status | allow · report · transform · block — the reduced verdict. Advisory: the caller enforces. |
transformed_payload | The rewritten payload, or absent/null if no Transform rule changed anything. |
findings[] | One entry per gate or detector that fired. See the Guard API for the full shape. |
trace_id / request_id | Correlation IDs propagated through logs and telemetry. |
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.