When to use it
Pick the API surface when the workload fits one of these shapes:- Backend jobs that already know what prompt they are about to send to an LLM and can pay the cost of one extra HTTP round trip.
- Batch processing over documents, transcripts, or datasets — score each item against the policy catalog before storing or passing it downstream.
- Internal tools that call LLMs but live in a network where a proxy cannot be inserted, or where the team owning the tool prefers explicit calls to implicit interception.
- Second-opinion checks — you already have another surface in the path, and you want the backend to call the API for an extra policy evaluation on a specific step.
Creating an API engine
The API surface is provisioned as an Integration in the platform — the same pattern as the Gateway. Each integration creates an API engine with its own compute, endpoint, and API keys.- Go to Integrations → Add Integration.
- Pick API from the provider catalog.
- Fill the form:
- Integration Name — any label you’ll recognise later (for example
prod-actions,batch-eu). - Deployment Type — choose one:
- Serverless — an instantly-ready engine for learning and development.
- Dedicated — a scalable production engine with effortless deployment.
- Tags (optional) — comma-separated labels usable later for policy scoping.
- Integration Name — any label you’ll recognise later (for example
- Save & Close.
Where → API when writing a policy.
API keys
API keys are scoped to the engine, not to the workspace. Each integration issues its own set of keys from the integration’s detail page, and a key is only accepted by the engine that created it. This is the same model the Gateway uses, and it gives you:- Per-engine revocation — rotating keys for one environment doesn’t affect the others.
- Per-engine audit — every event is unambiguously attributable to the engine it came from.
- Per-engine quotas — rate limits and usage caps are applied independently.
Authorization: Bearer … on every call.
How to integrate
The API surface is a single call your backend makes before (and optionally after) it calls the upstream LLM. The integration is code-only.1. Collect the engine coordinates
From the API integration’s page, copy two values:- Endpoint — the engine’s base URL (the Actions API is exposed under it).
- API key — generated under the engine’s API Keys tab.
2. Wrap the LLM call
The canonical integration shape is a three-step wrapper around the upstream LLM call:- Call TrustGate with the request content.
- If the decision is
block, stop. Ifmask, use the returnedpayloadinstead of the original. Otherwise continue. - (Optional) Call TrustGate again with the response for a second-pass check before handing the result back to the user.
response stage — pass stage: "response" and the model output in payload.
3. Honor the decision
The caller is contractually responsible for acting ondecision:
allow/log→ call the upstream with the original payload.mask→ call the upstream with the returnedpayload.block→ do not call the upstream; surface thereasonto the user or fail the job.
4. Batch and parallel calls
For batch jobs, the same endpoint accepts arrays and is safe to call concurrently. Rate limits and quotas are enforced per engine API key — see the Actions API reference for current limits.5. Verify
After integrating, every call shows up in Runtime → Logs with theapplication, use_case, and user you passed, correlated with the engine it came through.
For the full reference — endpoints, payload shapes, streaming, idempotency, and language-specific SDKs — see the Actions API section.
What it sees
Whatever the caller sends. Typical payloads include:- Prompts — the user message, system prompt, and conversation history before the LLM call.
- Responses — the model output after the LLM call (for a second pass on the response).
- Documents — uploaded files, extracted text, OCR output.
- Tool-call payloads —
tools[]andtool_callsif the backend wants per-step governance. - Arbitrary context — user identity, use case name, tenant, custom tags.
How enforcement works
The three action verbs translate into contract behavior the caller must honor:| Action | API behavior | What the caller must do |
|---|---|---|
Log | Returns decision: "log" (or "allow") with evidence. | Proceed with the original payload; the event is already recorded server-side. |
Mask | Returns decision: "mask" and a rewritten payload. | Use the returned payload instead of the original for the upstream LLM call. |
Block | Returns decision: "block" with a reason. | Do not call the upstream. Surface the reason to the user or fail the job. |
- The decision and its payload signature are logged, so non-compliance is auditable.
- For regulated workloads, policy authors use the Gateway or Endpoint surface instead, where enforcement is inline.
Available filters
When authoring a policy withWhere → API, Add filter offers:
| Filter | Narrows by |
|---|---|
| Engines | Specific API integrations (for example prod-actions, batch-eu). |
| Tags | Any tag attached to an engine at creation time. |
| Use Cases | Business-level groupings shared across surfaces. |
When conditions.
Best for
- Backend integrations and batch jobs that can’t be put behind a proxy.
- Workflows where explicit policy checks in code are preferred over transparent interception.
- Pairing with other surfaces as a second-line or step-level check.
Related
- Policies — the
Where / When / Thenmodel that runs behind the API. - Gateway surface — inline alternative when the workload can be proxied.
- Developers reference — the Actions API endpoints, request and response shapes, and authentication.