API Documentation
Integrate ShieldLLM's AI firewall and vulnerability scanner into your application in minutes. Route your LLM traffic through our firewall or run security scans against any AI endpoint.
https://www.shieldllm.io
🔐 Authentication
All API requests require an API key in the X-API-Key header.
Generate your key from the API Keys section of your dashboard.
curl https://www.shieldllm.io/api/chat \
-H "X-API-Key: shld_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"messages":[{"role":"user","content":"Hello"}]}'
⚡ Quick Start
Get up and running in 3 steps:
POST /api/chat — we handle the firewall and model call.POST /api/scan/run at your AI endpoint to get a full vulnerability report in ~60 seconds./api/chat
Send a conversation through ShieldLLM's AI firewall. Malicious prompts are blocked before reaching your model. Returns the model response plus firewall metadata.
{
"messages": [
{
"role": "user",
"content": "Hello!"
}
],
"system": "You are a helpful assistant."
}
{
"response": "Hello! How can I help?",
"firewall_decision": "ALLOW",
"firewall_score": 12,
"model": "claude-haiku-4-5",
"latency_ms": 340
}
"firewall_decision": "BLOCK" is returned and the model is never called.
/api/scan/run
Fire 36 adversarial attacks at your AI endpoint and receive a security score, grade, and vulnerability report. Returns a task_id immediately — poll /api/scan/status/{task_id} for results.
{
"target_url": "https://your-chatbot.com/chat",
"bypass_firewall": false
}
{
"task_id": "a3f9c2d1",
"status": "running",
"target": "https://your-chatbot.com/chat"
}
/api/scan/status/{task_id}
Poll the progress of a running scan. When status is "done", results are available.
{
"status": "done",
"progress": 36,
"total": 36,
"score": 74,
"grade": "B",
"vuln_count": 4
}
/api/scan/latest
Returns the full JSON report from your most recent scan including all attack results, severity breakdown, and OWASP mapping.
/api/health
No auth requiredCheck if the API is online. Use this for uptime monitoring.
{
"status": "ok",
"provider": "anthropic",
"model": "claude-haiku-4-5",
"firewall": true,
"version": "3.1.0"
}
⚠️ Error Codes
📊 Plans & Limits
Upgrade to Pro →📦 Code Examples
import requests
SHIELD_URL = "https://www.shieldllm.io"
API_KEY = "shld_your_key_here"
# ── Chat through the firewall ─────────────────────
def safe_chat(user_message: str, system: str = "") -> dict:
res = requests.post(
f"{SHIELD_URL}/api/chat",
headers={
"X-API-Key": API_KEY,
"Content-Type": "application/json"
},
json={
"messages": [{"role": "user", "content": user_message}],
"system": system
}
)
return res.json()
reply = safe_chat("What is prompt injection?")
if reply.get("firewall_decision") == "BLOCK":
print("Blocked by firewall:", reply["response"])
else:
print("Model response:", reply["response"])
# ── Run a security scan ───────────────────────────
import time
def run_scan(endpoint_url: str) -> dict:
# Start the scan
res = requests.post(
f"{SHIELD_URL}/api/scan/run",
headers={"X-API-Key": API_KEY},
json={"target_url": endpoint_url}
)
task_id = res.json()["task_id"]
print(f"Scan started: {task_id}")
# Poll until done
while True:
status = requests.get(
f"{SHIELD_URL}/api/scan/status/{task_id}",
headers={"X-API-Key": API_KEY}
).json()
if status["status"] == "done":
return status
print(f"Progress: {status['progress']}/{status['total']}")
time.sleep(3)
result = run_scan("https://your-chatbot.com/chat")
print(f"Score: {result['score']}/100 | Grade: {result['grade']}")