Skip to main content
The Scan API is the explicit integration mode. You make one call before sending a prompt to the model and one call after the response comes back. Useful when you don’t want to put a proxy in the chat hot path, or when you’re scanning text that isn’t going to an LLM at all (batch pipelines, document ingestion, knowledge‑base curation). All scan endpoints return HTTP 200 with a JSON body even when the verdict is block. The verdict lives in the body so your code can read the reason and act accordingly. Non‑200 codes are reserved for protocol failures (auth, rate limit, quota).

POST /api/runtime-security/scan/input

Scan a user prompt before forwarding it to your LLM.

Request

Response

verdict is one of allow / flag / redact / block. See Verdicts for the full decision logic, including when an uncorroborated high injection score or a monitor‑mode NER finding produces flag instead of allow. Rate limit: 20 requests / second / workspace.

POST /api/runtime-security/scan/output

Scan an LLM response before returning it to the user.

Request

Response

Same ScanResponse shape as /scan/input. The output threat model is leakage and jailbreak success indicators, distinct from the input model. Configure separate thresholds via output_block_threshold and output_redact_threshold in the App config. Rate limit: 20 requests / second / workspace.

POST /api/runtime-security/scan/batch

Score up to 32 items in one call. Each item still consumes one license call, but you save the HTTP overhead and the warm classifier amortises across the batch.

Request

Response

Rate limit: 4 requests / second / workspace. Each batch consumes len(items) license calls; if the workspace runs out of quota mid‑batch, the whole call returns 402 before any scoring runs.

The ScanResponse schema

Every scan call returns the same shape.
A finding sourced from the NER tier carries extra: {"detector": "ner_gliner2", "model": "fastino/gliner2-privacy-filter-PII-multi", "action": "flag" | "redact"}. action mirrors the App’s ner.mode and tells you whether this particular finding contributed to redaction or was recorded in monitor‑only mode. See NER PII detection.

Wrapping it around your model

The minimal integration: scan input, call your model, scan output.
See SDK examples for Node, curl, LangChain, and LlamaIndex variants.

When to prefer the Scan API over the proxy

  • You don’t want the firewall in the chat request path.
  • You’re scanning text that isn’t going to an LLM at all.
  • You’re processing a large batch (/scan/batch is the right tool).
  • You’re wiring custom middleware in a language without a maintained OpenAI / Anthropic SDK.
For chat traffic that does go to a standard SDK, the reverse proxy is faster to set up and harder to bypass.