{"openapi":"3.1.0","info":{"title":"Payload Anomaly Scoring API","version":"1.0.0","description":"Score caller-supplied JSON and text for structural depth, type confusion, injection-shaped strings, and size inflation. The payload stays in memory for the request and is not executed or stored. Paid with x402 exact USDC on Base. No account is required.","contact":{"email":"support@brainiac.software"},"x-guidance":"BRAINIAC.software is a pay-per-call API for software agents. No account or API key is required.\nPayment uses the x402 protocol with exact USDC on Base (chain id 8453). Each POST operation has a fixed USD price.\nHow to call an operation:\n1. POST JSON matching the requestBody. Invalid input returns 400 with no payment challenge.\n2. A valid unpaid call returns 402 with the exact amount and payTo.\n3. Pay and retry with payment-signature. Payment settles only if the operation returns 2xx. A 4xx/5xx is not charged.\nInclude an Idempotency-Key header of 64 hex characters from 32 random bytes. Reuse that key only for retries of the same operation and request body.\nAll outputs are compliance prechecks, drafts, or data lookups for human review. They are not official determinations, legal advice, identity confirmation, or certified filings. Verify time-sensitive or official data with the cited source before acting."},"servers":[{"url":"https://www.brainiac.software"}],"paths":{"/api/v1/security/payload-anomaly-score":{"post":{"operationId":"score_payload_anomaly_and_input_safety","summary":"Score payload anomaly and input safety","description":"Score a caller-supplied JSON value or text string for nesting depth, mixed types, injection-shaped text, and size inflation. Matching is local and deterministic. The payload is not executed, fetched, or stored.","tags":["security"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"payload":{"anyOf":[{"type":"string","maxLength":200000},{"type":"number"},{"type":"boolean"},{"type":"null"},{"maxItems":5000,"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]}},"required":["payload"],"additionalProperties":false},"example":{"payload":{"user":"ada","note":"admin' OR '1'='1","profile":{"bio":"<script>alert(1)</script>","meta":{"a":{"b":{"c":{"d":{"e":{"f":{"g":1}}}}}}}},"flags":[1,"1",true],"filter":{"$gt":0}}}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. Conditional fields depend on the result and data-source availability.","content":{"application/json":{"schema":{"type":"object","properties":{"overall_safety_score":{"type":"number"},"risk_breakdown":{"type":"object","properties":{"depth_anomaly_risk":{"type":"number"},"type_confusion_risk":{"type":"number"},"injection_vector_risk":{"type":"number"},"size_inflation_risk":{"type":"number"}},"additionalProperties":true},"anomalies_detected":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"severity":{"type":"string"},"path":{"type":"string"},"detail":{"type":"string"}},"additionalProperties":true}},"audit_receipt":{"type":"string"}},"additionalProperties":true},"example":{"overall_safety_score":57,"risk_breakdown":{"depth_anomaly_risk":15,"type_confusion_risk":35,"injection_vector_risk":100,"size_inflation_risk":0},"anomalies_detected":[{"code":"nosql_operator","severity":"high","path":"$.filter[\"$gt\"]","detail":"This key is a NoSQL operator name. It was not sent to a database."},{"code":"mixed_array_types","severity":"medium","path":"$.flags","detail":"Items in this array use more than one JSON type: boolean, number, string."},{"code":"sql_tautology","severity":"high","path":"$.note","detail":"The text matches a SQL tautology pattern. It was not sent to a database."},{"code":"script_tag","severity":"high","path":"$.profile.bio","detail":"The text contains a script tag. The tag was not executed."},{"code":"depth_anomaly","severity":"low","path":"$.profile.meta.a.b.c.d.e.f.g","detail":"The deepest value is 9 levels down. The depth check starts at 6."}],"audit_receipt":"sha256:2bfb1c9dc51ada180dd98ab3a01a76df846bc9f42168ac2c7b0c1e5535b49b0c"}}}},"400":{"description":"Invalid JSON or request schema."},"402":{"description":"Payment required. The JSON body is the x402 PaymentRequired object: x402Version, resource with the operation description, accepts with the price and network, and extensions.bazaar with the input schema, input example, output schema, and output example."},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Reusing the key cannot trigger a second charge."},"413":{"description":"Request body exceeds the 24 MB limit."},"500":{"description":"Operation failed before settlement, so no payment is taken. Reuse the same idempotency key to retrieve the stored error without paying again."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.04"},"protocols":[{"x402":{"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}],"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}}},"components":{"schemas":{"ApiError":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}}}}}}}}