{"openapi":"3.1.0","info":{"title":"Parse Prompt Security API","version":"1.0.0","description":"Screen untrusted prompts for injection attacks, jailbreaks, and adversarial patterns before your AI agent executes them. Multi-layer analysis with pattern matching, LLM-based deep analysis, and isolated sandbox execution across 8 risk categories aligned to the OWASP LLM Top 10. Self-service API key generation, per-key screening policies, and x402 USDC payment support.","contact":{"name":"Parse","url":"https://www.parsethis.ai"}},"servers":[{"url":"https://www.parsethis.ai"}],"security":[{"BearerAuth":[]}],"paths":{"/v1/parse":{"post":{"operationId":"screenPrompt","summary":"Screen a prompt for safety risks","description":"Analyze an untrusted prompt for injection attacks, jailbreaks, and adversarial patterns. Returns a 0-10 risk score with typed flags. When execute is true, runs the prompt in an isolated sandbox and returns a poll URL for the async result.","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParseRequest"}}}},"responses":{"200":{"description":"Screening result (synchronous, no execution)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParseResponse"}}}},"202":{"description":"Screening result with execution pending. Poll the poll_url for the sandbox result.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParseResponse"}}}},"401":{"description":"Missing or invalid API key"},"429":{"description":"Rate limit exceeded"}}}},"/v1/parse/{id}":{"get":{"operationId":"pollParseResult","summary":"Poll for async execution result","description":"After a parse request with execute: true, poll this endpoint for the sandbox execution result.","security":[{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"The parse request ID from the original response"}],"responses":{"200":{"description":"Execution result","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["pending","completed","failed"]},"execution":{"type":"object","properties":{"output":{"type":"string"},"isolated":{"type":"boolean"},"sandbox_status":{"type":"string"}}}}}}}},"404":{"description":"Parse request not found"}}}},"/v1/agent/trust/verify":{"post":{"operationId":"verifyAgentTrust","summary":"Verify agent-to-agent communication","description":"Verify that a message from another agent is trustworthy and not a prompt injection or social engineering attempt.","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrustVerifyRequest"}}}},"responses":{"200":{"description":"Trust verification result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrustVerifyResponse"}}}}}}},"/v1/policy":{"get":{"operationId":"getScreeningPolicy","summary":"Get current screening policy","description":"Read the screening policy configured for your API key.","security":[{"BearerAuth":[]}],"responses":{"200":{"description":"Current screening policy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScreeningPolicy"}}}}}},"put":{"operationId":"updateScreeningPolicy","summary":"Update screening policy","description":"Update the screening policy for your API key. Controls auto-block thresholds and screening triggers.","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScreeningPolicy"}}}},"responses":{"200":{"description":"Updated screening policy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScreeningPolicy"}}}}}},"delete":{"operationId":"resetScreeningPolicy","summary":"Reset screening policy to defaults","description":"Reset the screening policy for your API key back to default values.","security":[{"BearerAuth":[]}],"responses":{"200":{"description":"Default screening policy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScreeningPolicy"}}}}}}},"/v1/keys/generate":{"post":{"operationId":"generateApiKey","summary":"Generate a new API key (no auth required)","description":"Self-service API key generation. No authentication needed. Keys expire in 30 days. Rate limited to 5 per minute per IP.","security":[],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/KeyGenerateRequest"}}}},"responses":{"201":{"description":"Generated API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KeyGenerateResponse"}}}},"429":{"description":"Rate limit exceeded or global cap reached"}}}},"/v1/analyze":{"post":{"operationId":"analyzeMedia","summary":"Submit a URL for media credibility analysis","description":"Analyze a URL for media credibility, bias, and factual accuracy. Returns async result via poll URL.","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["url"],"properties":{"url":{"type":"string","format":"uri","description":"URL to analyze"},"depth":{"type":"string","enum":["quick","standard","deep"],"default":"standard","description":"Analysis depth"}}}}}},"responses":{"202":{"description":"Analysis submitted, poll for result","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string"},"poll_url":{"type":"string"}}}}}}}}},"/v1/evaluate":{"post":{"operationId":"evaluatePrompt","summary":"Evaluate a prompt for safety, quality, and cost","description":"Run a prompt through multiple evaluators for quality, safety, and cost analysis.","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["prompt"],"properties":{"prompt":{"type":"string","description":"Prompt to evaluate"},"model":{"type":"string","description":"Model to use for evaluation"}}}}}},"responses":{"200":{"description":"Evaluation result"},"202":{"description":"Evaluation pending, poll for result"}}}},"/v1/chat":{"post":{"operationId":"chat","summary":"Chat with Parse AI about media analysis","description":"Send a message to Parse AI for conversational media analysis.","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"model":{"type":"string"},"conversation_id":{"type":"string"}}}}}},"responses":{"200":{"description":"Chat response","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"string"},"conversation_id":{"type":"string"},"model":{"type":"string"}}}}}}}}},"/v1/models":{"get":{"operationId":"listModels","summary":"List available LLM models","description":"Returns all available models with pricing information.","security":[],"responses":{"200":{"description":"List of models","content":{"application/json":{"schema":{"type":"object","properties":{"models":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"pricing":{"type":"object","properties":{"input_per_1m":{"type":"number"},"output_per_1m":{"type":"number"}}},"free":{"type":"boolean"}}}}}}}}}}}},"/v1/screen-output":{"post":{"operationId":"screenOutput","summary":"Screen LLM output for risks","description":"Screen the output of an LLM call for prompt injection leakage, data exfiltration, harmful content, and other risks. Use this to verify an LLM's response is safe before presenting it to the user or passing it to another agent.","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["output"],"properties":{"output":{"type":"string","maxLength":50000,"description":"The LLM output to screen"},"context":{"type":"string","description":"Optional context about the original prompt or task"}}}}}},"responses":{"200":{"description":"Output screening result","content":{"application/json":{"schema":{"type":"object","properties":{"risk_score":{"type":"number","minimum":0,"maximum":10},"safe":{"type":"boolean"},"verdict":{"type":"string","enum":["safe","low_risk","medium_risk","high_risk","critical"]},"flags":{"type":"array","items":{"$ref":"#/components/schemas/RiskFlag"}},"categories":{"type":"array","items":{"type":"string"}},"output_length":{"type":"integer"}}}}}}}}},"/v1/evaluators":{"get":{"operationId":"listEvaluators","summary":"List available evaluators","description":"Returns the list of evaluators that can be used with POST /v1/evaluate.","security":[],"responses":{"200":{"description":"Available evaluators","content":{"application/json":{"schema":{"type":"object","properties":{"evaluators":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"}}}}}}}}}}}},"/health":{"get":{"operationId":"healthCheck","summary":"Health check","description":"Returns service health status.","security":[],"responses":{"200":{"description":"Service is healthy","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok","degraded"]},"timestamp":{"type":"string","format":"date-time"},"uptime_seconds":{"type":"integer"},"version":{"type":"string"}}}}}},"503":{"description":"Service is degraded"}}}}},"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","description":"API key from POST /v1/keys/generate. Pass as Authorization: Bearer <key>"}},"schemas":{"ParseRequest":{"type":"object","required":["prompt"],"properties":{"prompt":{"type":"string","maxLength":50000,"description":"The untrusted prompt to screen"},"execute":{"type":"boolean","default":false,"description":"Run the prompt in an isolated sandbox after screening"},"test_input":{"type":"string","description":"Optional input to pair with prompt during sandbox execution"},"agent_config":{"type":"object","description":"Agent configuration for execution context","properties":{"model":{"type":"string","enum":["meta-llama/llama-3.3-70b-instruct:free","google/gemma-3-27b-it:free","mistralai/mistral-small-3.1-24b-instruct:free","nousresearch/hermes-3-llama-3.1-405b:free","deepseek/deepseek-chat-v3-0324:free","deepseek/deepseek-chat","openai/gpt-4o-mini","openai/gpt-4o","openai/o1","openai/o3-mini","anthropic/claude-sonnet-4-6","anthropic/claude-haiku-4-5","anthropic/claude-3.5-sonnet","anthropic/claude-3-haiku","google/gemini-2.0-flash","google/gemini-2.0-pro","mistral/mistral-large","mistral/mistral-small"],"description":"Model to use for execution"},"temperature":{"type":"number","minimum":0,"maximum":2},"max_tokens":{"type":"integer","minimum":1,"maximum":16384},"agent_role":{"type":"string","description":"Description of the agent's role (not the system prompt)"}}},"metadata":{"type":"object","description":"Optional metadata for tracking","properties":{"agent_id":{"type":"string"},"session_id":{"type":"string"},"source":{"type":"string"}}}}},"ParseResponse":{"type":"object","properties":{"id":{"type":"string","description":"Unique request identifier"},"risk_score":{"type":"number","minimum":0,"maximum":10,"description":"Overall risk score. 0-3 safe, 4-6 caution, 7-10 block."},"safe":{"type":"boolean","description":"True if risk_score <= auto_block_threshold"},"verdict":{"type":"string","enum":["safe","low_risk","medium_risk","high_risk","critical"],"description":"Human-readable risk verdict"},"flags":{"type":"array","items":{"$ref":"#/components/schemas/RiskFlag"},"description":"Detected risk flags"},"categories":{"type":"object","description":"Risk scores per OWASP-aligned category (0-10 each)","additionalProperties":{"type":"number"}},"policy":{"$ref":"#/components/schemas/ScreeningPolicy"},"execution_pending":{"type":"boolean","description":"True when execute was requested and sandbox is running"},"poll_url":{"type":"string","description":"URL to poll for execution result (when execution_pending is true)"}}},"RiskFlag":{"type":"object","properties":{"type":{"type":"string","description":"Flag category: prompt_injection, jailbreak, data_exfiltration, privilege_escalation, etc."},"severity":{"type":"string","enum":["low","medium","high","critical"]},"description":{"type":"string","description":"Human-readable explanation"},"evidence":{"type":"string","description":"The specific text that triggered this flag"}}},"ScreeningPolicy":{"type":"object","properties":{"autoBlockThreshold":{"type":"integer","minimum":1,"maximum":10,"description":"Risk score at or above which prompts are auto-blocked"},"screenAllPrompts":{"type":"boolean","description":"If true, screen all prompts regardless of source"}}},"TrustVerifyRequest":{"type":"object","required":["source_agent","message"],"properties":{"source_agent":{"type":"string","description":"Identifier of the agent sending the message"},"message":{"type":"string","description":"The message content to verify"},"context":{"type":"string","description":"Additional context about the communication"}}},"TrustVerifyResponse":{"type":"object","properties":{"trusted":{"type":"boolean"},"risk_score":{"type":"number","minimum":0,"maximum":10},"flags":{"type":"array","items":{"$ref":"#/components/schemas/RiskFlag"}},"recommendation":{"type":"string"}}},"KeyGenerateRequest":{"type":"object","properties":{"name":{"type":"string","maxLength":100,"description":"Descriptive name for the key"}}},"KeyGenerateResponse":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string","description":"The API key. Store securely, shown only once."},"name":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}},"created_at":{"type":"string","format":"date-time"},"expires_at":{"type":"string","format":"date-time"}}}}}}