{"openapi":"3.1.0","info":{"title":"RoutineMetric Financial & Tax Compliance API","version":"1.0.0","description":"Enterprise-grade financial, tax, and accounting microservices for fintech, payroll, and compliance platforms. Provides stateless, high-performance engines for Section 174 R&D amortization, ASC 842 / IFRS 16 lease liability schedules, multi-state Paid Family & Medical Leave (PFML) calculations, and SOX audit materiality planning.","contact":{"name":"RoutineMetric Engineering Support","url":"https://routinemetric.com/developers","email":"support@routinemetric.com"},"license":{"name":"Commercial API License","url":"https://routinemetric.com/legal/terms-of-service"}},"servers":[{"url":"https://routinemetric.com/api/v1","description":"Production API Gateway"},{"url":"http://localhost:3000/api/v1","description":"Local Development Server"}],"security":[{"RapidApiSecret":[]},{"BearerAuth":[]}],"paths":{"/tax/section-174":{"post":{"summary":"Section 174 R&D Expense Amortization","description":"Calculates domestic (5-year) vs foreign (15-year) R&D capitalization under IRC Section 174 with half-year convention depreciation, allowable current-year deductions, taxable income impact, and multi-year amortization schedule.","operationId":"calculateSection174","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Section174Request"},"example":{"taxYear":2026,"domesticRdExpenses":500000,"foreignRdExpenses":100000,"corporateTaxRate":0.21}}}},"responses":{"200":{"description":"Section 174 calculation computed successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Section174Response"}}}},"400":{"description":"Validation error in request payload","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Unauthorized - invalid or missing API credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/accounting/asc-842":{"post":{"summary":"ASC 842 / IFRS 16 Lease Schedule & Journal Entries","description":"Computes Present Value (PV) of lease obligations, initial Right-of-Use (ROU) asset value, monthly interest accretion, liability principal reduction, ROU asset amortization, and GAAP journal entries.","operationId":"calculateAsc842","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Asc842Request"},"example":{"leaseTermMonths":36,"discountRateAnnual":0.065,"monthlyPayment":5000,"paymentTiming":"in_advance","initialDirectCosts":1500,"leaseIncentives":0}}}},"responses":{"200":{"description":"ASC 842 lease schedule and journal entries computed successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Asc842Response"}}}},"400":{"description":"Validation error in request payload","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Unauthorized - invalid or missing API credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/payroll/pfml":{"post":{"summary":"Multi-State Paid Family & Medical Leave (PFML) Premium","description":"Evaluates statutory employer and employee PFML contributions across Massachusetts, Washington, New York, California, Oregon, and Colorado, enforcing state wage caps and small-employer (<25 FTE) exemptions.","operationId":"calculatePfml","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PfmlRequest"},"example":{"state":"MA","grossAnnualWages":180000,"employeeCount":30}}}},"responses":{"200":{"description":"PFML contributions calculated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PfmlResponse"}}}},"400":{"description":"Validation error in request payload","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Unauthorized - invalid or missing API credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/audit/sox-materiality":{"post":{"summary":"SOX Planning Materiality & Tolerable Misstatement","description":"Calculates PCAOB-aligned planning materiality, tolerable misstatement (50-75%), and de minimis Summary of Audit Differences (SAD) threshold across financial statement benchmarks for public corporate audits.","operationId":"calculateSoxMateriality","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SoxMaterialityRequest"},"example":{"benchmark":"pre_tax_income","amount":10000000,"riskProfile":"moderate"}}}},"responses":{"200":{"description":"SOX audit materiality benchmarks calculated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SoxMaterialityResponse"}}}},"400":{"description":"Validation error in request payload","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Unauthorized - invalid or missing API credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}}},"components":{"securitySchemes":{"RapidApiSecret":{"type":"apiKey","in":"header","name":"x-rapidapi-proxy-secret","description":"RapidAPI Gateway proxy verification secret."},"BearerAuth":{"type":"http","scheme":"bearer","description":"Bearer authentication token. For sandbox testing, provide \"Bearer demo-sandbox-2026\"."}},"schemas":{"Section174Request":{"type":"object","required":["taxYear","domesticRdExpenses","foreignRdExpenses"],"properties":{"taxYear":{"type":"integer","description":"Tax year under review (e.g., 2026)","example":2026},"domesticRdExpenses":{"type":"number","description":"Qualified domestic research and experimental expenditures in USD","example":500000},"foreignRdExpenses":{"type":"number","description":"Qualified foreign research and experimental expenditures in USD","example":100000},"corporateTaxRate":{"type":"number","description":"Effective corporate income tax rate (default 0.21)","example":0.21,"default":0.21}}},"Section174Response":{"type":"object","properties":{"success":{"type":"boolean","example":true},"meta":{"type":"object","properties":{"tier":{"type":"string","example":"sandbox"},"version":{"type":"string","example":"v1"},"timestamp":{"type":"string","example":"2026-09-07T22:00:00.000Z"},"provider":{"type":"string","example":"RoutineMetric Engine"}}},"data":{"type":"object","properties":{"taxYear":{"type":"integer","example":2026},"totalRdExpenses":{"type":"number","example":600000},"domesticCapitalized":{"type":"number","example":500000},"foreignCapitalized":{"type":"number","example":100000},"currentYearAllowableDeduction":{"type":"number","example":53333.33},"taxableIncomeIncrease":{"type":"number","example":546666.67},"estimatedCashTaxImpact":{"type":"number","example":114800},"amortizationSchedule":{"type":"array","items":{"type":"object","properties":{"year":{"type":"integer"},"domesticAmortization":{"type":"number"},"foreignAmortization":{"type":"number"},"totalAmortization":{"type":"number"},"unrecoveredBasis":{"type":"number"}}}}}}}},"Asc842Request":{"type":"object","required":["leaseTermMonths","discountRateAnnual","monthlyPayment","paymentTiming"],"properties":{"leaseTermMonths":{"type":"integer","description":"Total duration of lease term in months","example":36},"discountRateAnnual":{"type":"number","description":"Annual Incremental Borrowing Rate (IBR) as decimal (e.g., 0.065 for 6.5%)","example":0.065},"monthlyPayment":{"type":"number","description":"Fixed monthly lease payment in USD","example":5000},"paymentTiming":{"type":"string","enum":["in_advance","in_arrears"],"description":"Payment schedule timing (in advance / beginning of period, or in arrears / end of period)","example":"in_advance"},"initialDirectCosts":{"type":"number","description":"Initial direct costs capitalized to ROU asset","example":0,"default":0},"leaseIncentives":{"type":"number","description":"Lease incentives received from lessor reducing ROU asset","example":0,"default":0}}},"Asc842Response":{"type":"object","properties":{"success":{"type":"boolean","example":true},"meta":{"type":"object"},"data":{"type":"object","properties":{"initialLeaseLiability":{"type":"number","example":163914.5},"initialRouAsset":{"type":"number","example":163914.5},"totalLeasePayments":{"type":"number","example":180000},"totalInterestExpense":{"type":"number","example":16085.5},"classificationSuggestion":{"type":"string","example":"Finance / Right-of-Use Capitalized"},"firstYearSchedule":{"type":"array","items":{"type":"object","properties":{"month":{"type":"integer"},"payment":{"type":"number"},"interestExpense":{"type":"number"},"principalReduction":{"type":"number"},"endingLeaseLiability":{"type":"number"},"rouAssetAmortization":{"type":"number"},"endingRouAsset":{"type":"number"}}}},"sampleJournalEntries":{"type":"array","items":{"type":"object","properties":{"period":{"type":"string"},"description":{"type":"string"},"entries":{"type":"array","items":{"type":"object","properties":{"account":{"type":"string"},"debit":{"type":"number"},"credit":{"type":"number"}}}}}}}}}}},"PfmlRequest":{"type":"object","required":["state","grossAnnualWages","employeeCount"],"properties":{"state":{"type":"string","enum":["MA","WA","NY","CA","OR","CO"],"description":"Two-letter US state postal code","example":"MA"},"grossAnnualWages":{"type":"number","description":"Employee gross annual payroll wages in USD","example":180000},"employeeCount":{"type":"integer","description":"Company-wide FTE employee count (determines small employer exemption)","example":30}}},"PfmlResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"meta":{"type":"object"},"data":{"type":"object","properties":{"state":{"type":"string","example":"MA"},"annualSubjectWages":{"type":"number","example":168600},"wageCapApplied":{"type":"boolean","example":true},"totalAnnualPremium":{"type":"number","example":1483.68},"employeeShare":{"type":"number","example":775.52},"employerShare":{"type":"number","example":708.16},"employerExemptionApplied":{"type":"boolean","example":false},"statutoryNotes":{"type":"string"}}}}},"SoxMaterialityRequest":{"type":"object","required":["benchmark","amount","riskProfile"],"properties":{"benchmark":{"type":"string","enum":["pre_tax_income","total_revenues","total_assets","equity"],"description":"Selected financial statement benchmark","example":"pre_tax_income"},"amount":{"type":"number","description":"Dollar value of selected benchmark in USD","example":10000000},"riskProfile":{"type":"string","enum":["low","moderate","high"],"description":"Company audit risk assessment","example":"moderate"}}},"SoxMaterialityResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"meta":{"type":"object"},"data":{"type":"object","properties":{"selectedBenchmark":{"type":"string","example":"pre_tax_income"},"benchmarkAmount":{"type":"number","example":10000000},"planningMateriality":{"type":"number","example":400000},"tolerableMisstatement":{"type":"number","example":280000},"tolerableMisstatementPercentage":{"type":"string","example":"70% of Planning Materiality"},"deMinimisSummaryOfAuditDifferencesThreshold":{"type":"number","example":20000},"governanceGuidance":{"type":"string"}}}}},"ApiError":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"Validation error: taxYear must be >= 2000"},"documentation":{"type":"string","example":"https://routinemetric.com/developers"},"timestamp":{"type":"string","example":"2026-09-07T22:00:00.000Z"}}}}}}