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
| Header | Value |
|---|---|
X-API-Key | Your PromptGuard API key |
Request Body
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
content | string | Yes | — | Text to scan (max 100,000 characters) |
type | string | No | "prompt" | "prompt" for user input or "response" for LLM output |
Response
| Field | Type | Description |
|---|---|---|
blocked | boolean | Whether the content would be blocked |
decision | string | "allow", "block", or "redact" |
reason | string | Human-readable explanation |
threatType | string|null | Threat category if detected |
confidence | float | Confidence score (0.0 — 1.0) |
eventId | string | Unique event identifier |
processingTimeMs | float | Server-side processing time |
Examples
Redact Endpoint
Strip PII (personally identifiable information) from a text string and return both the original and redacted versions.Authentication
| Header | Value |
|---|---|
X-API-Key | Your PromptGuard API key |
Request Body
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
content | string | Yes | — | Text to redact (max 100,000 characters) |
pii_types | string[] | No | all types | Specific PII types to target (e.g. ["email", "ssn", "credit_card"]) |
Supported PII Types
| Type | Pattern |
|---|---|
email | Email addresses |
phone | Phone numbers |
ssn | Social Security Numbers |
credit_card | Credit/debit card numbers |
api_key | API keys and tokens |
ip_address | IPv4 and IPv6 addresses |
Response
| Field | Type | Description |
|---|---|---|
original | string | The input text unchanged |
redacted | string | Text with PII replaced by type placeholders |
piiFound | string[] | List of PII types that were detected and replaced |
Examples
Selective Redaction
Omitpii_types to redact all detected PII, or pass a subset to target specific types:
Guard API vs Scan vs Redact
| Feature | Guard API | Scan | Redact |
|---|---|---|---|
| Input format | Structured messages array | Raw text string | Raw text string |
| Threat detection | Yes | Yes | No |
| PII redaction | Yes (automatic) | No | Yes |
| Direction awareness | Yes (input/output) | Yes (prompt/response) | N/A |
| Framework context | Yes | No | No |
| Best for | SDK integrations | Simple pipelines | Data sanitization |
Error Responses
| Status | Code | Description |
|---|---|---|
| 400 | invalid_request | Missing content field or exceeds 100K character limit |
| 401 | unauthorized | Invalid or missing API key |
| 403 | quota_exceeded | Monthly request limit reached |
| 422 | validation_error | Invalid type value |