What you’re protecting against: PromptGuard blocks prompt injection, jailbreaks, and data leaks before they reach (or leave) your LLM — without changing how your app works. New to these terms? See the glossary. This takes about 5 minutes.
Get your API key
- Sign up at app.promptguard.co
- Open your project and go to API Keys
- Click Create API Key, name it, and copy the key
PromptGuard API keys always start with the
pg_live_ prefix. Authenticate by passing the key in the X-API-Key header (the SDKs do this for you). There is no separate test or sandbox key prefix.Add one line of code
Auto-instrumentation patches OpenAI, Anthropic, Google AI, Cohere, and AWS Bedrock SDKs. All LLM calls are scanned automatically.
The examples use
gpt-5-nano. Replace it with any model your provider account has access to.Verify protection
Try a prompt injection to confirm PromptGuard blocks it:
Only a block decision raises
PromptGuardBlockedError. A redact decision does not raise — PromptGuard strips the sensitive content and returns a sanitized response, so the call succeeds normally.View in the dashboard
Open app.promptguard.co and go to your project’s Interactions page to see the blocked request with threat classification, confidence score, and token-level explanation.
Alternative: HTTP proxy (no SDK)
Change your LLM base URL to PromptGuard. No SDK installation needed.Authorization header. PromptGuard forwards the request after scanning.
Alternative: Guard API (standalone scan)
Scan content directly without proxying:What happens under the hood
Next steps
Python SDK
Full SDK reference with configuration options
Security Policies
Configure detection thresholds for your use case
MCP Server
Connect PromptGuard to your AI coding editor
API Reference
Full REST API documentation