Skip to main content

Security Scan & Redact

These endpoints provide direct access to PromptGuard’s threat detection and PII redaction engines. Unlike the Guard API (which accepts structured messages), these endpoints accept raw text strings, making them ideal for simple integrations, pipelines, and batch processing.

Scan Endpoint

Analyze a text string for prompt injection, jailbreak attempts, and other threats.

Authentication

Request Body

Response

Field naming. Success bodies from /api/v1/scan and /api/v1/redact are camelCase (threatType, eventId, processingTimeMs). The shared error envelope and the proxy’s response metadata are snake_case (event_id, threat_type). This split is intentional and frozen: the camelCase shape is what the SDKs parse, and renaming it would break every released client. Do not write a client that accepts both — pick the one for the surface you are calling.

Examples

Response

Redact Endpoint

Strip PII (personally identifiable information) from a text string and return both the original and redacted versions.

Authentication

Request Body

Supported PII Types

Common targets: phone, ip_address and passport are families that expand to several detectors. You can also name a detector directly (phone_us, ipv4, us_passport) along with any of the other 40-odd entity types — national ID numbers, bank identifiers, driving licences — enumerated in the OpenAPI spec. An unrecognized name is rejected with a 400; it is never ignored, so a typo cannot quietly return text that was left unscanned.

Response

Examples

Response
piiFound reports the concrete detectors that matched, not the names you sent. Asking for the phone family comes back as phone_us or phone_intl depending on what was in the text.

Selective Redaction

Omit pii_types to redact the entities your policy is configured for, or pass a subset to target specific types:
A named selection is honoured as given rather than intersected with your policy: ["email"] finds email even on a preset that would not normally scan for it. It also governs api_key — leave that name out and API keys in the text are left alone.

Guard API vs Scan vs Redact

Error Responses

429 body

Both 429s carry on_demand_url and retry_after, and the response also sends a standard Retry-After header with the same value in seconds. The same body is returned by the ChatGPT app tools, which surface the dictionary as-is.
A valid self-host licence removes the cap on /api/v1/security/scan, /api/v1/security/redact and the ChatGPT app tools. Requests are still counted (the licence audit and true-up read the counter) but are never rejected with a 429.