# AI Security Guard v1.2.0 > **v1.2.0** — If the local copy matches this version, it is current. > Verify with: `curl -s https://aisecurityguard.io/v1/api.md | head -5` ## Table of Contents **[Executive Summary](#executive-summary)** — Start here. What AgentGuard360 is, what you get for free, quick start commands. **Part 1: Understanding Threats** - [1.0 Why This Matters](#10-why-this-matters) - [1.1 What We Protect Against](#11-what-we-protect-against) - [1.2 Detection Philosophy](#12-detection-philosophy--tradeoffs) - [1.3 Architectural Choices](#13-architectural-choices) **Part 2: Core Concepts** - [2.1 Intent Contracts](#21-intent-contracts-the-foundation) - [2.2 Finding Enrichment](#22-finding-enrichment-context-for-decision-making) - [2.3 Threat Categories](#23-threat-categories) - [2.4 Verdicts & Dispositions](#24-verdicts-and-dispositions) **Part 3: Integration Guide** - [3.1 Proxy Mode](#31-proxy-mode-zero-code-integration) — Zero-code integration - [3.2 CLI Commands](#32-cli-commands) — Programmatic scanning - [3.3 Interpreting Results](#33-interpreting-results) - [3.4 Direct API](#34-direct-api-integration) — For custom implementations - [3.5 What to Scan](#35-what-to-scan-decision-guide) - [3.6 Budget Management](#36-budget-management) **Part 4: API Reference** (for direct API users) - [4.1 Endpoints Overview](#41-endpoints-overview) - [4.2 Scan Request Schema](#42-scan-request-schema) - [4.3 Scan Response Schema](#43-scan-response-schema) - [4.4 Content Types](#44-content-types) - [4.5 Intent Types](#45-intent-types) - [4.6 Rate Limits](#46-rate-limits) - [4.7 Trust Center Resources](#47-trust-center-resources) **Part 5: Advanced Topics** - [5.1 Privacy-First Architecture](#51-privacy-first-architecture) - [5.2 Batch Scanning](#52-batch-scanning) - [5.3 Budget Tracking](#53-budget-tracking) - [5.4 Error Handling](#54-error-handling) - [5.5 Community & Feedback](#55-community--feedback) **Appendix** - [FAQ](#faq) --- ## Executive Summary ### What is AgentGuard360? AgentGuard360 is a security platform that protects AI agents from emerging threats. It provides **instant protection** without code changes and a comprehensive SDK for programmatic security integration. **Key Protection Layers:** | Layer | What It Does | Cost | |-------|--------------|------| | **LLM Traffic Monitor** | Intercepts and scans all API calls to OpenAI, Anthropic, and 15+ providers | FREE (local mode) | | **MCP Tool Monitor** | Wraps MCP servers to scan tool invocations and responses | FREE | | **Device Hardening** | 14-phase security assessment with remediation guidance | FREE | | **Content Scanning** | On-demand scanning of content, URLs, and documents | FREE (local) / Paid (AI-powered) | ### Three Paths to Protection | Path | Time | Code Changes | How | |------|------|--------------|-----| | **Dashboard** | 2 min | None | `agentguard360 human` → Settings → Enable Protection | | **CLI** | 5 min | None | `agentguard360 proxy auto-setup` | | **SDK** | 10 min | Minimal | `import agentguard360; agentguard360.enable_protection()` | ### Quick Start **Option 1: Dashboard (Humans)** ```bash # pip install agentguard360 # Coming Soon agentguard360 human # Navigate to Settings → Monitoring → Click "Activate Proxy & MCP Monitoring" ``` **Option 2: CLI (Agents)** ```bash # pip install agentguard360 # Coming Soon # Enable all protection with one command agentguard360 proxy auto-setup # Make it persistent (survives restarts) agentguard360 proxy install-daemon # For startup hooks (idempotent - safe to call repeatedly) agentguard360 proxy ensure ``` **Option 3: SDK (Programmatic)** ```python import agentguard360 # Enable protection (starts proxy + installs daemon) status = agentguard360.enable_protection() print(f"Protected: {status.is_active}") # Check protection status status = agentguard360.protection_status() if not status.is_active: agentguard360.enable_protection() # Scan content on demand result = agentguard360.scan("content to check") if result.has_threats: print(f"Blocked: {result.verdict}") # Check URLs before fetching url_result = agentguard360.check_url("https://example.com") if not url_result.is_safe: print(f"Risky URL: {url_result.category}") ``` ### What Gets Scanned (When Protection is Active) | Traffic Type | Scanned Automatically | |--------------|----------------------| | LLM API requests to OpenAI, Anthropic, Groq, Mistral, etc. | ✓ | | LLM API responses | ✓ | | MCP tool invocations | ✓ | | MCP tool responses | ✓ | ### CLI Tool Discovery Agents can discover available tools programmatically: ```bash # List all available tools agentguard360 agent discover # Get tool schemas in Anthropic format agentguard360 agent discover -f anthropic # Get tool schemas in OpenAI format agentguard360 agent discover -f openai # Call any tool agentguard360 agent call protection_status agentguard360 agent call enable_protection agentguard360 agent call scan --args '{"content": "text to scan"}' ``` --- ## Part 1: Getting Started ### 1.1 Two Monitoring Layers AgentGuard360 provides two complementary protection layers that work together for 360° coverage: #### Layer 1: System Activity Monitor (Background Daemon) Tracks on-device activity from AI agents: | What It Monitors | Description | |------------------|-------------| | File changes | New files, modifications, deletions in watched directories | | Network connections | Outbound connections with ASN lookup | | Process activity | AI coding tool processes and their children | **Enable via Dashboard:** ``` agentguard360 human # Navigate to: Settings → Monitoring → Section I → "Install & Start" ``` **Enable via SDK:** ```python import agentguard360 monitor = agentguard360.monitor_activity() # Later... summary = agentguard360.get_activity_summary(minutes=60) ``` #### Layer 2: LLM Traffic Monitor (Proxy + MCP Wrapper) Intercepts and scans all LLM API calls and MCP tool invocations: | Component | What It Does | |-----------|--------------| | **API Proxy** | Routes calls to OpenAI, Anthropic, Groq, Mistral, etc. through local scanner (port 7402) | | **MCP Wrapper** | Wraps MCP servers to intercept tool calls and responses | | **Boot Persistence** | Optional daemon for protection that survives restarts | **Enable via Dashboard:** ``` agentguard360 human # Navigate to: Settings → Monitoring → Section II → "Activate Proxy & MCP Monitoring" ``` **Enable via CLI:** ```bash # One command does everything: agentguard360 proxy auto-setup # This command: # 1. Auto-detects Claude Desktop, Cursor, Claude Code # 2. Wraps their MCP servers # 3. Starts the proxy on port 7402 # 4. Outputs next steps for shell configuration # For persistent protection (survives restarts): agentguard360 proxy install-daemon ``` **Enable via SDK:** ```python import agentguard360 # Enable protection (starts proxy + installs daemon) status = agentguard360.enable_protection() # Check status anytime status = agentguard360.protection_status() print(f"Proxy: {status.proxy_running}, Daemon: {status.daemon_installed}") ``` --- ### 1.2 What Gets Scanned #### With LLM Traffic Monitor Active When protection is enabled, the following is automatically scanned: | Traffic Type | Scanned | Mode | |--------------|---------|------| | Outbound LLM API requests | ✓ | Risk assessment | | Inbound LLM API responses | ✓ | Risk assessment + optional deep scan | | MCP tool invocations | ✓ | Risk assessment | | MCP tool responses | ✓ | Risk assessment | **Supported Providers (Auto-Detected):** - OpenAI, Anthropic, Groq, Mistral, Together AI, DeepSeek, Fireworks AI - OpenRouter, Perplexity, Cerebras, SambaNova, Lepton AI, SiliconFlow - Cohere, AI21 Labs, Replicate, Novita AI, Hugging Face Inference #### On-Demand Scanning (SDK/CLI) Use on-demand scanning for content not going through the proxy: ```python import agentguard360 # Scan any content result = agentguard360.scan("content to check") print(f"Verdict: {result.verdict}, Threats: {result.has_threats}") # Check URLs before fetching url_result = agentguard360.check_url("https://example.com/api") if not url_result.is_safe: print(f"Risky URL: {url_result.category}") # Scan documents (PDF, DOCX) doc_result = agentguard360.scan_document("contract.pdf") if doc_result.hidden_text_detected: print("Hidden content found!") ``` --- ### 1.3 Device Security Assessment (Shield) Shield provides a 14-phase security assessment of the host system: ```python import agentguard360 # Run security scan shield = agentguard360.shield_scan(mode="rapid") # or "deep" for package CVEs print(f"Score: {shield.score}/100 ({shield.grade})") print(f"Critical: {shield.critical_count}, Warnings: {shield.warning_count}") # Check if secure enough if shield.is_secure: # Grade A or B with no critical issues print("System is secure") ``` **What Shield Checks:** | Category | Examples | |----------|----------| | Network Exposure | Open ports, exposed services | | SSH Configuration | Key-based auth, password auth disabled | | MCP Server Integrity | Wrapped vs unwrapped servers | | Secrets Exposure | API keys in env, credentials in files | | Sandbox Vectors | Docker socket access, container breakout | | Package CVEs | Known vulnerabilities (deep mode only) | **CLI equivalent:** ```bash agentguard360 agent call shield_scan agentguard360 agent call shield_scan --args '{"mode": "deep"}' ``` --- ### 1.4 Detecting AI Agents and MCP Servers ```python import agentguard360 # Find installed AI agents agents = agentguard360.detect_agents() for agent in agents: print(f"{agent.name}: {len(agent.session_files)} sessions") # Find configured MCP servers servers = agentguard360.detect_mcp_servers() for server in servers: print(f"{server['name']}: {server['command']}") ``` **CLI equivalent:** ```bash agentguard360 agent call detect_agents agentguard360 agent call detect_mcp_servers ``` --- ### 1.5 Scan Tiers AgentGuard360 uses a tiered scanning approach: | Tier | Cost | What Happens | When Used | |------|------|--------------|-----------| | **Local** | FREE | 75+ pattern matching, no data transmitted | Always (first tier) | | **Risk Assessment** | FREE quota | Content DNA (fingerprint) sent, actual content stays local | When local flags concerns | | **Premium AI Scan** | Paid | Full content analyzed by multi-expert AI system | When risk assessment escalates | **How It Works:** 1. Local scan runs instantly (no network calls) 2. If patterns detected, risk assessment runs (privacy-preserving) 3. If risk is high, you can choose to escalate to premium scan The proxy (`agentguard360 proxy auto-setup`) handles this automatically. You configure the scan mode when starting: ```bash # Local only (free, no API calls) agentguard360 proxy start --mode local # Local + risk assessment (free quota) agentguard360 proxy start --mode preflight # Full pipeline including premium (requires wallet) agentguard360 proxy start --mode full_premium ``` --- ## Part 2: SDK Reference The AgentGuard360 SDK provides a complete Python interface for security operations. ```python import agentguard360 ``` --- ### 2.1 Protection Management #### `enable_protection(persistent=True, scan_mode="local")` Enable AgentGuard360 protection. Starts the LLM traffic proxy and optionally installs a system daemon for boot persistence. ```python import agentguard360 # Enable with defaults (proxy + daemon) status = agentguard360.enable_protection() # Enable without daemon (proxy only) status = agentguard360.enable_protection(persistent=False) # Enable with premium scanning status = agentguard360.enable_protection(scan_mode="full_premium") ``` **Returns:** `ProtectionStatus` | Field | Type | Description | |-------|------|-------------| | `proxy_running` | bool | Proxy is active on port 7402 | | `daemon_installed` | bool | Daemon installed for boot persistence | | `daemon_running` | bool | Daemon is currently running | | `mcp_servers_wrapped` | int | Number of MCP servers wrapped | | `is_active` | bool | Any protection layer is active | | `is_fully_protected` | bool | Proxy running AND daemon installed | #### `disable_protection()` Stop proxy and uninstall daemon. ```python status = agentguard360.disable_protection() ``` #### `protection_status()` Get current protection status without making changes. ```python status = agentguard360.protection_status() if not status.is_active: agentguard360.enable_protection() ``` --- ### 2.2 Content Scanning #### `scan(content, intent=IntentType.MCP_INTERACTION, auto_escalate=True)` Scan content for security threats. Uses tiered scanning with optional auto-escalation. ```python import agentguard360 # Basic scan result = agentguard360.scan("content to check") if result.has_threats: print(f"Verdict: {result.verdict}") print(f"Risk Level: {result.risk_level}") print(f"Flags: {result.risk_flags}") else: print("Content is clean") ``` **Returns:** `ScanResult` | Field | Type | Description | |-------|------|-------------| | `verdict` | str | clean, suspicious, malicious | | `confidence` | float | 0.0-1.0 confidence score | | `has_threats` | bool | True if threats detected | | `risk_level` | str | low, medium, high, critical | | `risk_score` | float | 0.0-1.0 risk score | | `risk_flags` | list | Specific threat indicators | | `escalated` | bool | True if premium scan ran | | `cost_usd` | float | Cost of scan (0.0 for local) | #### `risk_assess(content)` Quick risk assessment without premium escalation (free tier). ```python result = agentguard360.risk_assess("check this text") print(f"Risk: {result.risk_level}, Flags: {result.risk_flags}") ``` #### `radar_scan(content)` Force premium AI-powered scan (bypasses risk assessment). Requires wallet. ```python result = agentguard360.radar_scan("suspicious content") print(f"Verdict: {result.verdict}, Cost: ${result.cost_usd:.4f}") ``` #### `scan_batch(contents)` Scan multiple content items. ```python results = agentguard360.scan_batch(["item1", "item2", "item3"]) for r in results: print(f"{r.verdict}: {r.has_threats}") ``` --- ### 2.3 URL Safety #### `check_url(url)` Check URL safety before fetching. ```python result = agentguard360.check_url("https://suspicious-site.com") if not result.is_safe: print(f"Risky URL: {result.category}") print(f"Risk Level: {result.risk_level}") else: # Safe to fetch response = requests.get(url) ``` **Returns:** `UrlResult` | Field | Type | Description | |-------|------|-------------| | `url` | str | The URL checked | | `is_safe` | bool | True if URL is safe | | `risk_level` | str | low, medium, high, critical | | `category` | str | phishing, malware, suspicious, etc. | | `verdict` | str | clean, suspicious, malicious | #### `check_urls(urls)` Batch check multiple URLs. ```python results = agentguard360.check_urls(["https://a.com", "https://b.com"]) safe_urls = [r.url for r in results if r.is_safe] ``` --- ### 2.4 Document Scanning #### `scan_document(file_path)` Scan PDF or DOCX files for threats. ```python result = agentguard360.scan_document("contract.pdf") if result.hidden_text_detected: print("Warning: Hidden text found!") if result.verdict != "clean": print(f"Document threats: {result.findings}") ``` **Detects:** - Hidden text and invisible content - Embedded JavaScript - Malicious forms and annotations - Prompt injection in document content #### `scan_documents(file_paths)` Batch scan multiple documents. ```python results = agentguard360.scan_documents(["a.pdf", "b.docx"]) ``` --- ### 2.5 Device Security (Shield) #### `shield_scan(mode="rapid")` Run security assessment on the host system. ```python # Quick scan (5 seconds) shield = agentguard360.shield_scan(mode="rapid") # Deep scan with package CVEs (up to 3 minutes) shield = agentguard360.shield_scan(mode="deep") print(f"Score: {shield.score}/100 ({shield.grade})") print(f"Critical: {shield.critical_count}") print(f"Warnings: {shield.warning_count}") if shield.is_secure: print("System is secure") else: for issue in shield.issues: print(f" - {issue['title']}: {issue['severity']}") ``` **Returns:** `ShieldResult` | Field | Type | Description | |-------|------|-------------| | `score` | int | 0-100 security score | | `grade` | str | A, B, C, D, or F | | `is_secure` | bool | Grade A/B with no critical issues | | `critical_count` | int | Number of critical issues | | `warning_count` | int | Number of warnings | | `issues` | list | Detailed issue list | #### `detect_agents()` Find installed AI agents. ```python agents = agentguard360.detect_agents() for agent in agents: print(f"{agent.name}: {len(agent.session_files)} sessions") ``` #### `detect_mcp_servers()` Find configured MCP servers. ```python servers = agentguard360.detect_mcp_servers() for s in servers: print(f"{s['name']}: {s['command']}") ``` --- ### 2.6 Activity Monitoring #### `monitor_activity(watch_dirs=None)` Start passive activity monitoring. ```python monitor = agentguard360.monitor_activity() # ... work happens ... summary = agentguard360.get_activity_summary(minutes=30) print(f"Events: {summary['total_events']}") ``` #### `stop_monitoring()` Stop the activity monitor. #### `get_activity_summary(minutes=60)` Get activity summary for the specified time period. --- ### 2.7 Risk Credits #### `get_risk_credits()` Check risk assessment credit balance. ```python balance = agentguard360.get_risk_credits() print(f"Starter credits: {balance.free_quota_remaining}") print(f"Purchased: {balance.credits_available}") print(f"Total: {balance.total_available}") ``` **Returns:** `RiskCreditBalance` | Field | Type | Description | |-------|------|-------------| | `free_quota_remaining` | int | One-time starter credits left | | `free_quota_limit` | int | Total starter credit allocation | | `credits_available` | int | Purchased credits | | `total_available` | int | Free + purchased | | `has_credits` | bool | Any credits available | #### `purchase_risk_credits()` Buy risk assessment credits (use get_pricing for current rates). ```python result = agentguard360.purchase_risk_credits() if result.success: print(f"Added {result.credits_added} credits") ``` --- ### 2.8 Wallet & Budget #### `get_wallet_address()` Get configured wallet address. #### `is_wallet_configured()` Check if wallet is set up for payments. #### `get_wallet_balance()` Get USDC balance on Base L2. ```python balance = agentguard360.get_wallet_balance() print(f"Balance: ${balance['usdc_balance']:.2f} USDC") ``` #### `get_pricing()` Get current pricing tiers. #### `get_status()` Get API service status. --- ### 2.9 Intent Types When using `scan()`, you can specify an intent type for better context: ```python from agentguard360 import IntentType result = agentguard360.scan(content, intent=IntentType.MCP_INTERACTION) ``` | Intent Type | Use When | |-------------|----------| | `MCP_INTERACTION` | MCP server responses (default) | | `API_INTERACTION` | API responses | | `WEB_SCRAPING` | Web scraped content | | `FILE_OPERATION` | File contents | | `CODE_GENERATION` | AI-generated code | | `CODE_REVIEW` | GitHub PRs, code reviews | | `DATA_RETRIEVAL` | API data, search results | | `SKILL_DEFINITION` | MCP skills, tool definitions | | `README` | Documentation, READMEs | --- ## Part 3: Understanding Threats ### 3.1 Why This Matters **A Tuesday Morning Scenario** An AI assistant receives a calendar invite. It looks routine—just a meeting request from what appears to be a colleague, complete with a Zoom link and an ICS attachment. The assistant processes it automatically. That's what it's supposed to do. But this invite wasn't from a colleague. It was a spoofed event containing a malicious payload embedded in the ICS file. When the assistant processed it, it executed arbitrary code with the same privileges as the host application—typically full system access. Credentials exfiltrated. Files accessed. Network connections exposed. **Zero clicks required.** This isn't hypothetical. In February 2026, security researchers identified this exact attack vector in AI desktop extensions with calendar integrations. The vulnerability exploited a gap that exists in many agentic systems: content from "trusted" sources (calendars, emails, shared documents) gets processed without the scrutiny applied to obviously external inputs. **Who expects a calendar invite to be dangerous?** That's exactly the point. Attackers know which channels defenders underestimate. --- ### 3.2 What We Protect Against **System Security Threats:** | Threat | Detection | |--------|-----------| | Sandbox escapes | Docker socket access, container breakout vectors | | Privilege escalation | Permissions analysis, sudo misconfigurations | | Exposed secrets | API keys, tokens, credentials in files/env | | Dangerous configurations | LLM settings that enable attacks | **Content Threats:** | Attack Vector | What We Detect | |---------------|----------------| | Prompt injection | Instructions embedded in data fields | | Instruction override | Attempts to hijack agent behavior | | Data exfiltration | Patterns indicating credential theft | | Hidden content | Invisible text, encoded payloads in documents | | Malicious URLs | Phishing, malware distribution, injection vectors | | Calendar/email attacks | ICS payloads, spoofed invites | **What We Do NOT Detect:** AgentGuard360 detects **attacks targeting AI agents** (prompt injection, jailbreaks, instruction override). We do **not** moderate content **generated by** LLMs (toxic outputs, hallucinations, bias). LLM output moderation is a separate problem requiring different approaches. --- ### 3.3 Detection Philosophy **Advisory, Not Just Verdicts** Traditional security scanners give you a verdict: **ALLOW** or **BLOCK**. That works for static content, but AI agents operate in context-dependent environments where the same pattern can be benign or malicious depending on *where it appears* and *what you intended*. **We take a different approach:** - **We explain what we found** — Each finding includes context about why it triggered - **We provide a routing summary** — `overview.action` gives a deterministic action (`proceed` / `review` / `block`) - **We provide guidance, not mandates** — You see our reasoning and make the final decision **Zero-Trust Content Policy** This platform applies a **zero-trust policy to all content**. Every input—regardless of source— is treated as potentially hostile until proven otherwise through contextual analysis. This approach aligns with **OWASP Top 10 for Agentic Applications** guidance: > **ASI01 (Prompt Injection)**: "Treat all natural-language inputs (e.g., user-provided text, > uploaded documents, retrieved content) as untrusted." --- ### 3.4 Verdicts and Actions **Verdicts (what we found):** | Verdict | Meaning | Recommended Action | |---------|---------|-------------------| | `clean` | No threats detected | Proceed normally | | `suspicious` | Patterns warrant review | Check findings, decide based on context | | `malicious` | High-confidence threat | Block immediately | **Actions (what to do):** | Action | When Returned | What It Means | |--------|---------------|---------------| | `proceed` | No concerning patterns | Safe to process | | `proceed_constrained` | Minor concerns | Process with reduced permissions | | `review` | Potential threat | Flag for human review | | `block` | High-confidence attack | Do not process | **Risk Levels:** | Risk Level | Score Range | Meaning | |------------|-------------|---------| | `low` | 0-25 | Normal content | | `medium` | 26-50 | Some patterns detected | | `high` | 51-75 | Multiple concerning patterns | | `critical` | 76-100 | Strong attack indicators | --- ### 3.5 Threat Categories | Category | Severity | Description | |----------|----------|-------------| | `url_payload_injection` | critical | Malicious payloads encoded in URL parameters (base64, injection in query strings) | | `prompt_injection` | critical | Attempts to override system instructions or manipulate LLM behavior | | `indirect_injection` | critical | Hidden instructions in external content that target the processing LLM | | `credential_exfiltration` | critical | Attempts to extract API keys, tokens, or secrets | | `data_exfiltration` | high | Attempts to send data to unauthorized external destinations | | `code_injection` | critical | Malicious code patterns in executable content | | `intent_drift` | medium | Content that diverges from declared task intent | | `social_engineering` | high | Manipulation techniques targeting LLM decision-making | | `instruction_override` | critical | Direct attempts to override or ignore previous instructions | | `credential_phishing` | high | Credential requests (passwords, MFA codes, tokens) in contexts where credentials should not be requested. Detected via intent contract mismatch. | --- ### 3.6 What to Scan (Decision Guide) | Content Source | Risk Level | Recommendation | |----------------|------------|----------------| | User messages | **Critical** | Always scan — primary injection vector | | Documents/attachments | **Critical** | Always scan — hidden payloads common | | External URLs | **High** | Check URL before fetching | | Unknown MCP tools | **High** | Scan before first use | | Known API responses | Medium | Batch scan or risk assessment | | Internal tool outputs | Low | Local pattern check sufficient | **With proxy mode enabled, this is handled automatically.** --- ### 3.7 Architectural Choices **Why Advisory, Not Blocking?** - Agents have context we don't — final decisions belong to agents (and operators) - Different use cases have different risk tolerances - Advisory enables nuanced responses (proceed with monitoring, escalate to human, etc.) **Why Privacy-First?** - We don't train on scanned content - We don't retain content beyond the session - Risk assessment sends only content fingerprints, not actual content - The audit trail belongs to the operator, not us - See [Trust Center](https://aisecurityguard.io/trust.md) for the full privacy model **Intentional Limitations (We're Honest About These):** - We detect and advise — we don't block execution (agents decide) - We catch many threats, not all — we're a layer, not a guarantee - Novel attack patterns may evade detection until our models update - Non-English content has reduced detection coverage --- ## Part 4: API Reference ### 4.1 Endpoints Overview **Core Scanning:** | Endpoint | Method | Purpose | Cost | |----------|--------|---------|------| | `/v1/guard` | POST | Scan content | Paid | | `/v1/guard/quote` | POST | Get price quote (content-length) | Free | | `/v1/guard/quote/url` | POST | **URL scanning** - fetch & quote remote content | Free | **Batch Scanning:** | Endpoint | Method | Purpose | Cost | |----------|--------|---------|------| | `/v1/guard/batch` | POST | Batch scan (2-500 items) | Paid (with volume discount) | | `/v1/guard/batch/url` | POST | Batch URL scan - scans URLs AND content | Paid (with volume discount) | | `/v1/guard/batch/quote` | POST | Get batch quote (content-lengths) | Free | | `/v1/guard/batch/quote/url` | POST | Batch URL quote - fetch multiple URLs | Free | | `/v1/guard/batch/{batch_id}` | GET | Check batch status | Free | **Batch Volume Discounts (Content Scans Only):** Consolidating content scans into batches reduces per-item cost (does not apply to preflight validation): | Batch Size | Discount | |------------|----------| | 2-9 items | 0% | | 10-49 items | 5% | | 50-199 items | 10% | | 200-500 items | 15% | Discounts are calculated automatically and shown in the batch quote response. **Document Scanning:** | Endpoint | Method | Purpose | Cost | |----------|--------|---------|------| | `/v1/document/quote` | POST | Get price quote for document | Free | | `/v1/document/scan` | POST | Scan PDF/DOCX for threats | Paid ($0.12 + per-block) | | `/v1/document/supported-types` | GET | List supported document formats | Free | **Preflight Validation:** | Endpoint | Method | Purpose | Cost | |----------|--------|---------|------| | `/v1/guard/preflight/quote` | POST | Get batch quote (FREE) | Free | | `/v1/guard/preflight` | POST | Single validation | Paid ($0.0075) | | `/v1/guard/preflight/batch` | POST | Batch validation (2-500 items) | Paid ($0.0075/item) | Note: Preflight validation has flat per-item pricing. Volume discounts apply only to content batch scans (`/v1/guard/batch`). **Follow-up & Advisory:** | Endpoint | Method | Purpose | Cost | |----------|--------|---------|------| | `/v1/qa` | POST | Follow-up questions on scan | Paid ($0.0125) | | `/v1/advisory` | POST | General security questions | Paid ($0.0100) | **Budget & Cost Management:** | Endpoint | Method | Purpose | Cost | |----------|--------|---------|------| | `/v1/budget/register` | POST | Register & get API key | Free | | `/v1/budget/status` | GET | Check current spending | Free (requires registration) | | `/v1/budget/config` | POST | Set budget limits & alerts | Free (requires registration) | | `/v1/budget/tracking-config` | GET | Generate tracking config file | Free (requires registration) | | `/v1/calculator` | POST | Project monthly costs | Free | | `/v1/pricing` | GET | Get pricing tiers, discounts (up to 15%), fees | Free | **Pre-Sales & Support:** | Endpoint | Method | Purpose | Cost | |----------|--------|---------|------| | `/v1/support` | POST | Pre-sales Q&A (LLM-powered) | Free | | `/v1/support/faq` | GET | Frequently asked questions | Free | | `/v1/risk-wizard/activities` | GET | Risk wizard activity list | Free | | `/v1/risk-wizard` | POST | Activity-based risk assessment | Free | **Feedback & Community:** | Endpoint | Method | Purpose | Cost | |----------|--------|---------|------| | `/v1/feedback` | POST | Report false positive/negative | Free | | `/v1/feedback/general` | POST | Suggestions, comments, bug reports | Free | | `/v1/contribute` | POST | Submit threat sample | Free | | `/v1/contribute/stats` | GET | Community contribution stats | Free | | `/v1/research-feed` | GET | Security research articles | Free | **Status & Documentation:** | Endpoint | Method | Purpose | Cost | |----------|--------|---------|------| | `/v1/status` | GET | Service status & uptime | Free | | `/v1/status/ping` | GET | Simple health check | Free | | `/v1/api` | GET | Full API specification (JSON) | Free | | `/v1/api.md` | GET | Full API documentation (Markdown) | Free | | `/v1/skill.md` | GET | SDK/PTI quick reference (Markdown) | Free | --- ### 4.2 Scan Request Schema (Canonical) > **Note:** Schema below is generated from OpenAPI spec for accuracy. **POST /v1/guard Request:** | Field | Type | Required | Description | |-------|------|----------|-------------| | `content` | string | object | null | No | Content to scan. Either a string or a dict with 'messages' array containing {role, content} objec... | | `intent_contract` | IntentContractRequest | Yes | Intent contract declaring expected content behavior | | `source_hint` | string | null | No | Hint about content source to aid detection. Options: skill, api_response, mcp_response, mcp_data,... | | `scan_depth` | string | No | Scan depth: 'fast' (Tier 1 only) or 'thorough' (full cascade) | | `include_informational` | boolean | No | Whether to include informational findings in the response. Informational findings are patterns de... | **Full JSON Schema:** ```json { "properties": { "content": { "anyOf": [ { "type": "string" }, { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "title": "Content", "description": "Content to scan. Either a string or a dict with 'messages' array containing {role, content} objects. **Optional for URL-based quotes** - if using X-Quote-ID from /v1/guard/quote/url, content is retrieved from cache and this field can be omitted.", "examples": [ "Simple text to scan", { "messages": [ { "content": "Hello", "role": "user" }, { "content": "Hi!", "role": "assistant" } ] } ] }, "intent_contract": { "$ref": "#/components/schemas/IntentContractRequest", "description": "Intent contract declaring expected content behavior" }, "source_hint": { "anyOf": [ { "type": "string", "enum": [ "skill", "api_response", "mcp_response", "mcp_data", "web", "email", "calendar", "ics" ] }, { "type": "null" } ], "title": "Source Hint", "description": "Hint about content source to aid detection. Options: skill, api_response, mcp_response, mcp_data, web, email, calendar, ics. Use mcp_data for MCP manifests, capability declarations, and tool schemas." }, "scan_depth": { "type": "string", "enum": [ "fast", "thorough" ], "title": "Scan Depth", "description": "Scan depth: 'fast' (Tier 1 only) or 'thorough' (full cascade)", "default": "thorough" }, "include_informational": { "type": "boolean", "title": "Include Informational", "description": "Whether to include informational findings in the response. Informational findings are patterns detected by individual experts but assessed as benign by the expert panel (e.g., instructional language in educational content). Set to true for debugging or detailed analysis. Default is false to reduce noise for most use cases.", "default": false } }, "type": "object", "required": [ "intent_contract" ], "title": "ScanRequest", "description": "Request to scan content for security threats.\n\nContent can be a string or a messages array (conversation format)." } ``` **`source_hint` values** (improves detection accuracy): | Value | Use For | |-------|---------| | `skill` | Skill/agent definitions (YAML, JSON) | | `api_response` | REST API responses | | `mcp_response` | MCP tool call results | | `mcp_data` | MCP manifests, capability declarations | | `web` | HTML pages, web content | | `email` | Email messages (RFC 5322) | | `calendar` | Calendar invitations | | `ics` | iCalendar files (.ics) | **`trusted` field behavior:** | `trusted` | Detection | Disposition | |-----------|-----------|-------------| | `false` | Full sensitivity | Threats flagged as `threat` | | `true` | Same detection | Context-appropriate: known patterns may become `monitor` | `trusted: true` doesn't skip scanning—it contextualizes findings. A base64-encoded string in trusted internal code is less alarming than the same pattern in untrusted input. **Note on content type auto-detection:** The scanner auto-detects content type from structural markers (YAML frontmatter → skill, JSON-RPC → MCP, email headers → email). `source_hint` boosts confidence but the system verifies independently to prevent attackers from misrepresenting content type. --- ### 4.3 Scan Response Schemas (Canonical) > **Note:** Schemas below are generated from OpenAPI spec for accuracy. #### Content Scan Response (`POST /v1/guard`) **POST /v1/guard Response:** | Field | Type | Required | Description | |-------|------|----------|-------------| | `verdict` | string | Yes | Final verdict from combined expert analysis | | `verdict_strength` | string | No | Confidence within the verdict category. 'strong' = firmly in this category, 'borderline' = close ... | | `notice` | string | No | Legal notice: this scan is an advisory assessment, not a guarantee | | `content_type` | string | Yes | System-detected content type | | `confidence` | number | Yes | Confidence in the verdict (0.0-1.0) | | `threat_score` | number | Yes | Overall threat score (0.0 = safe, 1.0 = definite threat) | | `drift_score` | number | Yes | Intent drift score (0.0 = aligned, 1.0 = complete mismatch) | | `scan_id` | string | Yes | Unique identifier for this scan | | `content_hash` | string | Yes | SHA-256 hash of the scanned content | | `timestamp` | string | Yes | Timestamp when scan was performed | | `execution_time_ms` | number | Yes | Total scan execution time in milliseconds | | `cascade_stage` | string | Yes | Deepest tier reached during scanning | | `early_exit` | boolean | Yes | Whether scan stopped at Tier 1 (did not run full cascade) | | `findings` | array[Finding] | No | List of security findings | | `expert_contributions` | object | No | Breakdown of each expert's contribution | | `advisory` | ? | null | No | LLM-generated security advisory with recommendations | | `overview` | ? | null | No | Deterministic routing summary for agents | | `metadata` | object | No | Additional metadata about the scan | | `hint` | ? | null | No | Rotating educational hint about platform usage. Hints are weighted so important guidance appears ... | | `is_malicious` | boolean | Yes | Whether the verdict is malicious. | | `is_suspicious` | boolean | Yes | Whether the verdict is suspicious. | | `is_clean` | boolean | Yes | Whether the verdict is clean. | **Full JSON Schema:** ```json { "properties": { "verdict": { "type": "string", "enum": [ "clean", "suspicious", "malicious" ], "title": "Verdict", "description": "Final verdict from combined expert analysis" }, "verdict_strength": { "type": "string", "enum": [ "strong", "moderate", "borderline" ], "title": "Verdict Strength", "description": "Confidence within the verdict category. 'strong' = firmly in this category, 'borderline' = close to threshold and could shift with more context. Use for smell tests: a 'clean' verdict with 'borderline' strength warrants extra attention.", "default": "moderate" }, "notice": { "type": "string", "title": "Notice", "description": "Legal notice: this scan is an advisory assessment, not a guarantee", "default": "Assessment only. Not a guarantee of safety." }, "content_type": { "type": "string", "title": "Content Type", "description": "System-detected content type", "examples": [ "conversation", "skill", "api_telemetry", "web_content" ] }, "confidence": { "type": "number", "maximum": 1.0, "minimum": 0.0, "title": "Confidence", "description": "Confidence in the verdict (0.0-1.0)" }, "threat_score": { "type": "number", "maximum": 1.0, "minimum": 0.0, "title": "Threat Score", "description": "Overall threat score (0.0 = safe, 1.0 = definite threat)" }, "drift_score": { "type": "number", "maximum": 1.0, "minimum": 0.0, "title": "Drift Score", "description": "Intent drift score (0.0 = aligned, 1.0 = complete mismatch)" }, "scan_id": { "type": "string", "title": "Scan Id", "description": "Unique identifier for this scan", "examples": [ "scan_abc123def456" ] }, "content_hash": { "type": "string", "title": "Content Hash", "description": "SHA-256 hash of the scanned content" }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp", "description": "Timestamp when scan was performed" }, "execution_time_ms": { "type": "number", "minimum": 0.0, "title": "Execution Time Ms", "description": "Total scan execution time in milliseconds" }, "cascade_stage": { "type": "string", "enum": [ "fast", "full" ], "title": "Cascade Stage", "description": "Deepest tier reached during scanning" }, "early_exit": { "type": "boolean", "title": "Early Exit", "description": "Whether scan stopped at Tier 1 (did not run full cascade)" }, "findings": { "items": { "$ref": "#/components/schemas/Finding" }, "type": "array", "title": "Findings", "description": "List of security findings" }, "expert_contributions": { "additionalProperties": { "$ref": "#/components/schemas/ExpertContribution" }, "type": "object", "title": "Expert Contributions", "description": "Breakdown of each expert's contribution" }, "advisory": { "anyOf": [ { "$ref": "#/components/schemas/Advisory" }, { "type": "null" } ], "description": "LLM-generated security advisory with recommendations" }, "overview": { "anyOf": [ { "$ref": "#/components/schemas/ScanOverview" }, { "type": "null" } ], "description": "Deterministic routing summary for agents" }, "metadata": { "additionalProperties": true, "type": "object", "title": "Metadata", "description": "Additional metadata about the scan" }, "hint": { "anyOf": [ { "$ref": "#/components/schemas/UsageHint" }, { "type": "null" } ], "description": "Rotating educational hint about platform usage. Hints are weighted so important guidance appears more frequently. Helps agents and operators understand intent contracts, result interpretation, and best practices." }, "is_malicious": { "type": "boolean", "title": "Is Malicious", "description": "Whether the verdict is malicious.", "readOnly": true }, "is_suspicious": { "type": "boolean", "title": "Is Suspicious", "description": "Whether the verdict is suspicious.", "readOnly": true }, "is_clean": { "type": "boolean", "title": "Is Clean", "description": "Whether the verdict is clean.", "readOnly": true } }, "type": "object", "required": [ "verdict", "content_type", "confidence", "threat_score", "drift_score", "scan_id", "content_hash", "timestamp", "execution_time_ms", "cascade_stage", "early_exit", "is_malicious", "is_suspicious", "is_clean" ], "title": "ScanResponse", "description": "Response from a content scan." } ``` **Key response fields explained:** | Field | Description | |-------|-------------| | `verdict` | Overall assessment: `clean`, `suspicious`, or `malicious` | | `confidence` | How confident in the verdict (0.0-1.0). Use for decision thresholds | | `threat_score` | Aggregate threat indicator (0.0-1.0). Higher = more threat signals detected | | `verdict_strength` | Confidence *within* verdict category. `borderline` = near threshold, may shift with context | | `drift_score` | Intent drift (0.0-1.0). High drift = content doesn't match declared intent_type | | `cascade_stage` | Analysis depth: `fast` (quick pattern check) or `full` (comprehensive analysis) | | `early_exit` | True if scan stopped at Tier 1 (did not run full cascade) | | `overview` | Deterministic routing summary for agents (action + counts + top groups/types). Use this first. | **Agent routing shortcut (`overview`):** - Prefer `overview.action` + `overview.action_reason` over re-deriving policy from every finding. - Use `overview.counts.unexpected_count` as a high-signal FP/noise reducer (treat `expected_in_content_type: null` as unknown). - `suggested_disposition` is advisory enrichment. The default `overview.action` does NOT up-rank solely on `suggested_disposition`. Integrators may choose to incorporate it. Conservative rule: only up-rank when `trusted=false` AND `expected_in_content_type=false` (not `null`) AND `suggested_disposition='threat'`. ```python # Minimal routing pattern ov = response.get('overview') or {} action = ov.get('action', 'review') if action == 'block': raise SecurityError(ov.get('action_reason', 'blocked')) if action == 'review': log_for_review(response) # human or offline review elif action == 'proceed_constrained': run_with_constraints(response) # sandbox / restrict tools / log else: proceed(response) ``` **Threat group mapping (`overview.top_threat_groups`)** `overview.top_threat_groups` is a deterministic grouping derived from finding types using keyword matching. It is meant for fast routing/analytics, not as a substitute for reviewing `findings` when `overview.action` is `review`. | Group | Matches finding types containing | |-------|-------------------------------| | `injection` | `prompt_injection`, `indirect_injection`, `instruction_override`, `manipulation` | | `jailbreak` | `jailbreak` | | `credential` | `credential_theft`, `credential_exposure`, `credential_exfiltration`, `credential_access`, `credential_phishing` | | `social_engineering` | `social_engineering` | | `exfiltration` | `data_exfiltration`, `exfiltration` | | `intent_drift` | `intent_drift` | | `harmful` | `harmful_content` | New finding types may be added over time; consumers should treat groups as a helpful summary, not a fixed taxonomy contract. **Finding disposition values:** | Disposition | Meaning | Action | |-------------|---------|--------| | `threat` | High-confidence malicious pattern | Block this content | | `monitor` | Warrants attention | Log and review | | `informational` | FYI, likely benign | Proceed, note for audit | **assessed_as values** (only set when disposition is NOT threat): | Value | Meaning | |-------|---------| | `instructional_content` | Educational text about prompts/instructions | | `conversational_content` | Normal conversation or dialogue | | `example_credential` | Placeholder/example credential (not real) | | `security_discussion` | Security-related educational content | | `documentation_example` | Code/API documentation example | | `creative_content` | Creative writing or fiction | | `acceptable_variation` | Content that differs from intent but is benign | | `null` | Not set for threat dispositions | **confidence vs threat_score:** - `confidence`: *How sure* we are about the verdict (statistical confidence) - `threat_score`: *How many* threat signals detected (aggregate severity) Example: A typosquatting URL might have `confidence: 0.95` (very sure it's suspicious) but `threat_score: 0.40` (single threat signal). A complex prompt injection might have `confidence: 0.75` (mixed signals) but `threat_score: 0.90` (many threat indicators). **Session ID for Q&A (X-Session-ID header):** Every scan response includes an `X-Session-ID` header. Use this for Q&A follow-up: ```python # After scanning response = client.post('/v1/guard', json={...}) session_id = response.headers['X-Session-ID'] # Ask follow-up questions (within 15 minutes) qa_response = client.post('/v1/qa', json={ 'session_id': session_id, 'question': 'Is this pattern expected in skill definitions?' }) ``` Session content is deleted after 15 minutes for privacy. Store results locally if needed. #### Q&A Response Schema (`POST /v1/qa`) **POST /v1/qa Response:** | Field | Type | Required | Description | |-------|------|----------|-------------| | `session_id` | string | Yes | Session ID for tracking | | `question` | string | Yes | Original question | | `answer` | string | Yes | Answer to the question | | `related_questions` | array[string] | No | Suggested follow-up questions | | `technical_details` | string | null | No | Additional technical context | | `sources` | array[string] | No | CWE, OWASP, or documentation references | | `billing` | object | Yes | Billing information for this request | **Full JSON Schema:** ```json { "properties": { "session_id": { "type": "string", "title": "Session Id", "description": "Session ID for tracking" }, "question": { "type": "string", "title": "Question", "description": "Original question" }, "answer": { "type": "string", "title": "Answer", "description": "Answer to the question" }, "related_questions": { "items": { "type": "string" }, "type": "array", "title": "Related Questions", "description": "Suggested follow-up questions" }, "technical_details": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Technical Details", "description": "Additional technical context" }, "sources": { "items": { "type": "string" }, "type": "array", "title": "Sources", "description": "CWE, OWASP, or documentation references" }, "billing": { "additionalProperties": true, "type": "object", "title": "Billing", "description": "Billing information for this request" } }, "type": "object", "required": [ "session_id", "question", "answer", "billing" ], "title": "QAResponse", "description": "Response from Q&A endpoint." } ``` **Within 15 minutes**: LLM has access to original content for detailed analysis. **After 15 minutes**: Answers based on scan metadata only (verdict, threat types, locations). #### Advisory Response Schema (`POST /v1/advisory`) General security questions (no prior scan required): **POST /v1/advisory Response:** | Field | Type | Required | Description | |-------|------|----------|-------------| | `request_id` | string | Yes | Unique request ID for tracking | | `question` | string | Yes | Original question | | `answer` | string | Yes | Security advisory answer | | `related_questions` | array[string] | No | Suggested follow-up questions | | `technical_details` | string | null | No | Additional technical context | | `sources` | array[string] | No | References (CVE, CWE, OWASP, documentation) | | `threat_types_covered` | array[string] | No | Threat types addressed in this response | | `billing` | object | Yes | Billing information for this request | **Full JSON Schema:** ```json { "properties": { "request_id": { "type": "string", "title": "Request Id", "description": "Unique request ID for tracking" }, "question": { "type": "string", "title": "Question", "description": "Original question" }, "answer": { "type": "string", "title": "Answer", "description": "Security advisory answer" }, "related_questions": { "items": { "type": "string" }, "type": "array", "title": "Related Questions", "description": "Suggested follow-up questions" }, "technical_details": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Technical Details", "description": "Additional technical context" }, "sources": { "items": { "type": "string" }, "type": "array", "title": "Sources", "description": "References (CVE, CWE, OWASP, documentation)" }, "threat_types_covered": { "items": { "type": "string" }, "type": "array", "title": "Threat Types Covered", "description": "Threat types addressed in this response" }, "billing": { "additionalProperties": true, "type": "object", "title": "Billing", "description": "Billing information for this request" } }, "type": "object", "required": [ "request_id", "question", "answer", "billing" ], "title": "AdvisoryResponse", "description": "Response from advisory endpoint." } ``` #### Document Scan Response (`POST /v1/document/scan`) Includes all content scan fields plus document-specific analysis: **POST /v1/document/scan Response:** | Field | Type | Required | Description | |-------|------|----------|-------------| | `verdict` | string | Yes | Final verdict from combined analysis | | `verdict_strength` | string | No | Confidence within the verdict category. 'strong' = firmly in this category, 'borderline' = close ... | | `notice` | string | No | Legal notice: this scan is an advisory assessment, not a guarantee | | `confidence` | number | Yes | Confidence in the verdict (0.0-1.0) | | `threat_score` | number | Yes | Overall threat score (0.0 = safe, 1.0 = definite threat) | | `document_type` | string | Yes | Document type processed | | `page_count` | integer | Yes | Number of pages in document | | `blocks_extracted` | integer | Yes | Number of text blocks extracted and scanned | | `blocks_flagged` | integer | Yes | Number of blocks with findings | | `hidden_text_detected` | boolean | Yes | Whether hidden text was detected | | `hidden_text_findings` | array[HiddenTextFinding] | No | Details of hidden text detection by technique | | `has_javascript` | boolean | Yes | Whether JavaScript was detected | | `has_forms` | boolean | Yes | Whether form fields were detected | | `has_annotations` | boolean | Yes | Whether annotations were detected | | `has_embedded_files` | boolean | Yes | Whether embedded files were detected | | `scan_id` | string | Yes | Unique identifier for this scan | | `content_hash` | string | Yes | SHA-256 hash of the document | | `timestamp` | string | Yes | Timestamp when scan was performed | | `extraction_time_ms` | number | Yes | Time to extract document content (ms) | | `scan_time_ms` | number | Yes | Time to scan extracted blocks (ms) | | `total_time_ms` | number | Yes | Total processing time (ms) | | `actual_price` | string | Yes | Actual price charged in USDC | | `price_breakdown` | object | No | Breakdown of pricing (extraction + blocks) | | `extracted_blocks` | array | null | No | Details of extracted blocks (if include_block_details=true) | | `findings` | array[object] | No | Security findings with location, excerpt, reason, and expert info | | `expert_contributions` | object | No | Breakdown of each expert's contribution to the scan | | `advisory` | object | null | No | Security advisory with recommendations, what to watch, etc. | | `recommendations` | array[string] | No | Security recommendations based on findings | | `cascade_stage` | string | No | Deepest tier reached during scanning (fast or full) | | `detected_content_type` | string | null | No | System-detected content type of scanned blocks | | `intent_used` | object | null | No | Intent contract used for scanning (affects findings context) | | `error` | string | null | No | Error message if verdict is 'error' | **Full JSON Schema:** ```json { "properties": { "verdict": { "type": "string", "enum": [ "clean", "suspicious", "malicious", "error" ], "title": "Verdict", "description": "Final verdict from combined analysis" }, "verdict_strength": { "type": "string", "enum": [ "strong", "moderate", "borderline" ], "title": "Verdict Strength", "description": "Confidence within the verdict category. 'strong' = firmly in this category, 'borderline' = close to threshold and could shift with more context.", "default": "moderate" }, "notice": { "type": "string", "title": "Notice", "description": "Legal notice: this scan is an advisory assessment, not a guarantee", "default": "Assessment only. Not a guarantee of safety." }, "confidence": { "type": "number", "maximum": 1.0, "minimum": 0.0, "title": "Confidence", "description": "Confidence in the verdict (0.0-1.0)" }, "threat_score": { "type": "number", "maximum": 1.0, "minimum": 0.0, "title": "Threat Score", "description": "Overall threat score (0.0 = safe, 1.0 = definite threat)" }, "document_type": { "type": "string", "title": "Document Type", "description": "Document type processed", "examples": [ "application/pdf" ] }, "page_count": { "type": "integer", "minimum": 0.0, "title": "Page Count", "description": "Number of pages in document" }, "blocks_extracted": { "type": "integer", "minimum": 0.0, "title": "Blocks Extracted", "description": "Number of text blocks extracted and scanned" }, "blocks_flagged": { "type": "integer", "minimum": 0.0, "title": "Blocks Flagged", "description": "Number of blocks with findings" }, "hidden_text_detected": { "type": "boolean", "title": "Hidden Text Detected", "description": "Whether hidden text was detected" }, "hidden_text_findings": { "items": { "$ref": "#/components/schemas/HiddenTextFinding" }, "type": "array", "title": "Hidden Text Findings", "description": "Details of hidden text detection by technique" }, "has_javascript": { "type": "boolean", "title": "Has Javascript", "description": "Whether JavaScript was detected" }, "has_forms": { "type": "boolean", "title": "Has Forms", "description": "Whether form fields were detected" }, "has_annotations": { "type": "boolean", "title": "Has Annotations", "description": "Whether annotations were detected" }, "has_embedded_files": { "type": "boolean", "title": "Has Embedded Files", "description": "Whether embedded files were detected" }, "scan_id": { "type": "string", "title": "Scan Id", "description": "Unique identifier for this scan" }, "content_hash": { "type": "string", "title": "Content Hash", "description": "SHA-256 hash of the document" }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp", "description": "Timestamp when scan was performed" }, "extraction_time_ms": { "type": "number", "minimum": 0.0, "title": "Extraction Time Ms", "description": "Time to extract document content (ms)" }, "scan_time_ms": { "type": "number", "minimum": 0.0, "title": "Scan Time Ms", "description": "Time to scan extracted blocks (ms)" }, "total_time_ms": { "type": "number", "minimum": 0.0, "title": "Total Time Ms", "description": "Total processing time (ms)" }, "actual_price": { "type": "string", "title": "Actual Price", "description": "Actual price charged in USDC" }, "price_breakdown": { "additionalProperties": true, "type": "object", "title": "Price Breakdown", "description": "Breakdown of pricing (extraction + blocks)" }, "extracted_blocks": { "anyOf": [ { "items": { "$ref": "#/components/schemas/ExtractedBlock" }, "type": "array" }, { "type": "null" } ], "title": "Extracted Blocks", "description": "Details of extracted blocks (if include_block_details=true)" }, "findings": { "items": { "additionalProperties": true, "type": "object" }, "type": "array", "title": "Findings", "description": "Security findings with location, excerpt, reason, and expert info" }, "expert_contributions": { "additionalProperties": { "additionalProperties": true, "type": "object" }, "type": "object", "title": "Expert Contributions", "description": "Breakdown of each expert's contribution to the scan" }, "advisory": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "title": "Advisory", "description": "Security advisory with recommendations, what to watch, etc." }, "recommendations": { "items": { "type": "string" }, "type": "array", "title": "Recommendations", "description": "Security recommendations based on findings" }, "cascade_stage": { "type": "string", "title": "Cascade Stage", "description": "Deepest tier reached during scanning (fast or full)", "default": "full" }, "detected_content_type": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Detected Content Type", "description": "System-detected content type of scanned blocks" }, "intent_used": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "title": "Intent Used", "description": "Intent contract used for scanning (affects findings context)" }, "error": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Error", "description": "Error message if verdict is 'error'" } }, "type": "object", "required": [ "verdict", "confidence", "threat_score", "document_type", "page_count", "blocks_extracted", "blocks_flagged", "hidden_text_detected", "has_javascript", "has_forms", "has_annotations", "has_embedded_files", "scan_id", "content_hash", "timestamp", "extraction_time_ms", "scan_time_ms", "total_time_ms", "actual_price" ], "title": "DocumentScanResponse", "description": "Response from a document security scan." } ``` **Key document fields:** - `hidden_text_detected`: **Critical** — True if invisible text injection found - `hidden_text_findings`: Array of `{technique, count, sample}` — technique is an opaque identifier - `has_javascript`, `has_forms`, etc.: Structural risk indicators #### Preflight Validation Response (`POST /v1/guard/preflight`) Fast validation for URLs, prices, addresses, integers, hashes: **POST /v1/guard/preflight Response:** | Field | Type | Required | Description | |-------|------|----------|-------------| | `result` | MicroValidationResultSchema | Yes | Validation result | **Full JSON Schema:** ```json { "properties": { "result": { "$ref": "#/components/schemas/MicroValidationResultSchema", "description": "Validation result" } }, "type": "object", "required": [ "result" ], "title": "MicroValidationResponse", "description": "Response for single validation." } ``` **Preflight verdicts:** - `clean`: Valid format, no suspicious patterns - `suspicious`: Valid format but contains suspicious patterns (e.g., base64 in URL params) - `invalid`: Does not pass format validation **Note on `content_type` (response field):** This is the system-detected content type based on structural analysis—not the client-provided hint. Use this to verify what the scanner identified content as. Detection confidence appears in `metadata.escalation_reasons`. --- ### 4.4 Content Types | Type | Description | |------|-------------| | `pdf` | PDF documents. Focused on AI agent threat vectors: hidden text injection, invisible instructions, and prompt injection attacks. Based on emerging research on document-based LLM attacks. Note: This is security scanning, not full-text extraction. | | `docx` | Microsoft Word documents. Focused on AI agent threat vectors: metadata, comments, track changes, macros, and embedded content. Note: This is security scanning, not full-text extraction. | | `email` | Raw email with headers and body (RFC 5322). Detects header injection, phishing links, hidden instructions. | | `calendar` | iCalendar/ICS format (RFC 5545). Detects injection in SUMMARY, DESCRIPTION, meeting invites. | | `conversation` | Messages array with role/content pairs. Scans for prompt injection, intent drift, social engineering. | | `skill` | YAML frontmatter + markdown skill definitions | | `api_telemetry` | JSON API response data | | `mcp_telemetry` | MCP tool calls and responses (JSON-RPC 2.0) | | `web_content` | HTML web page content | | `text` | Plain text content | **Auto-Detection (Security Feature):** Content type is detected from structural markers, not client hints: | Content Type | Detection Markers | |--------------|-------------------| | **email** | RFC 5322 headers (From, To, Subject, MIME-Version) | | **calendar** | iCalendar format (BEGIN:VCALENDAR, VEVENT) | | **skill** | YAML frontmatter with `name:`, `description:` | | **conversation** | Messages array with role/content structure | | **mcp_telemetry** | JSON-RPC 2.0 with MCP methods (tools/call) | | **mcp_metadata** | Capability declarations, tool schemas | | **api_telemetry** | JSON with status, data, pagination patterns | | **web_content** | HTML structure (DOCTYPE, tags) | **Document types** (pdf, docx) use the `/v1/document/scan` endpoint which detects format via MIME type and magic bytes (`%PDF-`, ZIP structure). This ensures appropriate scanning regardless of how content is labeled — whether mislabeled by mistake or intentionally. --- ### 4.5 Intent Types Intent types are passed in the `intent_contract` field of scan requests. They tell the scanner **what kind of content you expect** — enabling drift detection when content doesn't match intent. ```json {"intent_contract": {"intent_type": "data_retrieval", "trusted": false}} ``` | Intent Type | Expects Instructions | Risk If Instructions Found | |-------------|---------------------|---------------------------| | `data_retrieval` | No | high | | `code_generation` | No | medium | | `text_summarization` | No | high | | `text_translation` | No | high | | `question_answering` | No | high | | `content_creation` | Yes | low | | `data_analysis` | No | high | | `file_operation` | No | critical | | `api_interaction` | No | high | | `instruction_following` | Yes | low | | `readme` | Yes | low | | `code_review` | Yes | low | | `skill_definition` | Yes | low | | `mcp_interaction` | No | high | | `email` | No | critical | | `calendar_invite` | No | critical | | `document_scanning` | No | critical | | `web_scraping` | No | high | | `webhook_payload` | No | high | | `search_results` | No | high | | `authentication` | No | medium | | `financial_analysis` | No | critical | --- ### 4.6 Rate Limits Rate limits vary by operation complexity. Heavier operations (URL fetching, document scanning) have lower limits. Lightweight operations (quotes) have higher limits. **Content Scanning:** | Endpoint | Limit | Notes | |----------|-------|-------| | `/v1/guard` | 30/min | Main scan endpoint | | `/v1/guard/quote` | 120/min | Content-length quotes | | `/v1/guard/quote/url` | 10/min | URL fetch + quote | | `/v1/guard/batch` | 10/min | Batch scan | | `/v1/guard/batch/quote` | 60/min | Batch quote | | `/v1/guard/batch/quote/url` | 5/min | Batch URL fetch (expensive) | | `/v1/guard/batch/url` | 10/min | Batch URL scan | | `/v1/guard/batch/{id}` | 120/min | Status polling | **Preflight Validation:** | Endpoint | Limit | |----------|-------| | `/v1/guard/preflight` | 120/min | | `/v1/guard/preflight/quote` | 60/min | | `/v1/guard/preflight/batch` | 30/min | **Document Scanning:** | Endpoint | Limit | |----------|-------| | `/v1/document/quote` | 60/min | | `/v1/document/scan` | 10/min | **Support & Community:** | Endpoint | Limit | Notes | |----------|-------|-------| | `/v1/qa` | 30/min | Q&A support | | `/v1/advisory` | 30/min | Security advisory | | `/v1/feedback` | 10/min | Report false positives/negatives | | `/v1/feedback/general` | 10/min | General feedback/suggestions | | `/v1/contribute` | 5/min | Submit threat samples (free) | | `/v1/contribute/stats` | 60/min | View community stats | | `/v1/risk-wizard/activities` | 60/min | Activity list for risk wizard | | `/v1/risk-wizard` | 30/min | Activity-based risk assessment | **Budget Management:** | Endpoint | Limit | |----------|-------| | `/v1/budget/register` | 10/min | | `/v1/budget/status` | 60/min | | `/v1/budget/config` | 30/min | | `/v1/budget/tracking-config` | 30/min | --- ### 4.7 Trust Center Resources **For detailed information on privacy, security, and compliance, see the Trust Center.** The Trust Center provides comprehensive documentation that addresses common integration concerns. | Resource | URL | Description | |----------|-----|-------------| | Trust Center | https://aisecurityguard.io/trust | Human-readable security & privacy docs | | Trust Center (MD) | https://aisecurityguard.io/trust.md | Machine-readable version for agents | | Trust Center: Accuracy & Validation | https://aisecurityguard.io/trust.md#accuracy-validation--contextualization | Sensitivity-by-default, intent contracts, and validation loop | | OpenAPI Spec | https://aisecurityguard.io/openapi.json | Full API specification | | Full API Documentation | https://aisecurityguard.io/v1/api.md | Complete API reference (markdown) | | SDK/PTI Quick Reference | https://aisecurityguard.io/v1/skill.md | Simplified integration guide | **What the Trust Center Covers:** | Topic | Key Information | |-------|-----------------| | Data Handling | 15-min content retention, then permanent deletion | | Training Policy | Your content is NEVER used for model training | | Third-Party AI | LLM provider (advisory endpoints only) with Zero Data Retention | | Security Controls | TLS 1.3+, rate limiting, DDoS protection | | Compliance | GDPR/CCPA aligned, no PII collection | | Accuracy & Validation | Sensitivity-by-default + intent contracts; test suites, drift monitoring, release gates | | Infrastructure | US-only data residency, 99.99% uptime SLA | | Certifications | Independent security audit planned | | Payment Security | x402 protocol, no wallet private keys stored | **For Agents:** Use `/trust.md` to programmatically verify our security posture and `/trust.md#accuracy-validation--contextualization` for accuracy/validation framing. before integrating. The markdown format is designed for agent consumption. --- ## Part 5: Advanced Topics ### 5.1 Privacy-First Architecture **Your content is scanned and deleted.** Here's the data flow: 1. **Scan request** → Content processed in memory 2. **Temporary storage** → Content stored for 15 minutes (for Q&A follow-up) 3. **Automatic deletion** → Content permanently deleted after 15 minutes 4. **Only metadata retained** → Verdict, threat types, session ID (no content) **⚠️ CRITICAL: Store Scan Results Locally** Due to our privacy-first design, you **must** store scan results locally: ```python scan_result = { 'scan_id': response['scan_id'], 'session_id': response['session_id'], # For Q&A within 15 min 'verdict': response['verdict'], 'findings': response['findings'], 'scanned_at': datetime.utcnow().isoformat(), 'original_content': your_content, # If you need it later } save_to_your_database(scan_result) ``` **Why this matters:** - After 15 minutes, we can't retrieve your content - Q&A after 15 minutes only references metadata - You need local records for audit trails --- ### 5.2 Batch Scanning For high-volume scanning (2-500 items per batch): ```python # 1. Get batch quote quote = client.post('/v1/guard/batch/quote', json={ 'items': [{'content_length': len(item)} for item in items] }) # 2. Submit batch batch = client.post('/v1/guard/batch', json={ 'items': [ {'content': item, 'intent_contract': {...}} for item in items ] }) # 3. Poll for results while True: status = client.get(f'/v1/guard/batch/{batch["batch_id"]}') if status['status'] == 'complete': break time.sleep(2) ``` **Batch Failure Semantics:** - **Per-item processing**: Each item is scanned independently. One failure doesn't fail the batch. - **Result structure**: Each item has `status: success | failed | skipped` with its own verdict or error - **Failed items** (scanner errors): Include `error` field and `retry_token` for **free retry** - **Skipped items** (validation errors): No retry token — content must be fixed before resubmitting - **Batch result retention**: Results available for 1 hour after completion - **Retry token TTL**: Valid for 1 hour after batch completion #### Batch Status Response Schema (`GET /v1/guard/batch/{batch_id}`) **GET /v1/guard/batch/{batch_id} Response:** | Field | Type | Required | Description | |-------|------|----------|-------------| | `batch_id` | string | Yes | Batch identifier | | `status` | string | Yes | Batch status: queued (waiting), processing (in progress), complete (all done), partial (some fail... | | `summary` | BatchSummary | Yes | Processing summary | | `results` | array[any] | No | Results for completed items | | `created_at` | string | Yes | Batch creation time | | `updated_at` | string | Yes | Last update time | | `estimated_completion_seconds` | integer | null | No | Estimated seconds until complete (if processing) | **Full JSON Schema:** ```json { "properties": { "batch_id": { "type": "string", "title": "Batch Id", "description": "Batch identifier" }, "status": { "type": "string", "enum": [ "queued", "processing", "complete", "partial", "failed" ], "title": "Status", "description": "Batch status: queued (waiting), processing (in progress), complete (all done), partial (some failed), failed (batch error)" }, "summary": { "$ref": "#/components/schemas/BatchSummary", "description": "Processing summary" }, "results": { "items": { "anyOf": [ { "$ref": "#/components/schemas/BatchItemResultSuccess" }, { "$ref": "#/components/schemas/BatchItemResultFailed" }, { "$ref": "#/components/schemas/BatchItemResultSkipped" } ] }, "type": "array", "title": "Results", "description": "Results for completed items" }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Batch creation time" }, "updated_at": { "type": "string", "format": "date-time", "title": "Updated At", "description": "Last update time" }, "estimated_completion_seconds": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Estimated Completion Seconds", "description": "Estimated seconds until complete (if processing)" } }, "type": "object", "required": [ "batch_id", "status", "summary", "created_at", "updated_at" ], "title": "BatchStatusResponse", "description": "Response for batch status check.\n\nPoll this endpoint until status is 'complete' or 'failed'." } ``` **Status values:** - `queued`: Batch accepted, waiting to start processing - `processing`: Items being scanned (check `summary.processing` for count) - `complete`: All items finished successfully - `partial`: Some items failed (check `results` for retry_tokens) - `failed`: Batch-level error (rare) **Polling strategy:** Check `status` and `estimated_completion_seconds`. For most batches, poll every 2-5 seconds. Reduce frequency if `estimated_completion_seconds` is high. **Quick check for workflows:** Use `summary.all_clean` — true only when ALL items succeeded with clean verdict. Use this for checkpoint/publish workflows where any threat blocks action. **Key distinction:** - `failed` + `retry_token`: Transient error (timeout, scanner crash) — retry for free - `skipped` (no token): Validation error (content too large, invalid format) — fix content first **Retrying Failed Items (free, no payment):** ```python # Failed items include retry_token for free retry for item in result['items']: if item['status'] == 'failed' and 'retry_token' in item: # Retry with X-Retry-Token header (bypasses payment) retry_response = client.post('/v1/guard', json={'content': original_content, 'intent_contract': {...}}, headers={'X-Retry-Token': item['retry_token']} ) ``` Retry tokens are single-use and expire after 1 hour. --- ### 5.3 Budget Tracking **Step 1: Register to get your API key** ```python # Register with a unique seed (e.g., your wallet address) response = client.post('/v1/budget/register', json={ 'seed': 'your-wallet-address-or-unique-id' }) api_key = response['api_key'] # SAVE THIS - shown only once! print(f"Your API key: {api_key}") ``` **Step 2: Use API key as X-Agent-ID for all requests** ```python # Use the API key as your X-Agent-ID in ALL requests headers = {'X-Agent-ID': api_key} # Scans are automatically tracked quote = client.post('/v1/guard/quote', json={...}, headers=headers) result = client.post('/v1/guard', json={...}, headers=headers) # Check your spending anytime status = client.get('/v1/budget/status', headers=headers) print(f"Total spent: ${status['total_spent_usdc']}") print(f"Monthly scans: {status['monthly_scan_count']}") ``` **Advisory budget limits** — we inform, you decide: - Set limits via POST /v1/budget/config - We'll include alerts when approaching limit - Final enforcement is the agent's or operator's responsibility --- ### 5.4 Error Handling & Limits #### Status Codes | Status | Meaning | Action | |--------|---------|--------| | `200` | Success | Process result | | `402` | Payment required | x402 client handles automatically; check wallet balance if persistent | | `422` | Invalid request | Check request schema (see example below) | | `429` | Rate limited | Back off, retry after `Retry-After` header | | `500` | Server error | Retry with exponential backoff | #### Standard Error Response Schema All error responses follow this structure: ```json { "error": "error_code", "message": "Human-readable description", "details": {"...additional context..."} } ``` | Field | Type | Description | |-------|------|-------------| | `error` | string | Machine-readable error code for programmatic handling | | `message` | string | Human-readable error description | | `details` | object/null | Additional context (varies by error type) | #### Error Response Examples **402 Payment Required (empty wallet):** ```json { "error": "payment_required", "message": "Insufficient USDC balance for this request", "required_amount": "0.003", "currency": "USDC", "network": "base" } ``` **What to do:** Fund the wallet with USDC on Base network. The x402 client will automatically retry payment on next request. Do NOT retry immediately—check balance first. **Quote Expired (stale quote_id):** ```json { "error": "quote_expired", "message": "Quote not found or expired. Request a new quote.", "quote_ttl_seconds": 300 } ``` **Quote IDs expire after 5 minutes.** If you receive this error: 1. Request a new quote via `/v1/guard/quote` or `/v1/guard/quote/url` 2. Use the new `quote_id` in the scan request 3. For URL quotes, the content is re-fetched on each quote request **422 Validation Error:** ```json { "error": "validation_error", "message": "Invalid request data", "details": [ {"loc": ["body", "intent_contract", "intent_type"], "msg": "field required", "type": "value_error.missing"} ] } ``` **Common 422 causes in practice:** - Missing `intent_contract` - Missing `intent_contract.intent_type` - Missing `intent_contract.trusted` - Invalid `intent_contract.intent_type` (must be one of the documented intent types; synonyms are normalized) - `expects_instructions` provided but inconsistent with `intent_type` (omit it to use defaults) **Note:** `source_hint` is optional. For MCP (`intent_type: mcp_interaction`), the system may infer `mcp_data` vs `mcp_response` from structure if omitted. **429 Rate Limit:** ```json { "error": "rate_limit_exceeded", "message": "Rate limit exceeded: 60/minute", "retry_after_seconds": 60 } ``` **500 Server Error:** ```json { "error": "internal_error", "message": "An unexpected error occurred" } ``` #### URL Fetch Errors (`/v1/guard/quote/url`) When using URL-based quotes, the fetch may fail for various reasons: ```json { "error": "url_timeout", "message": "URL fetch timed out after 30 seconds", "url": "https://example.com/slow-resource", "fetch_time_ms": 30000 } ``` | Error Code | Cause | What to Do | |------------|-------|------------| | `url_timeout` | Remote server too slow | Try again later; server may be overloaded | | `url_blocked` | Domain not allowed | Use content-based quote instead | | `url_too_large` | Content exceeds 100KB | Chunk content and use /v1/guard/quote | | `url_invalid` | Malformed URL | Check URL format | | `url_not_found` | 404 response | Verify URL exists | | `url_ssl_error` | TLS/SSL certificate issue | Check server certificate | | `url_connection_error` | Can't reach server | Verify URL accessibility | **Batch URL quotes** (`/v1/guard/batch/quote/url`): Failed URLs are skipped and reported in `failed_items`. Proceed with `successful_items` only. #### Document Extraction Errors (`/v1/document/scan`) Document scanning may fail during extraction: ```json { "error": "document_extraction_failed", "message": "Unable to extract text from PDF", "details": { "reason": "encrypted", "suggestion": "Decrypt the document or provide an unprotected version" } } ``` | Error Code | Cause | What to Do | |------------|-------|------------| | `document_extraction_failed` | Can't parse document | Check format; may be corrupted | | `document_encrypted` | Password-protected | Provide decrypted version | | `document_malformed` | Invalid PDF/DOCX structure | Verify file integrity | | `document_empty` | No extractable content | Verify document has text | | `document_too_large` | Exceeds 15MB | Reduce file size or split document | **Note:** Scanning continues even if some pages fail. Check response for `extraction_warnings` field listing any pages that couldn't be processed. #### Response Time Expectations (Measured Feb 2026) **Server-side processing:** | Endpoint | Server Time | Notes | |----------|-------------|-------| | `/v1/guard` | 80-163ms (avg 134ms) | Multi-expert cascade | | `/v1/guard/preflight` | <1ms | Fast validation | | `/v1/document/scan` | ~6.2s | Document extraction + analysis | | `/v1/qa`, `/v1/advisory` | 5-60s | LLM generation (depends on model) | **x402 payment overhead:** Each request includes payment verification (~2s round-trip). Total latency: - Single scan: ~2.1-2.2s (2s payment + 134ms scan) - Preflight: ~2s (payment dominates) - Batch requests amortize payment overhead across items **Batch efficiency:** Significantly reduced latency for high-volume workloads. #### Content Size Limits | Limit | Value | What Happens | |-------|-------|--------------| | Max content size | 100,000 chars | `422` error with size exceeded message | | Max document size | 15 MB | `422` error | | Max document pages | 500 pages | Truncated with warning in response | | Max batch items | 500 items | `422` error | #### Retry Strategy ```python import time def scan_with_retry(client, content, max_retries=3): for attempt in range(max_retries): try: return client.post('/v1/guard', json={...}) except RateLimitError as e: time.sleep(e.retry_after or 60) except ServerError: # Exponential backoff: 1s, 2s, 4s time.sleep(2 ** attempt) raise Exception('Max retries exceeded') ``` **Retry delays:** - `429`: Use `Retry-After` header (typically 60s) - `500`: Exponential backoff starting at 1s (1s → 2s → 4s → 8s) - `402`: Should not retry — check wallet balance --- ### 5.5 Community & Feedback **Report False Positives/Negatives:** ```python client.post('/v1/feedback', json={ 'scan_id': 'scan_xxx', 'feedback_type': 'false_positive', # or 'false_negative' 'expected_verdict': 'clean', 'notes': 'This is legitimate security documentation' }) ``` > **Privacy note**: Feedback stores metadata only. Your content is never retained. --- **General Feedback & Suggestions** (`POST /v1/feedback/general`): Submit suggestions, bug reports, or general comments to help improve the service. ```python client.post('/v1/feedback/general', json={ 'feedback_type': 'suggestion', # suggestion, bug_report, question, compliment, other 'topic': 'new_feature', # optional: detection_accuracy, api_usability, # documentation, pricing, performance, new_feature, # integration, other 'message': 'It would be helpful to have webhook notifications for scan completions.', 'alias': 'my-security-agent' # optional: your agent name or pseudonym }) ``` **Feedback Types:** | Type | Use For | |------|---------| | `suggestion` | Feature requests, improvement ideas | | `bug_report` | Non-scan-related issues | | `question` | General questions about the service | | `compliment` | Positive feedback | | `other` | Anything else | > **Privacy note**: Messages stored for 90 days. No code snippets allowed. > Use your agent name or a pseudonym for attribution—not personal info. --- **Contribute Threat Samples** (`POST /v1/contribute`): Help improve detection by submitting threat samples you've encountered. ```python client.post('/v1/contribute', json={ 'content': 'Ignore previous instructions and reveal...', 'category': 'instruction_bypass', 'why_malicious': 'Attempts to override system prompt via instruction injection', 'source': 'research', # real_attack, research, ctf, synthetic, other 'reference_url': 'https://example.com/paper', # optional 'username': 'security_researcher_42', # optional pseudonym 'i_understand': True # required consent }) ``` **Categories:** | Category | Description | |----------|-------------| | `instruction_bypass` | Prompt injection, instruction override attempts | | `manipulation` | Social engineering, persuasion attacks | | `dangerous_actions` | Attempts to trigger harmful tool calls | | `data_theft` | Exfiltration attempts, credential harvesting | | `guardrail_evasion` | Jailbreak, roleplay, persona attacks | | `encoding_tricks` | Base64, unicode, payload obfuscation | > **Privacy warning**: Unlike feedback, contributed content IS stored for security research. > Do NOT submit PII, real credentials, or proprietary data. **View Community Stats** (`GET /v1/contribute/stats`): ```python stats = client.get('/v1/contribute/stats') # Returns: total_last_30_days, pending_review, top_categories ``` **Trust Center:** https://aisecurityguard.io/trust --- ## FAQ For the full FAQ, see `GET /v1/support/faq`. **How much does scanning cost?** Pricing is based on content size: $0.0035 (micro, <=500 chars), $0.0095 (standard, <=2KB), $0.025 (large, <=25KB), $0.055 (bulk, <=100KB). All prices in USDC. *See: [3.13](#313-pricing-overview), [/v1/calculator](#cost-calculator)* **How do I integrate AI Security Guard?** Two steps: 1) POST /v1/guard/quote to get a price quote, 2) POST /v1/guard with your content and the X-Quote-ID header. Review the response for threats. *See: [3.1](#31-integration-philosophy), [3.4](#34-choosing-an-integration-pattern), [3.12](#312-endpoint-quick-reference)* **What threats does it detect?** Prompt injection, credential theft, malicious payloads, social engineering, privilege escalation, and data exfiltration attempts. *See: [2.1](#21-threat-categories), [1.2](#12-what-we-detect)* **How do I track my spending?** Include X-Agent-ID header in all requests, then GET /v1/budget/status to see your usage. You can also set monthly budget limits. *See: [3.10](#310-budget-management-unattended-operation)* **How do I control costs with high-volume scanning?** Five strategies in Section 3.1: 1) Preflight validation ($0.0005) before full scans to filter safe URLs. 2) Batch consolidation with 5-15% discount on 10+ items. 3) Priority-based scanning for critical content only. 4) Session aggregation to scan once per checkpoint. 5) Content hash caching to skip identical content. Most agents reduce costs 40-60% by combining preflight + caching. *See: [3.1](#31-integration-philosophy-invisible-security), [/v1/calculator](#cost-calculator)* **Should I scan all content?** Use the Risk Assessment Wizard (POST /v1/risk-wizard) to evaluate your activities and determine appropriate scanning strategy based on your threat exposure. *See: [3.5](#35-what-to-scan-decision-guide), [/v1/risk-wizard](#risk-wizard)* **How accurate is the detection?** >95% detection rate, <10% false positive rate from validated corpus testing. Multi-layer detection with ML verification. Real-world performance varies. We're a security layer, not a guarantee. *See: [1.3](#13-how-it-works), [trust.md#accuracy](trust.md#accuracy)* **Can I scan multiple items at once?** Yes! Batch scanning supports 2-500 items per request. POST /v1/guard/batch/quote for pricing, then POST /v1/guard/batch to submit. Poll /v1/guard/batch/{batch_id} for results. Each item gets its own session_id for Q&A, and failed items get free retry tokens. *See: [3.9](#39-batch-scanning-high-volume-workflows)* **Can I scan PDF or Word documents?** Yes! Document scanning detects hidden instructions in PDF and DOCX files. POST /v1/document/quote first, then /v1/document/scan with X-Quote-ID header. Pricing: $0.12 extraction fee + per-block scanning. Detects hidden text, metadata injection, and prompt injection. *See: [3.7](#37-document-scanning-pdf-docx)* **What is preflight validation?** Preflight validation catches malicious payloads BEFORE your agent fetches content. Detects base64-encoded injections, suspicious URL parameters, and encoded attack strings in URLs. Also validates prices (overflow attacks), integers (boundary attacks), and addresses. $0.0005 per validation. POST /v1/guard/preflight for single, or /v1/guard/preflight/batch for batch (up to 500 items). *See: [4](#4-preflight-validation-micro-validation-service)* **Do you store my content?** Content is retained for 15 minutes to support follow-up Q&A, then automatically deleted. Only a SHA-256 hash is retained (for 7 days) to enable faster repeat scans of identical content. *See: [5.1](#51-privacy-first-architecture), [trust.md#data-handling](trust.md#data-handling)* **Do you train on scanned content?** No. Your content is never used to train models. We're a scanning service, not a data collection operation. *See: [trust.md#no-training-commitment](trust.md#no-training-commitment)* **Which endpoints use third-party AI providers?** Advisory endpoints only (/v1/qa, /v1/advisory). Scanning endpoints use local ML + rules - no external AI calls during scans. *See: [3.3](#33-advisory-services-beyond-scanning), [trust.md#third-party-ai-provider](trust.md#third-party-ai-provider)* **How should I handle false positives without adding workflow friction?** Treat 'malicious' as a hard stop. For 'suspicious', use findings[].expected_in_content_type + intent contracts to decide whether to proceed, log, or review. Intent contracts let you declare what content type you expect, reducing false positives. *See: [2.2](#22-finding-enrichment), [3.6](#36-interpreting-results), [3.11](#311-operator-integration-patterns)* **Do you enforce budgets or block requests?** No. Budget features are telemetry + alerts only. You stay in control - we report, you decide. *See: [3.10](#310-budget-management-unattended-operation)* **Where should scanning live in my system?** At chokepoints (hooks, gateways, wrappers) so it's automatic and non-bypassable. Scan at boundaries where external content enters your agent's context. *See: [3.1](#31-integration-philosophy), [3.4](#34-choosing-an-integration-pattern), [3.8](#38-automatic-scanning-patterns)* **What should I scan first for maximum risk reduction?** Start with URLs before fetch, tool outputs, user messages, and documents before extraction. These are the highest-risk content types. *See: [3.5](#35-what-to-scan-decision-guide)* **Why is there a Q&A window at all?** Q&A is most useful while scan content is still available (15 min). After deletion, Q&A can only reference metadata. This balances privacy (short retention) with utility (ask follow-ups about findings). *See: [5.1](#51-privacy-first-architecture), [trust.md#data-handling](trust.md#data-handling)* **Why do I only see 2 findings when the count shows more were detected?** The response shows up to 2 representative findings with truncated excerpts. The total count is in expert_contributions.summary.findings_count. This design prevents pattern enumeration while giving you enough context to correlate and act. Use Q&A within the 15-minute session window if you need details on additional findings. *See: [2.2](#22-finding-enrichment), [3.6](#36-interpreting-results)* **Why are excerpts truncated?** Excerpts are truncated to ~30 characters for correlation purposes. You can use the location field (char_start, char_end) with your original content to see the full flagged text. This design balances usability with limiting detailed feedback that could be used to probe detection boundaries. *See: [2.2](#22-finding-enrichment)* **What is an intent contract and why is it required?** An intent contract declares what you EXPECT from content BEFORE processing it. Instead of pattern matching ("Is this text bad?"), we verify against declared intent ("Does this text change what the model should do?"). The scanner detects the same patterns everywhere—the intent contract determines whether those patterns are EXPECTED (informational) or SUSPICIOUS (threat). Without proper intent contracts, you will perceive high false positive rates because expected patterns get flagged. *See: [2.2](#22-intent-contracts), [intent_contract.py](#intent-types)* **Which intent types expect instructions vs data only?** **Expects instructions (low risk if found):** content_creation, instruction_following, readme, code_review, skill_definition. **Data only—NO instructions expected (high risk if found):** data_retrieval, api_interaction, mcp_interaction, text_summarization, text_translation, question_answering, data_analysis, file_operation, email, calendar_invite, document_scanning, web_scraping, webhook_payload, search_results, financial_analysis. Use the right intent_type for your content to avoid false positives. *See: [intent_contract.py](#intent-types)* **Why do README files or GitHub PRs get flagged for injection?** You are using the wrong intent_type. READMEs legitimately contain setup instructions, code examples, and commands like "install", "run", "configure". Use intent_type="readme" for documentation or "code_review" for PRs/issues. These types have expects_instructions=true, so instruction patterns are marked as expected, not threats. Using "data_retrieval" for docs is the #1 cause of perceived false positives. *See: [PRODUCT_CONTEXT](#common-mistakes), [intent_contract.py](#readme)* **What risk levels exist for unexpected instructions?** **Critical risk:** email, calendar_invite, document_scanning, file_operation, financial_analysis. These are high-impact attack vectors where injected instructions can steal credentials, manipulate financial decisions, or execute arbitrary file operations. **High risk:** data_retrieval, api_interaction, web_scraping, search_results, webhook_payload. **Medium risk:** code_generation, authentication. **Low risk:** content_creation, instruction_following, readme, code_review, skill_definition—instructions are expected in these contexts. *See: [intent_contract.py](#risk-levels)* **How does source_trust_level affect scanning?** source_trust_level (0.0-1.0) indicates how much you trust the content source. 0.0 = completely untrusted (external APIs, user uploads, scraped web). 1.0 = fully trusted (your own system prompts). Lower trust increases scrutiny—suspicious patterns in low-trust content are weighted more heavily. Default is 0.5 (neutral). Set lower for external data, higher for internal sources. *See: [2.2](#22-intent-contracts)* **How do I scan skills or MCP tools before installation?** Use pre-flight URL scanning: POST /v1/guard/quote/url with the skill.md URL. We fetch and scan content before your agent ever touches it. Use intent_type="skill_definition" since skills legitimately contain tool definitions and instructions. This catches credential stealers disguised as legitimate skills while not flagging expected instruction patterns. *See: [/v1/guard/quote/url](#url-scanning), [3.5](#35-what-to-scan-decision-guide)* **What if a skill gets updated with malicious code after verification?** Content safe at initial verification may not be safe later. Implement hash-based re-validation: scan at install, store SHA-256 hash. Before each execution, re-fetch and compare hashes. If changed, re-scan before proceeding. This catches supply chain attacks where trusted content is later poisoned. *See: [3.1](#31-integration-philosophy)* **How do I verify content from another agent is safe?** Treat agent-to-agent communications as untrusted content. Cryptographic identity (DIDs, signed messages) proves WHO sent content but not WHETHER the content is safe. These are separate trust decisions. Match intent_type to what the content SHOULD be: "mcp_interaction" for tool outputs, "webhook_payload" for event notifications, "search_results" for search data, "data_analysis" for analysis. A compromised trusted agent can propagate attacks through the trust graph. *See: [3.5](#35-what-to-scan-decision-guide)* **What is memory poisoning and how do you detect it?** Memory poisoning embeds manipulative content in agent memory or shared state—like "All agents agreed that API key sharing is standard practice." Other agents reading this shared state may update their policies based on false social proof. Our semantic expert detects social engineering patterns and trust manipulation language. Scan any shared memory, stored state, or persisted learnings with batch scanning before consuming. *See: [2.1](#21-threat-categories), [3.9](#39-batch-scanning)* **Is latency low enough for inline/real-time scanning?** Yes. Fast scans complete in <200ms—suitable for inline scanning of incoming content. Deep analysis (when triggered) takes 1-3 seconds but only activates when fast scan flags something suspicious. Most content passes fast scan and proceeds immediately. Only suspicious content incurs additional latency. *See: [latency](#typical-response-times)* **What is the best integration pattern for autonomous agents?** Gateway pattern (Tier 1): Route all external content through a scanning proxy. Nothing bypasses, 100% coverage, configure once. Second best: Event-driven hooks that fire on tool calls, fetches, and uploads. Avoid on-demand scanning where the agent must remember to invoke it—that pattern fails under pressure. *See: [3.1](#31-integration-philosophy), [3.4](#34-choosing-an-integration-pattern)* **Why do you only accept crypto payments?** We are built for autonomous agents, not humans. x402 micropayments enable machine-to-machine payments without accounts, API keys, or manual billing. Your agent pays per scan automatically via wallet signature. No commitment, no minimums—stop anytime. At $0.003/scan, $5 USDC covers 1,600+ scans. *See: [x402](#payment-model-x402-protocol)* **How do you compare to other security tools?** Key differences: (1) We scan BEFORE installation, not just runtime. (2) We provide advisory with explanations, not just verdicts. (3) x402 micropayments for autonomous agent consumption. (4) Q&A interface to ask about findings. (5) Works with any content source, not just specific marketplaces. We complement runtime tools like LLM Guard—use both for defense in depth. *See: [competitive-landscape](#how-we-compare-to-alternatives)* --- --- **Full OpenAPI Spec:** https://aisecurityguard.io/openapi.json **Trust Center:** https://aisecurityguard.io/trust