{"openapi":"3.1.0","info":{"title":"ZeroLeaks Developer API","version":"2.2.0","description":"Versioned API used by @zeroleaks/sdk to red-team AI agents: runtime scans that relay probes through the real agent code, endpoint scans against deployed HTTPS agents, and skill scans. Agent scans run reconnaissance, then secrets-in-context, injection, and boundary-invariant probes. A scan does not rerun exploits against a fixed agent; the next scan does. Prompt scans are retired: POST /api/v1/scans returns 410 Gone, while reads and cancellation of historical prompt scans remain available.","contact":{"name":"ZeroLeaks","email":"support@zeroleaks.ai","url":"https://zeroleaks.ai"},"license":{"name":"Proprietary service; MIT SDK","url":"https://zeroleaks.ai/terms"}},"externalDocs":{"description":"ZeroLeaks REST API, authentication, errors, and rate limits","url":"https://zeroleaks.ai/docs/api-reference/rest-api"},"servers":[{"url":"https://zeroleaks.ai"}],"security":[{"BearerAuth":[]}],"tags":[{"name":"Health"},{"name":"Prompt scans","description":"Retired. Creation returns 410 Gone; list, read, and cancel remain for historical scans."},{"name":"Reports"},{"name":"Runtime scans"},{"name":"Endpoint configs"},{"name":"Endpoint scans"},{"name":"Skill scans"}],"x-deprecations":[{"id":"prompt-scans","operations":["createPromptScan"],"schemas":["CreateScanRequest","CreateScanResponse"],"message":"Prompt scans are retired. POST /api/v1/scans returns 410 Gone with code PROMPT_SCANS_RETIRED. Reads and cancellation of historical prompt scans remain available.","replacement":{"agentScans":"/api/v1/agent-scans","runtimeScans":"/api/v1/runtime-scans","cli":"npm i -g zeroleaks"}}],"paths":{"/api/v1/health":{"get":{"tags":["Health"],"operationId":"getHealth","summary":"Check service health","security":[],"responses":{"200":{"description":"Service status","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}}},"/api/v1/capabilities":{"get":{"tags":["Health"],"operationId":"getCapabilities","summary":"List current scan capabilities and limits","security":[],"responses":{"200":{"description":"Supported modes, models, options, and limits","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}}},"/api/v1/scans":{"get":{"tags":["Prompt scans"],"operationId":"listPromptScans","summary":"List prompt scans","parameters":[{"name":"cursor","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"workspaceId","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Paginated scans","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScanList"}}}},"401":{"description":"Invalid API key","headers":{"RateLimit":{"$ref":"#/components/headers/RateLimit"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimitPolicy"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["Prompt scans"],"operationId":"createPromptScan","summary":"Retired: prompt scans can no longer be started","description":"Always returns 410 Gone with code PROMPT_SCANS_RETIRED. Scan a deployed agent with POST /api/v1/agent-scans or POST /api/v1/runtime-scans, or test a standalone prompt with the source-available CLI (npm i -g zeroleaks).","deprecated":true,"security":[],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateScanRequest"}}}},"responses":{"410":{"description":"Prompt scans are retired","headers":{"RateLimit":{"$ref":"#/components/headers/RateLimit"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimitPolicy"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/scans/{scanId}":{"get":{"tags":["Prompt scans"],"operationId":"getPromptScan","summary":"Get scan state and report","parameters":[{"name":"scanId","in":"path","required":true,"description":"ZeroLeaks scan identifier","schema":{"type":"string"}}],"responses":{"200":{"description":"Scan state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScanResult"}}}},"404":{"description":"Scan not found","headers":{"RateLimit":{"$ref":"#/components/headers/RateLimit"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimitPolicy"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/scans/{scanId}/cancel":{"post":{"tags":["Prompt scans"],"operationId":"cancelPromptScan","summary":"Cancel an active prompt scan","parameters":[{"name":"scanId","in":"path","required":true,"description":"ZeroLeaks scan identifier","schema":{"type":"string"}}],"responses":{"200":{"description":"Cancellation accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"Scan is not active","headers":{"RateLimit":{"$ref":"#/components/headers/RateLimit"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimitPolicy"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Scan not found","headers":{"RateLimit":{"$ref":"#/components/headers/RateLimit"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimitPolicy"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/reports":{"get":{"tags":["Reports"],"operationId":"listReports","summary":"List prompt-scan report summaries","parameters":[{"name":"cursor","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"workspaceId","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Paginated report summaries","content":{"application/json":{"schema":{"type":"object","required":["items","nextCursor","hasMore"],"properties":{"items":{"type":"array","items":{"type":"object","additionalProperties":true}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}}}}}}}}},"/api/v1/reports/{reportId}":{"get":{"tags":["Reports"],"operationId":"getReport","summary":"Get a prompt-scan report by ID","parameters":[{"name":"reportId","in":"path","required":true,"description":"ZeroLeaks report identifier","schema":{"type":"string"}}],"responses":{"200":{"description":"Security report","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Report"}}}},"404":{"description":"Report not found","headers":{"RateLimit":{"$ref":"#/components/headers/RateLimit"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimitPolicy"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/reports/by-scan/{scanId}":{"get":{"tags":["Reports"],"operationId":"getReportByScan","summary":"Get a prompt-scan report by scan ID","parameters":[{"name":"scanId","in":"path","required":true,"description":"ZeroLeaks scan identifier","schema":{"type":"string"}}],"responses":{"200":{"description":"Security report","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Report"}}}},"404":{"description":"Report not found","headers":{"RateLimit":{"$ref":"#/components/headers/RateLimit"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimitPolicy"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/runtime-scans":{"get":{"tags":["Runtime scans"],"operationId":"listRuntimeScans","summary":"List SDK runtime scans","parameters":[{"name":"workspaceId","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100}}],"responses":{"200":{"description":"Runtime scans","content":{"application/json":{"schema":{"type":"object","properties":{"scans":{"type":"array","items":{"$ref":"#/components/schemas/RuntimeScan"}}}}}}}}},"post":{"tags":["Runtime scans"],"operationId":"createRuntimeScan","summary":"Start a production-fidelity SDK relay scan","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRuntimeScanRequest"}}}},"responses":{"202":{"description":"Runtime scan workflow started","headers":{"RateLimit":{"$ref":"#/components/headers/RateLimit"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimitPolicy"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRuntimeScanResponse"}}}},"400":{"description":"Invalid request","headers":{"RateLimit":{"$ref":"#/components/headers/RateLimit"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimitPolicy"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Invalid API key","headers":{"RateLimit":{"$ref":"#/components/headers/RateLimit"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimitPolicy"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"No scan access on the current plan or workspace (SUBSCRIPTION_LIMIT)","headers":{"RateLimit":{"$ref":"#/components/headers/RateLimit"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimitPolicy"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Plan throughput cap (SCAN_CONCURRENCY_LIMIT, SCAN_HOURLY_LIMIT) or hourly abuse ceiling","headers":{"RateLimit":{"$ref":"#/components/headers/RateLimit"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimitPolicy"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/runtime-scans/{runtimeScanId}":{"get":{"tags":["Runtime scans"],"operationId":"getRuntimeScan","summary":"Get runtime scan state and report","parameters":[{"name":"runtimeScanId","in":"path","required":true,"description":"SDK runtime scan identifier","schema":{"type":"string"}}],"responses":{"200":{"description":"Runtime scan","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuntimeScan"}}}},"404":{"description":"Runtime scan not found","headers":{"RateLimit":{"$ref":"#/components/headers/RateLimit"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimitPolicy"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/runtime-scans/{runtimeScanId}/cancel":{"post":{"tags":["Runtime scans"],"operationId":"cancelRuntimeScan","summary":"Cancel a runtime scan and relay workflow","parameters":[{"name":"runtimeScanId","in":"path","required":true,"description":"SDK runtime scan identifier","schema":{"type":"string"}}],"responses":{"200":{"description":"Cancellation accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Runtime scan not found","headers":{"RateLimit":{"$ref":"#/components/headers/RateLimit"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimitPolicy"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/runtime-scans/{runtimeScanId}/events/next":{"post":{"tags":["Runtime scans"],"operationId":"claimRuntimeScanEvent","summary":"Claim the next invoke or reset event for an SDK runner","parameters":[{"name":"runtimeScanId","in":"path","required":true,"description":"SDK runtime scan identifier","schema":{"type":"string"}}],"responses":{"200":{"description":"Claimed relay event","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuntimeScanEvent"}}}},"204":{"description":"No relay event is ready"},"404":{"description":"Runtime scan not found","headers":{"RateLimit":{"$ref":"#/components/headers/RateLimit"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimitPolicy"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/runtime-scans/{runtimeScanId}/events/{eventId}":{"post":{"tags":["Runtime scans"],"operationId":"completeRuntimeScanEvent","summary":"Submit a target response or runner error","parameters":[{"name":"runtimeScanId","in":"path","required":true,"description":"SDK runtime scan identifier","schema":{"type":"string"}},{"name":"eventId","in":"path","required":true,"description":"SDK relay event identifier","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["claimToken"],"description":"Send response or error as plain fields, or (SDK 0.3.2 and later) set encoding to base64+json and put the base64-encoded JSON object { response, error } in payload, so an agent's reply to an attack string doesn't trip web application firewall rules on the way in.","properties":{"claimToken":{"type":"string"},"response":{"$ref":"#/components/schemas/RuntimeTargetResponse"},"error":{"type":"string"},"encoding":{"type":"string","enum":["base64+json"]},"payload":{"type":"string","contentEncoding":"base64","description":"Base64 of a JSON object with optional response and error. Used with encoding base64+json instead of the plain fields."}}}}}},"responses":{"200":{"description":"Event completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"Event claim is stale or invalid","headers":{"RateLimit":{"$ref":"#/components/headers/RateLimit"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimitPolicy"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/agent-configs":{"get":{"tags":["Endpoint configs"],"operationId":"listAgentConfigs","summary":"List deployed endpoint configurations","parameters":[{"name":"workspaceId","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Endpoint configurations","content":{"application/json":{"schema":{"type":"object","properties":{"configs":{"type":"array","items":{"$ref":"#/components/schemas/AgentConfig"}}}}}}}}},"post":{"tags":["Endpoint configs"],"operationId":"createAgentConfig","summary":"Register a deployed HTTP agent","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentConfigInput"}}}},"responses":{"201":{"description":"Configuration created","content":{"application/json":{"schema":{"type":"object","required":["id"],"properties":{"id":{"type":"string"}}}}}},"400":{"description":"Invalid endpoint configuration","headers":{"RateLimit":{"$ref":"#/components/headers/RateLimit"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimitPolicy"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/agent-configs/{configId}":{"patch":{"tags":["Endpoint configs"],"operationId":"updateAgentConfig","summary":"Update a deployed endpoint configuration","description":"Partial update: send only the fields to change, at least one. Omitted fields keep their stored values. requestFormat is merged key by key, and requestFormat.headers is replaced as a whole when sent. An empty plantedSecret clears the canary. Switching authMethod to none clears the stored credential. workspaceId is ignored.","parameters":[{"name":"configId","in":"path","required":true,"description":"Deployed-agent configuration ID","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentConfigUpdate"}}}},"responses":{"200":{"description":"Configuration updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Configuration not found","headers":{"RateLimit":{"$ref":"#/components/headers/RateLimit"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimitPolicy"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["Endpoint configs"],"operationId":"deleteAgentConfig","summary":"Delete a deployed endpoint configuration","parameters":[{"name":"configId","in":"path","required":true,"description":"Deployed-agent configuration ID","schema":{"type":"string"}}],"responses":{"200":{"description":"Configuration deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Configuration not found","headers":{"RateLimit":{"$ref":"#/components/headers/RateLimit"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimitPolicy"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/agent-scans":{"get":{"tags":["Endpoint scans"],"operationId":"listAgentScans","summary":"List deployed endpoint scans","parameters":[{"name":"workspaceId","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Agent scans","content":{"application/json":{"schema":{"type":"object","properties":{"scans":{"type":"array","items":{"type":"object","additionalProperties":true}}}}}}}}},"post":{"tags":["Endpoint scans"],"operationId":"createAgentScan","summary":"Start a deployed endpoint scan","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["agentConfigId"],"properties":{"agentConfigId":{"type":"string"}}}}}},"responses":{"202":{"description":"Agent scan queued","headers":{"RateLimit":{"$ref":"#/components/headers/RateLimit"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimitPolicy"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAgentScanResponse"}}}},"400":{"description":"Invalid request","headers":{"RateLimit":{"$ref":"#/components/headers/RateLimit"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimitPolicy"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Invalid API key","headers":{"RateLimit":{"$ref":"#/components/headers/RateLimit"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimitPolicy"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"No scan access on the current plan or workspace (SUBSCRIPTION_LIMIT)","headers":{"RateLimit":{"$ref":"#/components/headers/RateLimit"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimitPolicy"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Plan throughput cap (SCAN_CONCURRENCY_LIMIT, SCAN_HOURLY_LIMIT) or hourly abuse ceiling","headers":{"RateLimit":{"$ref":"#/components/headers/RateLimit"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimitPolicy"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/agent-scans/{scanId}":{"get":{"tags":["Endpoint scans"],"operationId":"getAgentScan","summary":"Get deployed endpoint scan state","parameters":[{"name":"scanId","in":"path","required":true,"description":"ZeroLeaks scan identifier","schema":{"type":"string"}}],"responses":{"200":{"description":"Agent scan, redacted config, and report","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentScanResult"}}}},"404":{"description":"Agent scan not found","headers":{"RateLimit":{"$ref":"#/components/headers/RateLimit"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimitPolicy"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/agent-scans/{scanId}/cancel":{"post":{"tags":["Endpoint scans"],"operationId":"cancelAgentScan","summary":"Cancel a deployed endpoint scan","parameters":[{"name":"scanId","in":"path","required":true,"description":"ZeroLeaks scan identifier","schema":{"type":"string"}}],"responses":{"200":{"description":"Cancellation accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"Agent scan is not active","headers":{"RateLimit":{"$ref":"#/components/headers/RateLimit"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimitPolicy"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Agent scan not found","headers":{"RateLimit":{"$ref":"#/components/headers/RateLimit"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimitPolicy"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/skill-scans":{"get":{"tags":["Skill scans"],"operationId":"listSkillScans","summary":"List recent skill scans","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100}}],"responses":{"200":{"description":"Skill scans","content":{"application/json":{"schema":{"type":"object","properties":{"scans":{"type":"array","items":{"$ref":"#/components/schemas/SkillScan"}}}}}}}}},"post":{"tags":["Skill scans"],"operationId":"createSkillScan","summary":"Scan a remote source or uploaded ZIP archive","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSkillScanRequest"}},"multipart/form-data":{"schema":{"allOf":[{"$ref":"#/components/schemas/CreateSkillScanRequest"},{"type":"object","properties":{"archive":{"type":"string","format":"binary"}}}]}}}},"responses":{"200":{"description":"Synchronous report","headers":{"RateLimit":{"$ref":"#/components/headers/RateLimit"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimitPolicy"}},"content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"202":{"description":"Asynchronous scan queued","headers":{"RateLimit":{"$ref":"#/components/headers/RateLimit"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimitPolicy"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSkillScanResponse"}}}},"400":{"description":"Invalid skill-scan request","headers":{"RateLimit":{"$ref":"#/components/headers/RateLimit"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimitPolicy"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/skill-scans/{scanId}":{"get":{"tags":["Skill scans"],"operationId":"getSkillScan","summary":"Get skill-scan state and report","parameters":[{"name":"scanId","in":"path","required":true,"description":"ZeroLeaks scan identifier","schema":{"type":"string"}}],"responses":{"200":{"description":"Skill scan","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SkillScan"}}}},"404":{"description":"Skill scan not found","headers":{"RateLimit":{"$ref":"#/components/headers/RateLimit"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimitPolicy"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"headers":{"RetryAfter":{"description":"On 429, seconds to wait before retrying. Scan creation is not idempotent.","schema":{"type":"integer","minimum":1}},"RateLimit":{"description":"When a limiter ran: IETF structured field with policy name, r (remaining quota), and t (seconds until reset).","schema":{"type":"string"},"example":"\"default\";r=119;t=3540"},"RateLimitPolicy":{"description":"Quota policy: q is the request quota; w is the window in seconds.","schema":{"type":"string"},"example":"\"default\";q=120;w=3600"}},"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"zl_live_...","description":"ZeroLeaks API key created in dashboard settings."}},"schemas":{"Error":{"type":"object","required":["error","code","message","hint","docs"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable error code, e.g. INVALID_REQUEST, UNAUTHORIZED, NOT_FOUND, SUBSCRIPTION_LIMIT, SCAN_CONCURRENCY_LIMIT, SCAN_HOURLY_LIMIT."},"message":{"type":"string"},"hint":{"type":"string","description":"Action the caller can take to recover."},"docs":{"type":"string","format":"uri","description":"Relevant ZeroLeaks documentation."},"reset":{"type":"string","format":"date-time"}},"additionalProperties":true},"Success":{"type":"object","required":["success"],"properties":{"success":{"type":"boolean"}}},"CreateScanRequest":{"type":"object","deprecated":true,"required":["systemPrompt"],"properties":{"systemPrompt":{"type":"string","minLength":10},"scanMode":{"type":"string","enum":["extraction","injection","dual","sandbox","full"],"default":"dual"},"targetModel":{"type":"string"},"temperature":{"type":"number","minimum":0,"maximum":1},"reasoningEffort":{"type":"string","enum":["low","medium","high"]},"knowledgeProfile":{"type":"string","enum":["baseline","production","research"],"default":"production"},"attackSurfaces":{"type":"array","items":{"type":"string","enum":["direct_chat","indirect_content","tool_calling","mcp","repo_ci","rag_vector","multi_turn"]}},"userTools":{"type":"array","items":{"type":"object"}},"autoDetectTools":{"type":"boolean"},"sandboxScanType":{"type":"string","enum":["both","extraction","injection"]},"usePineconeKnowledge":{"type":"boolean"},"maxAdaptiveCandidates":{"type":"integer","minimum":1,"maximum":24},"workspaceId":{"type":"string"}}},"CreateScanResponse":{"type":"object","deprecated":true,"required":["scanId"],"properties":{"scanId":{"type":"string"},"workflowRunId":{"type":"string"},"status":{"type":"string"},"processingMethod":{"type":"string","const":"workflow"}},"additionalProperties":true},"Scan":{"type":"object","required":["id","status","createdAt"],"properties":{"id":{"type":"string"},"status":{"type":"string"},"source":{"type":"string"},"targetModel":{"type":"string"},"createdAt":{"type":"integer"},"completedAt":{"type":"integer"},"progressStatus":{"type":"string"},"currentTurn":{"type":"integer"},"maxTurns":{"type":"integer"}},"additionalProperties":true},"ScanResult":{"type":"object","required":["scan","report"],"properties":{"scan":{"$ref":"#/components/schemas/Scan"},"report":{"oneOf":[{"$ref":"#/components/schemas/Report"},{"type":"null"}]}}},"ScanList":{"type":"object","required":["items","nextCursor","hasMore"],"properties":{"items":{"type":"array","items":{"type":"object","additionalProperties":true}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}}},"Report":{"type":"object","description":"Prompt-scan report.","required":["overallScore","overallVulnerability","findings"],"properties":{"id":{"type":"string"},"scanId":{"type":"string"},"overallScore":{"type":"number","minimum":0,"maximum":100},"overallVulnerability":{"type":"string","enum":["critical","high","medium","low","secure"]},"findings":{"type":"array","items":{}},"recommendations":{"type":"array","items":{}},"summary":{"type":"string"},"toolTrace":{"type":"array","items":{"$ref":"#/components/schemas/RuntimeToolCall"}}},"additionalProperties":true},"ToolDefinition":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"description":{"type":"string"},"inputSchema":{},"outputSchema":{},"strict":{"type":"boolean"},"type":{"type":"string"},"providerOptions":{},"definition":{}},"additionalProperties":true},"RuntimeTargetDefinition":{"type":"object","required":["name","provider"],"properties":{"name":{"type":"string"},"provider":{"type":"string"},"model":{"type":"string"},"instructions":{},"tools":{"type":"array","maxItems":250,"items":{"$ref":"#/components/schemas/ToolDefinition"}},"metadata":{}}},"RuntimeScanOptions":{"type":"object","properties":{"scanMode":{"type":"string","enum":["full","quick"],"default":"full"},"targetModel":{"type":"string"},"temperature":{"type":"number","minimum":0,"maximum":1},"reasoningEffort":{"type":"string","enum":["low","medium","high"]},"knowledgeProfile":{"type":"string","enum":["baseline","production","research"]},"attackSurfaces":{"type":"array","items":{"type":"string"}},"usePineconeKnowledge":{"type":"boolean"},"maxAdaptiveCandidates":{"type":"integer","minimum":1,"maximum":24}}},"CreateRuntimeScanRequest":{"type":"object","required":["target"],"properties":{"target":{"$ref":"#/components/schemas/RuntimeTargetDefinition"},"options":{"$ref":"#/components/schemas/RuntimeScanOptions"},"workspaceId":{"type":"string"}}},"CreateRuntimeScanResponse":{"type":"object","required":["runtimeScanId","workflowRunId","status","processingMethod"],"properties":{"runtimeScanId":{"type":"string"},"workflowRunId":{"type":"string"},"status":{"type":"string"},"processingMethod":{"type":"string","const":"sdk-relay"}}},"RuntimeToolCall":{"type":"object","required":["name"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"arguments":{},"result":{},"error":{"type":"string"},"providerExecuted":{"type":"boolean"},"attackPrompt":{"type":"string"},"sessionId":{"type":"string"}},"additionalProperties":true},"RuntimeTargetResponse":{"type":"object","required":["text"],"properties":{"text":{"type":"string"},"toolCalls":{"type":"array","items":{"$ref":"#/components/schemas/RuntimeToolCall"}},"finishReason":{"type":"string"},"usage":{},"metadata":{}}},"RuntimeScanEvent":{"type":"object","required":["id","kind","sessionId","claimToken"],"properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["invoke","reset"]},"sessionId":{"type":"string"},"message":{"type":"string"},"claimToken":{"type":"string"}}},"RuntimeScan":{"type":"object","required":["_id","status","target","createdAt","updatedAt"],"properties":{"_id":{"type":"string"},"status":{"type":"string"},"target":{"$ref":"#/components/schemas/RuntimeTargetDefinition"},"options":{"$ref":"#/components/schemas/RuntimeScanOptions"},"currentPhase":{"type":"string"},"workflowRunId":{"type":"string"},"report":{"$ref":"#/components/schemas/AgentReport"},"error":{"type":"string"},"runnerLastSeenAt":{"type":"integer"},"workerLastSeenAt":{"type":"integer"},"createdAt":{"type":"integer"},"updatedAt":{"type":"integer"},"completedAt":{"type":"integer"}}},"AgentConfigUpdate":{"type":"object","description":"Any subset of AgentConfigInput's fields, at least one. Omitted fields keep their stored values.","minProperties":1,"properties":{"name":{"type":"string","maxLength":200},"endpointUrl":{"type":"string","format":"uri"},"authMethod":{"type":"string","enum":["none","bearer","api_key","custom_header"],"default":"none"},"authValue":{"type":"string","writeOnly":true},"authHeaderName":{"type":"string"},"requestFormat":{"type":"object","properties":{"method":{"type":"string","enum":["POST","GET"]},"headers":{"type":"object","additionalProperties":{"type":"string"}},"bodyTemplate":{"type":"string"},"messageField":{"type":"string"},"messagesField":{"type":"string"},"sessionField":{"type":"string"},"responseField":{"type":"string"},"toolCallsField":{"type":"string"},"finishReasonField":{"type":"string"},"usageField":{"type":"string"},"attachmentsField":{"type":"string","description":"Body field for real file artifacts. Artifact probes send [{ filename, mediaType, dataBase64 }] there instead of pasting the file into the message."}}},"description":{"type":"string"},"plantedSecret":{"type":"string","writeOnly":true,"minLength":8,"maxLength":200,"description":"A canary you place in the agent's own system prompt. Must contain a digit or separator. If a scan gets it back, the leak is proven. Stored reports show [planted canary] in its place in findings, the conversation log, recommendations, and boundaryAssurance. On update, omit to keep and send an empty string to clear."},"tools":{"type":"array","items":{"$ref":"#/components/schemas/ToolDefinition"}},"workspaceId":{"type":"string"}}},"AgentConfigInput":{"type":"object","required":["name","endpointUrl"],"properties":{"name":{"type":"string","maxLength":200},"endpointUrl":{"type":"string","format":"uri"},"authMethod":{"type":"string","enum":["none","bearer","api_key","custom_header"],"default":"none"},"authValue":{"type":"string","writeOnly":true},"authHeaderName":{"type":"string"},"requestFormat":{"type":"object","properties":{"method":{"type":"string","enum":["POST","GET"]},"headers":{"type":"object","additionalProperties":{"type":"string"}},"bodyTemplate":{"type":"string"},"messageField":{"type":"string"},"messagesField":{"type":"string"},"sessionField":{"type":"string"},"responseField":{"type":"string"},"toolCallsField":{"type":"string"},"finishReasonField":{"type":"string"},"usageField":{"type":"string"},"attachmentsField":{"type":"string","description":"Body field for real file artifacts. Artifact probes send [{ filename, mediaType, dataBase64 }] there instead of pasting the file into the message."}}},"description":{"type":"string"},"plantedSecret":{"type":"string","writeOnly":true,"minLength":8,"maxLength":200,"description":"A canary you place in the agent's own system prompt. Must contain a digit or separator. If a scan gets it back, the leak is proven. Stored reports show [planted canary] in its place in findings, the conversation log, recommendations, and boundaryAssurance. On update, omit to keep and send an empty string to clear."},"tools":{"type":"array","items":{"$ref":"#/components/schemas/ToolDefinition"}},"workspaceId":{"type":"string"}}},"AgentConfig":{"allOf":[{"$ref":"#/components/schemas/AgentConfigInput"},{"type":"object","properties":{"_id":{"type":"string"},"userId":{"type":"string"},"authValueConfigured":{"type":"boolean"},"plantedSecretConfigured":{"type":"boolean"},"createdAt":{"type":"integer"},"updatedAt":{"type":"integer"}}}]},"CreateAgentScanResponse":{"type":"object","required":["scanId","workflowRunId","processingMethod"],"properties":{"scanId":{"type":"string"},"workflowRunId":{"type":"string"},"processingMethod":{"type":"string","const":"workflow"}}},"AgentScan":{"type":"object","required":["_id","agentConfigId","status","createdAt"],"properties":{"_id":{"type":"string"},"agentConfigId":{"type":"string"},"status":{"type":"string"},"currentPhase":{"type":"string"},"workflowRunId":{"type":"string"},"createdAt":{"type":"integer"},"completedAt":{"type":"integer"}},"additionalProperties":true},"AgentScanResult":{"type":"object","required":["scan","config","report"],"properties":{"scan":{"$ref":"#/components/schemas/AgentScan"},"config":{"oneOf":[{"$ref":"#/components/schemas/AgentConfig"},{"type":"null"}]},"report":{"oneOf":[{"$ref":"#/components/schemas/AgentReport"},{"type":"null"}]},"trigger":{"type":"string","enum":["manual","scheduled","api"],"description":"What started the scan: the dashboard, a schedule, or the REST API or SDK."},"comparison":{"description":"The completed scan against this agent's previous completed scan. Null until the scan completes or when there is no earlier scan. Use it in CI to fail on a score drop or a regressed fix.","oneOf":[{"type":"object","required":["previousScanId","previousScore","scoreDelta","scoreDropped","regressions"],"properties":{"previousScanId":{"type":"string"},"previousScore":{"type":"number"},"scoreDelta":{"type":["number","null"]},"scoreDropped":{"type":"boolean"},"regressions":{"oneOf":[{"type":"object","properties":{"replayed":{"type":"integer"},"fixed":{"type":"integer"},"stillOpen":{"type":"integer"},"regressed":{"type":"integer"},"newFindings":{"type":"integer"}}},{"type":"null"}]}}},{"type":"null"}]}}},"ReportComponent":{"type":"object","required":["score","vulnerability","findingsCount","findings"],"properties":{"score":{"type":"number","minimum":0,"maximum":100},"vulnerability":{"type":"string"},"findingsCount":{"type":"integer"},"findings":{"type":"array","items":{"$ref":"#/components/schemas/AgentFinding"}}}},"EvidenceStrength":{"type":"string","enum":["semantic","indicator","observed_tool_call","deterministic_effect"]},"SecretLeakClass":{"type":"string","enum":["credential","internal_endpoint","authorization_rule","tool_schema","planted_canary","instruction_text"]},"AgentFinding":{"type":"object","required":["category","technique","severity","evidence","attackPrompt","agentResponse"],"properties":{"category":{"type":"string"},"technique":{"type":"string"},"severity":{"type":"string","enum":["critical","high","medium","low","informational"]},"evidence":{"type":"string"},"attackPrompt":{"type":"string"},"agentResponse":{"type":"string"},"confidence":{"type":"number"},"remediation":{"type":"string","description":"The change that closes the finding, aimed at the control that failed."},"controlLayer":{"type":"string","enum":["permission","tool_arguments","egress","approval","data_access","identity","memory","inter_agent","untrusted_content","output_filter","instructions"],"description":"Where the fix belongs."},"observedAction":{"type":"string"},"boundaryInvariant":{"type":"object","additionalProperties":true},"leakClass":{"$ref":"#/components/schemas/SecretLeakClass"},"evidenceStrength":{"$ref":"#/components/schemas/EvidenceStrength"},"claimedSpan":{"type":"string","description":"Set when the judge panel reported a leak no detector matched: the response span it quoted. An empty string means the quote did not verify; the finding does not lower the score."}},"additionalProperties":true},"SecretsInContextSummary":{"type":"object","description":"Secrets-in-context track summary. Leak evidence describes the match and never contains the raw secret or planted canary.","properties":{"probesRun":{"type":"integer"},"leaks":{"type":"array","items":{"type":"object","properties":{"class":{"$ref":"#/components/schemas/SecretLeakClass"},"severity":{"type":"string"},"evidence":{"type":"string"},"evidenceStrength":{"$ref":"#/components/schemas/EvidenceStrength"},"probeId":{"type":"string"},"technique":{"type":"string"},"claimedSpan":{"type":"string"}}}},"reconnaissance":{"type":"object","properties":{"toolNamesObserved":{"type":"array","items":{"type":"string"}},"rulesObserved":{"type":"array","items":{"type":"string"}},"questionsAnswered":{"type":"integer"}}},"retrievedSeedIds":{"type":"array","items":{"type":"string"}},"plantedCanaryConfigured":{"type":"boolean"},"limitations":{"type":"array","items":{"type":"string"}}}},"DefenseFingerprint":{"type":"object","description":"Inspector fingerprint of a target's defenses.","properties":{"refusalStyle":{"type":"string","enum":["hard_refusal","deflection","partial_comply","none"]},"filterSignals":{"type":"array","items":{"type":"string"}},"toolGating":{"type":"string","enum":["enforced","absent","unknown"]},"refusalRate":{"type":"number","minimum":0,"maximum":1},"sampleSize":{"type":"integer"},"observedAt":{"type":"integer"}}},"CampaignState":{"type":"object","description":"Full state of a long-horizon campaign against one invariant.","properties":{"invariantId":{"type":"string"},"invariantTitle":{"type":"string"},"canary":{"type":"string"},"budget":{"type":"integer"},"turnsUsed":{"type":"integer"},"status":{"type":"string","enum":["in_progress","crossed","exhausted"]},"crossedAtTurn":{"type":"integer"},"transcript":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["attacker","agent"]},"content":{"type":"string"},"phase":{"type":"string"},"toolCalls":{"type":"array","items":{}}}}},"crossing":{"type":"object","properties":{"severity":{"type":"string"},"evidence":{"type":"string"},"confidence":{"type":"number"},"agreement":{"type":"number"},"voteCount":{"type":"integer"},"evidenceStrength":{"$ref":"#/components/schemas/EvidenceStrength"}}}}},"BoundaryAssurance":{"type":"object","description":"Invariants derived from the target profile and the evidence gathered against them.","properties":{"invariants":{"type":"array","items":{"type":"object","additionalProperties":true}},"verificationCases":{"type":"array","items":{"type":"object","additionalProperties":true}},"initialProbes":{"type":"integer"},"mutatedProbes":{"type":"integer"},"multiAgentProbes":{"type":"integer"},"artifactProbes":{"type":"integer"},"violations":{"type":"integer"},"promotedProbes":{"type":"integer"},"attackQuality":{"type":"object","description":"Success rates, deterministic evidence rate, and attack-surface coverage (requested, exercised, unsupported).","additionalProperties":true},"longHorizonCampaigns":{"type":"array","items":{"type":"object","additionalProperties":true}},"campaignStates":{"type":"array","items":{"$ref":"#/components/schemas/CampaignState"}},"strategy":{"type":"object","description":"Strategist phase plan (reconnaissance, escalation, persistence).","additionalProperties":true},"fingerprint":{"$ref":"#/components/schemas/DefenseFingerprint","description":"Defenses observed during the scan."},"priorFingerprint":{"$ref":"#/components/schemas/DefenseFingerprint","description":"Fingerprint this scan started from, left by the previous scan of the same target."},"secretsInContext":{"$ref":"#/components/schemas/SecretsInContextSummary"}},"additionalProperties":true},"AgentReport":{"type":"object","description":"Report for runtime and endpoint agent scans.","required":["overallScore","overallVulnerability","components","attacksRun","summary","recommendations"],"properties":{"overallScore":{"type":"number","minimum":0,"maximum":100},"overallVulnerability":{"type":"string","enum":["critical","high","medium","low","secure"]},"components":{"type":"object","properties":{"promptSecurity":{"$ref":"#/components/schemas/ReportComponent"},"toolSafety":{"$ref":"#/components/schemas/ReportComponent"},"multiTurnResilience":{"$ref":"#/components/schemas/ReportComponent"},"dataLeakage":{"$ref":"#/components/schemas/ReportComponent"}}},"attacksRun":{"type":"integer"},"summary":{"type":"string"},"recommendations":{"type":"array","items":{"type":"string"}},"conversationLog":{"type":"array","items":{}},"toolTrace":{"type":"array","items":{"$ref":"#/components/schemas/RuntimeToolCall"}},"boundaryAssurance":{"$ref":"#/components/schemas/BoundaryAssurance"},"containment":{"type":"object","properties":{"payloadRewrites":{"type":"integer"},"sanitizedPayloads":{"type":"integer"}}},"target":{"$ref":"#/components/schemas/RuntimeTargetDefinition"},"createdAt":{"type":"integer"}},"additionalProperties":true},"CreateSkillScanRequest":{"type":"object","properties":{"source":{"type":"string","description":"A skill repository, skills.sh URL, or direct SKILL.md URL. With sourceType mcp, or written as mcp+https://…, the Streamable HTTP URL of an MCP server."},"sourceType":{"type":"string","enum":["skill","mcp"],"description":"mcp connects to the server as an MCP client and scans its declared tools, prompts, resources, and instructions. Tools are listed, never called. JSON bodies only."},"mcpAuthorization":{"type":"string","writeOnly":true,"description":"Authorization header value sent to the MCP server, e.g. Bearer <token>. Stored encrypted and deleted when the scan finishes."},"skill":{"type":"string"},"delivery":{"type":"string","enum":["async","sync"]},"webhookUrl":{"type":"string","format":"uri"},"webhookSecret":{"type":"string","writeOnly":true},"model":{"type":"string"},"behaviorModel":{"type":"string"},"maxFiles":{"type":"integer","minimum":1},"maxBytes":{"type":"integer","minimum":1},"toolProfile":{"type":"string","enum":["readonly","standard","networked"]},"mode":{"type":"string","enum":["review","risk","behavior","full"]},"behaviorTrials":{"type":"integer","minimum":1},"behaviorAdaptiveLimit":{"type":"integer","minimum":1},"includeAssets":{"type":"boolean"},"timeoutMs":{"type":"integer","minimum":1}}},"CreateSkillScanResponse":{"type":"object","required":["scanId","status","pollUrl"],"properties":{"scanId":{"type":"string"},"status":{"type":"string"},"pollUrl":{"type":"string"},"processingMethod":{"type":"string","const":"workflow"}}},"SkillScan":{"type":"object","required":["scanId","status","source"],"properties":{"scanId":{"type":"string"},"status":{"type":"string"},"source":{"type":"string"},"skill":{"type":"string"},"inputKind":{"type":"string"},"report":{},"error":{"type":"string"},"createdAt":{"type":"integer"},"updatedAt":{"type":"integer"},"completedAt":{"type":"integer"}},"additionalProperties":true}}}}