# Source Maintainability Index API > Score caller-supplied JavaScript, TypeScript, Python, or Go, or a caller-supplied AST, for cyclomatic complexity, cognitive load, nesting depth, and structural duplication. The snippet is parsed in memory and is not executed or stored. Each POST has a fixed USDC price on Base, paid with the x402 exact scheme. The request is validated first, and payment settles only after a successful (2xx) result. Failed calls are not charged. 1. POST JSON matching the requestBody. Invalid input returns 400 with no payment challenge. 2. A valid unpaid call returns 402 with the exact amount and payTo. 3. Pay and retry with payment-signature. Payment settles only if the operation returns 2xx. A 4xx/5xx is not charged. - Product: https://www.brainiac.software/api/code - Docs: https://www.brainiac.software/api/code/docs - OpenAPI: https://www.brainiac.software/api/code/openapi.json - Contact: support@brainiac.software (https://www.brainiac.software/contact) ## Operations ### POST /api/v1/code/maintainability-index $0.04 USDC. Build a structural AST from a caller-supplied JavaScript, TypeScript, Python, or Go snippet, or from a caller-supplied AST, and score cyclomatic complexity, cognitive load, nesting depth, and duplicated function structure. The snippet is not executed or stored. Inputs: language?, source?, ast? Docs: https://www.brainiac.software/api/code/docs#code-maintainability-index Example request: ```json { "language": "javascript", "source": "function price(order) {\n if (order.rush && order.total > 100) {\n if (order.member) {\n return order.total * 0.9\n } else {\n return order.total * 0.95\n }\n }\n if (order.rush) {\n return order.total * 1.1\n }\n return order.total\n}\n\nfunction priceCopy(order) {\n if (order.rush && order.total > 100) {\n if (order.member) {\n return order.total * 0.9\n } else {\n return order.total * 0.95\n }\n }\n if (order.rush) {\n return order.total * 1.1\n }\n return order.total\n}\n" } ``` Example response: ```json { "maintainability_score": 40, "cognitive_load_index": 38, "technical_debt_estimate_hours": 0.75, "audit_receipt": "sha256:cf03e0c1a32b0737eb97627b5b20a8417532be3c944cd89c9200400c13870f09" } ```