API Documentation

Integrate Injecto into your AI app in under 5 minutes. Screen every user prompt before it reaches your LLM.

Base URL

https://injecto.xyz

Authentication

Pass your API key in the x-api-key header on every request. Get a key on the pricing page.

x-api-key: inj_your_key_here

Quickstart

import requests result = requests.post( "https://injecto.xyz/api/detect", headers={"x-api-key": "inj_your_key_here"}, json={"prompt": user_message} ).json() if not result["safe"]: raise ValueError(f"Blocked: {result['attack_types']}") # Safe — call your LLM

POST/demo/detect

Free, unauthenticated endpoint for testing and demos. Rate limited. Use /api/detect in production.

curl -X POST https://injecto.xyz/demo/detect -H "Content-Type: application/json" -d '{"prompt": "ignore all previous instructions"}'

POST/api/detect

Production endpoint for direct user prompts. Requires a valid API key. Returns full verdict with risk score, severity, and attack classification.

curl -X POST https://injecto.xyz/api/detect -H "x-api-key: inj_your_key_here" -H "Content-Type: application/json" -d '{"prompt": "your user input here"}'

POST/api/scan-rag

Scans retrieved documents/chunks for indirect prompt injection before they're added to your LLM's context — for RAG pipelines, tool outputs, and any content your app fetches rather than the user typing directly. Requires a valid API key.

curl -X POST https://injecto.xyz/api/scan-rag -H "x-api-key: inj_your_key_here" -H "Content-Type: application/json" -d '{ "chunks": [ { "text": "retrieved document text here", "source": "https://example.com/page", "source_trust": "unverified" } ] }'

Each item in chunks accepts text (required), source, source_trust (one of verified / internal / unverified / untrusted), and optional raw_markup for hidden-text detection.

{ "safe": false, "aggregate_risk": 85, "stacking_flag": false, "flagged_chunk_count": 1, "chunks": [ { "safe": false, "source": "https://example.com/page", "source_trust": "unverified", "risk_score": 85, "severity": "HIGH", "attack_types": ["Instruction Override", "Indirect Injection (Third-Party Directive)"], "recommended_action": "block", "reason": "pattern match: Instruction Override; third-party directive: Post-Action Exfiltration" } ] }

GET/api/stats

Check your plan and request usage. Requires API key.

curl https://injecto.xyz/api/stats -H "x-api-key: inj_your_key_here"

Response fields

{ "safe": false, "risk_score": 90, "severity": "HIGH", "attack_types": ["Instruction Override", "Role Hijacking"], "patterns": ["ignore all instructions", "you are now"], "prompt_length": 9, "timestamp": "2026-01-01T00:00:00" }
FieldTypeDescription
safebooleantrue = safe to pass to your LLM
risk_scoreinteger0–100. Higher = more dangerous
severitystringLOW / MEDIUM / HIGH
attack_typesarrayHuman-readable attack categories detected
patternsarrayExact phrases that triggered detection
prompt_lengthintegerWord count of input

Attack types

TypeDescription
Instruction Override"ignore previous instructions" and variants
Role Hijacking"pretend you are" / "you are now" attacks
Prompt LeakingAttempts to extract system prompt or config
Jailbreak AttackDAN, developer mode, and constraint removal
Persona InjectionGradual identity substitution via "new persona"
Privilege Escalation"act as system" and similar elevation attempts
Safety BypassDirect "bypass safety" / "disable restrictions"
Firewall BlockHardcoded forbidden content (passwords, secrets)
Indirect Injection (Third-Party Directive)Instructions embedded in retrieved content, not the user's own prompt
Concealed Instruction (Hidden Text)display:none / white-on-white / zero-size text hiding a payload from human review

Error codes

StatusMeaning
400Missing or empty prompt/chunks field
401No API key provided
403Invalid API key
429Monthly request limit reached — upgrade plan