{"openapi":"3.0.3","info":{"title":"AgentMath & Fact-Checker API","description":"Deterministic mathematical, VAT, business days, and invoice reconciliation guardrails for LLMs, ERPs, and AI finance agents.","version":"1.0.0","contact":{"name":"TopAI SaaS Studio","email":"top.ai.saas@gmail.com","url":"https://agentmath-fact-checker.topaisaas.workers.dev"}},"servers":[{"url":"https://agentmath-fact-checker.topaisaas.workers.dev","description":"Cloudflare Workers Production Edge"}],"paths":{"/v1/health":{"get":{"summary":"Healthcheck","description":"Service health and uptime verification.","responses":{"200":{"description":"Service is healthy and active."}}}},"/v1/vat/calculate":{"post":{"summary":"Calculate VAT / Sales Tax","description":"Calculates multi-country VAT from net or gross amount, with EU B2B intra-community reverse-charge support.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["amount","country"],"properties":{"amount":{"type":"number","example":100},"country":{"type":"string","example":"FR"},"rate_type":{"type":"string","enum":["standard","intermediate","reduced","super_reduced","zero"]},"custom_rate":{"type":"number","example":20},"mode":{"type":"string","enum":["from_net","from_gross"],"default":"from_net"},"is_b2b_cross_border":{"type":"boolean","default":false}}}}}},"responses":{"200":{"description":"Successful VAT computation"}}}},"/v1/vat/rates":{"get":{"summary":"List Supported VAT Rates","description":"Returns official VAT and sales tax rates across all supported countries.","responses":{"200":{"description":"List of countries and tax rates"}}}},"/v1/business-days/calculate":{"post":{"summary":"Calculate Business Days & Bank Holidays","description":"Calculates business days between dates or projects a future date (+N days) accounting for national and movable Easter bank holidays.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["start_date"],"properties":{"start_date":{"type":"string","example":"2026-05-01"},"end_date":{"type":"string","example":"2026-05-15"},"days_to_add":{"type":"integer","example":10},"country":{"type":"string","example":"FR"},"exclude_weekends":{"type":"boolean","default":true},"exclude_holidays":{"type":"boolean","default":true}}}}}},"responses":{"200":{"description":"Calculated business days timeline"}}}},"/v1/holidays":{"get":{"summary":"List Public Holidays","description":"Lists all official public holidays for a given country and year.","parameters":[{"name":"year","in":"query","schema":{"type":"integer","example":2026}},{"name":"country","in":"query","schema":{"type":"string","example":"FR"}}],"responses":{"200":{"description":"List of holidays"}}}},"/v1/finance/compound-interest":{"post":{"summary":"Compute Compound Interest & APY","description":"Deterministic cent-precise compound interest and effective annual yield with periodic monthly contributions.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["principal","annual_rate_percent","years"],"properties":{"principal":{"type":"number","example":10000},"annual_rate_percent":{"type":"number","example":7.5},"years":{"type":"integer","example":5},"compounding_frequency":{"type":"string","enum":["annually","semi-annually","quarterly","monthly","daily"],"default":"monthly"},"monthly_contribution":{"type":"number","example":250}}}}}},"responses":{"200":{"description":"Financial simulation results and yearly breakdown"}}}},"/v1/finance/loan-amortization":{"post":{"summary":"Calculate Loan Monthly Payment & Amortization","description":"Calculates monthly loan installment and total interest paid.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["loan_amount","annual_interest_rate_percent","term_months"],"properties":{"loan_amount":{"type":"number","example":100000},"annual_interest_rate_percent":{"type":"number","example":3.5},"term_months":{"type":"integer","example":240}}}}}},"responses":{"200":{"description":"Amortization summary"}}}},"/v1/reconcile/invoice-check":{"post":{"summary":"Reconcile Invoice & Audit Mathematical Discrepancies","description":"Anti-hallucination auditor that validates line-item arithmetic, discounts, VAT rate buckets, and declared totals down to 0.01 €/$ variance.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["items"],"properties":{"items":{"type":"array","items":{"type":"object","required":["quantity","unit_price_ht"],"properties":{"description":{"type":"string","example":"AI Engineering Service"},"quantity":{"type":"number","example":10},"unit_price_ht":{"type":"number","example":150},"discount_percent":{"type":"number","example":0},"vat_rate":{"type":"number","example":20},"declared_line_ht":{"type":"number","example":1500}}}},"declared_total_ht":{"type":"number","example":1500},"declared_total_vat":{"type":"number","example":300},"declared_total_ttc":{"type":"number","example":1800},"global_discount_percent":{"type":"number","example":0}}}}}},"responses":{"200":{"description":"Audit verdict with exact cent-level discrepancies detected"}}}}}}