Skip to main content
POST
Guard Content

Authorizations

X-API-Key
string
header
required

PromptGuard API key for developer endpoints. Keys start with pg_live_ and are created in the dashboard.

Headers

x-api-key
string | null

Body

application/json

Request body for the guard endpoint.

messages
GuardMessage · object[]
required

Messages to scan (OpenAI-style message array)

Required array length: 1 - 512 elements
direction
string
default:input

Scan direction: 'input' (pre-LLM) or 'output' (post-LLM)

Pattern: ^(input|output)$
model
string | null

Model being used (for logging)

context
GuardContext · object | null

Optional framework context

retrieved_context
ContextDoc · object[] | null

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.

Maximum array length: 32
media
MediaPartSchema · object[] | null

Media attachments to scan for steganographic payloads, adversarial patches, and font injection. Optional.

Maximum array length: 8
device_findings
DeviceFinding · object[] | null

What the calling Device's own masker caught before sending, as {category, count} pairs — never the values. category is one of the threat types this API returns (e.g. api_key_leak, pii_leak) and appears at most once; count is a positive integer. Any other key is rejected with 422. Recorded on this request's event, attributed to the Device, and shown in the fleet views; it does not change the decision. Optional; clients that omit it are unaffected.

Maximum array length: 37

Response

Successful Response

Response from the guard endpoint.

decision
string
required

Policy decision: 'allow', 'block', or 'redact'

event_id
string
required

Unique event identifier for tracking

confidence
number
required

Confidence score of the decision

latency_ms
number
required

Processing time in milliseconds

weighted_score
number | null

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.

threat_type
string | null

Primary threat type detected

redacted_messages
GuardMessage · object[] | null

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.

threats
ThreatDetail · object[]

Detailed threat breakdown

unscanned
UnscannedAttachment · object[]

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).

unavailable
UnavailableCheck · object[]

Unavailable checks: detectors this scan would have run but the deployment cannot, because their backing service (an ML inference endpoint, an LLM judge, a bundled model) is not configured. An allow with a non-empty unavailable is NOT 'every check passed' — these detectors never looked. A detector that ran and found nothing is not listed, and neither is one the project's plan or guardrail settings leave out.

entitlement
GuardEntitlement · object | null

What this account is entitled to, at the instant this scan was answered. Null when the engine cannot say — an account with no subscription row, an admin key that bypasses the counter, or a row it could not read. Null is 'unknown', NOT 'unentitled': a client that reads it as a limit has invented a refusal the engine never made.