Base URL https://api.sovereign-shield.net. Everything below is the complete, current surface; new here? The setup guide walks it in order.
Three credentials, three jobs. Never confuse them:
| Credential | Sent as | What it does |
|---|---|---|
| API key (ss_...) | Authorization: Bearer | Authenticates requests, spends credits. Created at signup in the dashboard; inactive until your email is confirmed. Rotating it keeps your credits. |
| Management token (ssm_...) | X-Manage-Key | Edits policy and acts on approvals. Minted in the dashboard, shown once. The API key can never do these things, so a hijacked agent cannot loosen its own guard. |
| Provider key | Authorization / x-api-key (gateway only) | Your OpenAI/Anthropic/Gemini key, forwarded untouched to your provider. We never store it. |
Missing or unknown key: 401. Valid but inactive key (email not confirmed): 403 with a message saying exactly that.
1 credit scans up to 1,000 characters, rounded up, minimum 1 per request; a 20,000-character document bills 20. Every response reports billed and carries an X-Credits-Remaining header. Credits never expire; packs are one-time purchases from the dashboard.
| Mode | Cost | What runs |
|---|---|---|
| "fast" | 0 credits, always | Deterministic rules only. The free tier; unlimited within rate limits. |
| "auto" (default) | per 1,000 chars | Deterministic first; anything not clearly decided escalates to the 3-model consensus. Out of credits? auto degrades to the free deterministic verdict with billed: 0 and a note, never a surprise 402. |
| "consensus" | per 1,000 chars | Panel required; returns 402 when out of credits. |
| Status | Meaning |
|---|---|
| 400 | Malformed request: missing text/action, invalid JSON, or a policy that fails validation (the response lists every problem). |
| 401 | Missing or unknown credential. |
| 402 | Not enough credits (explicit consensus mode, gateway, or guard). Response includes required and current credits. |
| 403 | Valid key, not yet activated (confirm your email), or wrong password on account actions. |
| 404 | Unknown route, or an approval token that is not pending on your key. |
| 409 | /guard/check with no policy configured; set one first. |
| 429 | Auth endpoints rate limit: 8 attempts per 10 minutes per IP. |
| 502 | Gateway upstream failed; the credit is refunded. |
Scan text for prompt injection, jailbreaks, and agent manipulation before your model reads it.
| Field | Type | Description |
|---|---|---|
| text required | string | The text to scan. Inputs over 8,000 characters are scanned in overlapping chunks and combined fail-closed (any chunk blocking blocks the whole input). |
| mode | string | "auto" (default) · "fast" (deterministic only, free) · "consensus" (panel required). |
| source | string | "user" (default) or "untrusted" for content your agent ingested: web pages, emails, documents, tool output. Untrusted mode flags any embedded attempt to steer the AI. |
{ "allowed": false, "verdict": "block", "score": 100,
"reason": "Blocked an attempt to extract the system's own prompt.",
"rule": "system_prompt_extraction", "chunks": 1, "billed": 1 }
| Field | Description |
|---|---|
| allowed | The only field you must act on. |
| score | 0-100 suspicion score from the deterministic tier. |
| rule | Present when a named rule produced the block: which rule it was. |
| chunks / billed | How the input was split and what it cost. chunk_results lists per-chunk verdicts when split. |
| llm_validated / escalated | Whether the consensus panel confirmed the verdict. |
Judge one OS-level action before executing it. Deterministic, milliseconds, 1 credit.
| Field | Type | Description |
|---|---|---|
| action_type required | string | One of: ANSWER, BROWSE, CAT, DELETE_FILE, GET_CONTENT, READ_FILE, REPLY, SAY, SHELL_EXEC, THINK, TYPE, WRITE_FILE. Unknown types still get the always-on malicious-payload scan. |
| payload | string | The action's argument (the command, the path, the text). |
| invoker_role | string | Who asked; recorded in the decision. |
{ "allowed": false, "verdict": "block",
"reason": "Shell execution is permanently disabled.", "billed": 1 }
Validate a model's proposed output against your ground-truth state using preset rules. Catches the confident answer that contradicts the data it claims to come from. 1 credit.
| Field | Type | Description |
|---|---|---|
| proposal required | object | The model's proposed output. |
| state | object | Your ground truth to validate against. |
| rules required | array | Preset rules only (range, type, one_of, regex, anti-pattern detectors, ...). Arbitrary code is refused. Discover the catalogue at GET /check-output/rules. |
curl -X POST https://api.sovereign-shield.net/check-output \ -H "Authorization: Bearer ss_YOUR_KEY" -H "Content-Type: application/json" \ -d '{"proposal": {"refund": 9500}, "state": {"order_total": 120}, "rules": [{"rule": "range", "args": ["refund"], "kwargs": {"min_val": 0, "max_val": 120}}]}' { "valid": false, "errors": [...], "feedback_vector": "..." } # feed it into the next prompt
Evaluate a named tool call against your server-side policy: the same judgment the gateway applies automatically, exposed as a call for agents you wire yourself. Bills 1 credit plus 1 per string parameter scanned.
| Field | Type | Description |
|---|---|---|
| action required | string | The tool name, e.g. "transfer_funds". |
| params | object | The call's parameters; conditions and injection scanning run against them. |
| approval_token | string | Redeem a granted approval (single-use, bound to the exact action + params). |
deny list → default-deny allowlist → parameter conditions (max/min/allowlist/denylist; a missing, non-numeric, or non-finite value is a violation) → CoreSafety primitives → parameter injection scan → approval gate → allow.
"verdict": "allow" | "block" | "needs_approval" # needs_approval includes approval_token
The enforcing gateway. Point your SDK's base URL at us; requests are scanned on the way in (tool results treated as untrusted, plus a whole-conversation split-payload check), forwarded to your provider, and tool calls your policy denies are removed from the response before your framework can dispatch them. Streaming is real: text streams live; tool-call deltas are held, judged complete, and re-emitted only if allowed.
| Header | Description |
|---|---|
| X-Shield-Key required | Your SovereignShield API key. Bills 1 credit per call. |
| Authorization / x-api-key / x-goog-api-key | Your provider's own auth, forwarded untouched (Anthropic also forwards anthropic-version). |
| X-Shield-Upstream | Override the upstream base URL. Defaults: OpenRouter / api.anthropic.com / generativelanguage.googleapis.com. |
# a denied tool call is gone from choices[].message.tool_calls, and: "shield": { "allowed": ["get_weather"], "blocked": [{ "name": "transfer_funds", "reason": "denied: ..." }] } # an input blocked before forwarding returns a refusal completion with # finish_reason "content_filter" and shield.input_blocked; the credit is refunded.
Read, replace, or granularly edit your key's policy. Auth: X-Manage-Key, or your dashboard session. Every write is validated first; a malformed policy is rejected with the full list of problems.
{ "default": "deny", # deny = allowlist mode (recommended)
"allow": ["get_weather"],
"deny": ["drop_database"],
"require_approval": ["send_email"],
"conditions": { "transfer_funds": [{ "param": "amount", "max": 1000 },
{ "param": "to", "allowlist": ["acct_A"] }] },
"scan_params": { "*": true }, # injection-scan string params
"primitive": { "run_shell": "SHELL_EXEC" } # map to hard OS-level blocks }
{"op": "allow" | "deny" | "require_approval" | "unallow" | "undeny" |
"unrequire_approval", "action": "name"}
{"op": "add_condition", "action": "name", "condition": {...}}
{"op": "clear_conditions", "action": "name"}
{"op": "set_default", "value": "allow" | "deny"}
Your key's needs-approval queue. Auth: X-Manage-Key or dashboard session; strictly scoped to your own key (another key's tokens are invisible and unactionable). GET accepts ?status=pending|approved|denied|used. An approved token is redeemable via /guard/check exactly once.
Mint (or rotate) your management token. Auth: dashboard session; requires a verified account. Shown once; the previous token stops working immediately. The dashboard's "Generate management token" button calls exactly this.
Everything on this page is available as a zero-dependency CLI. Install it, log in once, and the endpoints become commands.
pip install sovereignshield ss login --api-key ss_... --manage-token ssm_...
| Command | Does |
|---|---|
| ss status | account, credits, and the current policy at a glance |
| ss scan "text" | scan input; also -f file, stdin piping, --source untrusted |
| ss verify SHELL_EXEC "..." | judge an action before it runs |
| ss check tool --param k=v | evaluate a tool call against your policy |
| ss allow / deny / ask NAME | add an exception (and un-prefixed forms to remove one) |
| ss limit tool param --max N | bound a parameter; --min, --in a,b, --not-in c |
| ss default deny | allow | set the posture |
| ss approvals / approve / reject | work the approval queue |
ss scan "$INPUT" || handle_block just works in a shell script or CI job.Credentials live in ~/.sovereignshield/config.json (owner-read only), and the environment variables SOVEREIGNSHIELD_API_KEY / SOVEREIGNSHIELD_MANAGE_TOKEN override it for CI.
/billing/packs is public and lists sizes, prices, and per-credit rates. /billing/checkout (session or Bearer key) 303-redirects to Stripe checkout for that pack; the webhook credits your key the moment payment confirms, idempotently.
Unauthenticated liveness check; also reports whether the consensus panel is configured.
{ "status": "ok", "consensus_configured": true }