Guard Content
Scan messages for security threats without proxying to an LLM.
This is the primary endpoint for auto-instrumentation and framework callback integrations. It runs the same policy engine, ML ensemble, preset configuration, custom rules, and entitlements checks as the proxy pipeline.
Use direction="input" before sending messages to the LLM and
direction="output" after receiving a response.
Returns a decision of allow, block, or redact along with
detailed threat information and optional redacted messages.
Authorizations
PromptGuard API key for developer endpoints. Keys start with pg_live_ and are created in the dashboard.
Headers
Body
Request body for the guard endpoint.
Messages to scan (OpenAI-style message array)
1 - 512 elementsScan direction: 'input' (pre-LLM) or 'output' (post-LLM)
^(input|output)$Model being used (for logging)
Optional framework context
RAG-retrieved documents to scan for knowledge poisoning. Each document is scanned individually; the first poisoned one blocks the request, and its position and source are returned in the event metadata so you know which document to drop. Scanning stops at that point, so a request with several poisoned documents reports the first. Optional; backwards-compatible.
32Media attachments to scan for steganographic payloads, adversarial patches, and font injection. Optional.
8Response
Successful Response
Response from the guard endpoint.
Policy decision: 'allow', 'block', or 'redact'
Unique event identifier for tracking
Confidence score of the decision
Processing time in milliseconds
Aggregate decision-driving score (severity * confidence, clamped to [0, 1]) when a severity-carrying detector decided the verdict; null otherwise. Raw confidence stays in the confidence field.
Primary threat type detected
Redacted messages (only present when decision='redact'). Always the TEXT projection: a message sent as content blocks comes back as a string. Attachments are never rewritten — we do not re-encode a PDF with the secret removed, and returning one that looked redacted would be worse than returning none.
Detailed threat breakdown
Parts that reached us and produced nothing to scan. An allow with a non-empty unscanned is NOT 'this content is clean' — it is 'the text was clean and these parts were never read'. Reasons: url_only (we do not fetch caller-supplied URLs, that would be an SSRF primitive), file_id_unsupported, encrypted, no_text_extracted (a scanned/rasterised document), too_large, undecodable, unsupported_type, extractor_unavailable, unsupported_block, unsupported_tool_call (an entry in context.tool_calls in none of the shapes we can read — index is its position in that list).