Integrate

Any agent calls the same firewall before it calls its own model. OpenAI, LangGraph, NeMo, and a custom app all use these endpoints. PromptShield does not replace the model.

Step 1

Send the untrusted text
POST /v1/scan for a prompt. POST /v1/scan/file for an upload.

Step 2

Read the decision
Allowed, Sanitised, Quarantined, or Blocked. The field is decision.

Step 3

Forward only the safe text
On Sanitised, send sanitized_text to your model. On Blocked or Quarantined, do not send the original.
Authentication
The service key is PROMPTSHIELD_API_KEY on the API process. This screen never shows the key.
Demo open
This API is in demo mode, so local calls work without a key.

Create an account to get an API key. The key is shown once. Send it as a bearer token. That account only sees its own scans. Admins can also create keys on the Keys page.

For a shared service, set DEMO_MODE=0 and PROMPTSHIELD_API_KEY, then restart the API. Callers send either header:

authorization: Bearer YOUR_KEY
x-api-key: YOUR_KEY

Health and this dashboard stay readable without the key. Scan and guard calls require it when demo mode is off. A wrong key returns 401 and the key is never written back in the response.

Check a prompt
Call this before the model, from any app or agent. On sanitize, send sanitized_text onward. On block, stop.
curl -s http://127.0.0.1:8000/v1/scan \
  -H "authorization: Bearer $PROMPTSHIELD_API_KEY" \
  -H "content-type: application/json" \
  -d '{"source_type":"user_message","trust":1,"content":"Summarise the thread."}'
Check a file
PDF, Office, HTML, email, image, and source files. The response uses the same decision and sanitized_text.
curl -s http://127.0.0.1:8000/v1/scan/file \
  -H "authorization: Bearer $PROMPTSHIELD_API_KEY" \
  -F "file=@notes.txt"
Check a tool call
deny means the tool must not run. confirm means a person should approve it first.
curl -s http://127.0.0.1:8000/v1/guard/tool-call \
  -H "x-api-key: $PROMPTSHIELD_API_KEY" \
  -H "content-type: application/json" \
  -d '{"session_id":"s_42","tool":"send_email","args":{"to":"ops@example.test","body":"status"}}'
What to do with the body

Allowed. Send the original text to your model.

Sanitised. Send sanitized_text. The attack span has been replaced. spotlighted_text is the same text marked as untrusted data.

Blocked or Quarantined. Do not send the original text to the model. Show safe_alternative instead. That line is the benign remainder, or a request to rephrase, and it does not repeat the attack.

The same steps are written out in docs/INTEGRATIONS.md.