Guard API
The Guard API lets you scan arbitrary text for prompt injection, jailbreak attempts, PII leaks, and other threats without forwarding anything to an LLM provider. Use it when you want fine-grained control over when and how security checks run.This is the same detection engine used by the proxy and auto-instrumentation SDKs. The Guard API simply exposes it as a standalone endpoint.
Endpoint
Authentication
Request Body
GuardMessage
GuardContext (optional)
Response
ThreatDetail
Attachments
Attachments are extracted to text and run through the same detectors as typed text. An injection in a PDF’s body copy, in its/Subject metadata, in a
screenshot, or spoken in an audio clip is an injection.
Two ways to send them, and you can mix both in one request:
Content blocks, in either provider’s shape — this is what your existing
OpenAI or Anthropic code already produces:
media array, which additionally accepts audio:
application/pdf, text/*, application/json, application/xml,
images (OCR), audio (transcription).
unscanned — the field that matters
An allow with a non-empty unscanned does not mean the content was clean.
It means the text we could read was clean, and the listed attachments were never
read. Treat it as a signal, not a footnote:
Through the proxy (
/chat/completions, /messages) the same information
comes back as response headers, since the body is the provider’s:
X-PromptGuard-Unscanned and X-PromptGuard-Unscanned-Reasons.Limits
Examples
Scan user input before sending to an LLM
Scan output for PII before returning to user
SDK Usage (GuardClient)
The Guard API is also accessible through the SDK’sGuardClient:
- Python
- Node.js