Prompt Injection Detection API
Catch prompt injections, role hijacks, and encoded jailbreaks in user inputs and RAG chunks.
Sanitize entire multi-turn LLM messages[] arrays in one call before forwarding to OpenAI, Anthropic, or Gemini. Drop-in guardrail for OpenAI, Anthropic, and Gemini messages[] arrays. Scans user and tool turns for prompt injection, redacts PII and secrets with a unified cross-turn restoration map, and strips email reply noise.
{
"ok": true,
"data": {
"safe": true,
"verdict": "allow",
"max_risk_score": 0,
"sanitized_messages": [
{
"role": "system",
"content": "You are an enterprise billing assistant."
},
{
"role": "user",
"content": "Please email the receipt to [PII_EMAIL_1]. Key: [SECRET_GITHUB_TOKEN_1]"
}
],
"restoration_map": {
"[PII_EMAIL_1]": "alice@acme.eu",
"[SECRET_GITHUB_TOKEN_1]": "ghp_1234567890abcdefghijklmnopqrstuvwxyz"
},
"summary": {
"total_messages": 2,
"scanned_messages": 1,
"blocked_turns": 0,
"total_pii_redacted": 1,
"total_secrets_redacted": 1,
"injection_categories": []
},
"turn_findings": [
{
"turn_index": 0,
"role": "system",
"verdict": "allow",
"risk_score": 0,
"injection_categories": [],
"pii_redacted_count": 0,
"secrets_redacted_count": 0,
"pii_types": [],
"secret_types": []
},
{
"turn_index": 1,
"role": "user",
"verdict": "allow",
"risk_score": 0,
"injection_categories": [],
"pii_redacted_count": 1,
"secrets_redacted_count": 1,
"pii_types": [
"EMAIL"
],
"secret_types": [
"GITHUB_TOKEN"
]
}
]
},
"meta": {
"request_id": "req_msg_01",
"ms": 2
}
}
curl -X POST "https://api.tinplate.dev/v1/llm-messages-guard" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TINPLATE_KEY" \
-d '{"messages":[{"role":"system","content":"You are an enterprise billing assistant."},{"role":"user","content":"Please email the receipt to alice@acme.eu. Key: ghp_1234567890abcdefghijklmnopqrstuvwxyz"}],"check_prompt_injection":true,"redact_pii":true,"scan_secrets":true,"strip_email_quotes":true,"sensitivity":"medium"}'import { TinplateClient } from "@tinplate/sdk";
const tinplate = new TinplateClient({
apiKey: process.env.TINPLATE_API_KEY!,
});
const { data, meta } = await tinplate.call("/v1/llm-messages-guard", {
"messages": [
{
"role": "system",
"content": "You are an enterprise billing assistant."
},
{
"role": "user",
"content": "Please email the receipt to alice@acme.eu. Key: ghp_1234567890abcdefghijklmnopqrstuvwxyz"
}
],
"check_prompt_injection": true,
"redact_pii": true,
"scan_secrets": true,
"strip_email_quotes": true,
"sensitivity": "medium"
});
console.log(`[${meta.ms} ms]`, data);import requests
response = requests.post(
"https://api.tinplate.dev/v1/llm-messages-guard",
headers={
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_TINPLATE_KEY",
},
json={
"messages": [
{
"role": "system",
"content": "You are an enterprise billing assistant."
},
{
"role": "user",
"content": "Please email the receipt to alice@acme.eu. Key: ghp_1234567890abcdefghijklmnopqrstuvwxyz"
}
],
"check_prompt_injection": true,
"redact_pii": true,
"scan_secrets": true,
"strip_email_quotes": true,
"sensitivity": "medium"
}
)
print(response.json())const response = await fetch("https://api.tinplate.dev/v1/llm-messages-guard", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_TINPLATE_KEY",
},
body: JSON.stringify({
"messages": [
{
"role": "system",
"content": "You are an enterprise billing assistant."
},
{
"role": "user",
"content": "Please email the receipt to alice@acme.eu. Key: ghp_1234567890abcdefghijklmnopqrstuvwxyz"
}
],
"check_prompt_injection": true,
"redact_pii": true,
"scan_secrets": true,
"strip_email_quotes": true,
"sensitivity": "medium"
}),
});
const result = await response.json();
console.log(result);{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "tinplate_llm_messages_guard",
"arguments": {
"messages": [
{
"role": "system",
"content": "You are an enterprise billing assistant."
},
{
"role": "user",
"content": "Please email the receipt to alice@acme.eu. Key: ghp_1234567890abcdefghijklmnopqrstuvwxyz"
}
],
"check_prompt_injection": true,
"redact_pii": true,
"scan_secrets": true,
"strip_email_quotes": true,
"sensitivity": "medium"
}
}
}POST /v1/llm-messages-guard)| Parameter | Type & Constraints | Description |
|---|---|---|
messages required |
object[] |
Array of OpenAI, Anthropic, or agent chat messages to inspect and sanitize in a single pass. |
sensitivity optional |
"low" | "medium" | "high"default: "medium" |
Prompt-injection threshold sensitivity preset. |
check_prompt_injection optional |
booleandefault: true |
Scan user and tool turns for prompt injection and jailbreaks. |
redact_pii optional |
booleandefault: true |
Mask emails, phones, IBANs, credit cards, and national IDs across turns. |
scan_secrets optional |
booleandefault: true |
Scrub leaked API keys, tokens, PEM keys, and credentials across turns. |
strip_email_quotes optional |
booleandefault: false |
Strip quoted email reply chains and signature blocks from user turns before scanning. |
locales optional |
string[]default: ["GLOBAL","EU","US"] |
Locale sets for PII detection. |
data Object Fields (200 OK)| Field | Type | Description |
|---|---|---|
safe |
boolean |
Field 'safe' |
verdict |
"allow" | "review" | "block" |
Field 'verdict' |
max_risk_score |
number |
Field 'max_risk_score' |
sanitized_messages |
object[] |
Field 'sanitized_messages' |
restoration_map |
object |
Unified token-to-original map across all turns for stateless restoration after LLM completion. |
summary |
object |
Field 'summary' |
turn_findings |
object[] |
Field 'turn_findings' |
Release: v1.0.39 ·
Verified: 16 November 2026 ·
Portfolio Median: 0.318 ms in-Worker V8 compute (add 15–65 ms HTTPS RTT) ·
See Full Portfolio Benchmarks →
Direct Polar All-Access Keys unlock all 42 APIs (49 endpoints), /v1/pipeline, and /mcp on api.tinplate.dev:
Pro ($29/mo · 120 req/min · 100k/mo · 128 KB) or Team ($79/mo · 300 req/min · 500k/mo · 256 KB).
| Plan | Monthly Price | Included Requests | Rate Limit | Max Payload | Best For |
|---|---|---|---|---|---|
| BASIC | $0.00 / mo | 500 / month | 10 req / min | 64 KB | Evaluation & CI smoke tests |
| PRO | $9.99 / mo | 15,000 / month | 60 req / min | 128 KB | Solo devs & production apps |
| ULTRA | $29.99 / mo | 100,000 / month | 300 req / min | 256 KB | Growing SaaS & multi-agent pipelines |
| MEGA | $79.99 / mo | 500,000 / month | 1,000 req / min | 256 KB | High-volume enterprise workloads |
Calling PII Redactor per message resets token numbering on every turn. This API maintains a unified cross-turn restoration map across the entire conversation history in a single network call.
No—system and developer prompts are preserved verbatim so your instructions and few-shot examples are never altered.
Chat arrays and reversible restoration maps are processed in memory and never logged or stored.
Worker Zero-Logging Guarantee: Cloudflare Workers Observability and invocation logging are disabled (observability.enabled = false, head_sampling_rate = 0, invocation_logs = false). Requests via RapidAPI or Zyla traverse marketplace proxies; use a Direct Bearer Key for zero-intermediary routing.
Catch prompt injections, role hijacks, and encoded jailbreaks in user inputs and RAG chunks.
Mask emails, phones, IBANs, cards, and EU IDs with reversible tokens before LLM calls.
Estimate tokens, optimize message order for prompt caching, and calculate LLM API costs.