{"openapi": "3.1.0", "info": {"title": "CodePulse", "version": "1.0", "description": "CodePulse is a static analysis and code intelligence API. Submit a code snippet or GitHub URL and receive structured findings covering security vulnerabilities (OWASP Top 10 categories), code quality issues, dependency risk flags, and a composite health score. Built for AI coding agents, CI/CD pipelines, and developer-tool platforms that need a managed code review layer without running local static-analysis toolchains.\n"}, "servers": [{"url": "https://codepulse.waltsoft.net/v1", "description": "CodePulse production API"}], "security": [{"ApiKeyAuth": []}], "paths": {"/analyze": {"post": {"operationId": "analyzeCode", "summary": "Analyze a code snippet for security and quality issues", "description": "Submits code for static analysis. Returns security findings categorized by OWASP Top 10, code quality issues (complexity, duplication, dead code), dependency vulnerability flags, and a composite health score (0-100). Supports Python, JavaScript/TypeScript, Go, Java, and Rust. Billed at $0.01 per call.\n", "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "oneOf": [{"required": ["code", "language"], "properties": {"code": {"type": "string", "description": "Source code to analyze (max 32 KB).", "maxLength": 32768}, "language": {"type": "string", "enum": ["python", "javascript", "typescript", "go", "java", "rust"]}, "context": {"type": "string", "description": "Optional description of what this code does, for improved findings."}}}, {"required": ["github_url"], "properties": {"github_url": {"type": "string", "description": "GitHub URL to a file or PR diff (public repos only).", "example": "https://github.com/owner/repo/blob/main/src/handler.py"}}}]}}}}, "responses": {"200": {"description": "Static analysis results", "content": {"application/json": {"schema": {"type": "object", "properties": {"health_score": {"type": "integer", "minimum": 0, "maximum": 100, "description": "Composite health score; 80+ is healthy, below 50 needs attention."}, "language": {"type": "string"}, "lines_analyzed": {"type": "integer"}, "security_findings": {"type": "array", "items": {"type": "object", "properties": {"owasp_category": {"type": "string", "description": "OWASP Top 10 category (e.g. A03-Injection, A07-Auth-Failures)."}, "severity": {"type": "string", "enum": ["info", "low", "medium", "high", "critical"]}, "line": {"type": "integer"}, "message": {"type": "string"}, "remediation": {"type": "string"}}}}, "quality_findings": {"type": "array", "items": {"type": "object", "properties": {"category": {"type": "string", "enum": ["complexity", "duplication", "dead_code", "style"]}, "severity": {"type": "string", "enum": ["info", "low", "medium", "high"]}, "line": {"type": "integer"}, "message": {"type": "string"}}}}, "dependency_flags": {"type": "array", "items": {"type": "object", "properties": {"package": {"type": "string"}, "cve": {"type": "string"}, "severity": {"type": "string"}}}}, "summary": {"type": "string", "description": "One-paragraph natural-language summary of findings."}, "usage": {"type": "object", "properties": {"billed_units": {"type": "integer"}, "price_usd": {"type": "string"}}}}}}}}, "402": {"description": "Payment required -- x402 challenge"}, "400": {"description": "Invalid code or unsupported language"}, "401": {"description": "Invalid or missing API key"}}}}, "/diff": {"post": {"operationId": "analyzeDiff", "summary": "Analyze a git diff for security regressions", "description": "Analyzes a unified diff (e.g. from a pull request) and returns only NEW findings introduced in the changed lines. Ideal for CI/CD gate integration. Billed at $0.01 per call.\n", "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "required": ["diff", "language"], "properties": {"diff": {"type": "string", "description": "Unified diff text (max 32 KB).", "maxLength": 32768}, "language": {"type": "string", "enum": ["python", "javascript", "typescript", "go", "java", "rust"]}}}}}}, "responses": {"200": {"description": "Diff analysis results", "content": {"application/json": {"schema": {"type": "object", "properties": {"new_findings_count": {"type": "integer"}, "security_regressions": {"type": "array", "items": {"type": "object", "properties": {"severity": {"type": "string"}, "line": {"type": "integer"}, "message": {"type": "string"}}}}, "verdict": {"type": "string", "enum": ["pass", "warn", "fail"], "description": "Gate verdict for CI/CD integration."}}}}}}, "402": {"description": "Payment required -- x402 challenge"}, "401": {"description": "Invalid or missing API key"}}}}}, "components": {"securitySchemes": {"ApiKeyAuth": {"type": "apiKey", "in": "header", "name": "X-API-Key"}}}}
