{"openapi":"3.1.0","info":{"title":"Margin & Markup API","version":"1.0.0","description":"Pricing and profitability maths as an API. The margin endpoint solves the relationships between unit cost, selling price, gross margin (a percentage of the price), markup (a percentage of the cost) and profit — give it any two of these and it works out all the rest. Price a product from a target margin, find the true margin of an existing price, convert a markup into a margin (they are not the same — the same price always has a lower margin than markup), or back out a cost from a price and markup. The breakeven endpoint computes how many units, and how much revenue, you need to sell to cover your fixed costs, given a unit price and a variable cost per unit, and returns the contribution margin and contribution-margin ratio. Negative results are reported honestly so a loss-making price is obvious. Everything is computed locally and deterministically, so it is instant and private. Ideal for e-commerce and retail pricing, quoting and sales tooling, finance and FP&A, marketplaces and POS systems, and unit-economics modelling. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is pricing maths; for everyday percentage operations use a percentage API and for loan and interest maths use a finance-calculator API.","contact":{"name":"PremiumApi","url":"https://www.oanor.com/by/premiumapi"}},"servers":[{"url":"https://api.oanor.com/margin-api","description":"oanor gateway"}],"tags":[{"name":"Margin"},{"name":"Meta"}],"components":{"securitySchemes":{"oanorKey":{"type":"apiKey","in":"header","name":"x-oanor-key","description":"Get your key at https://www.oanor.com/developer/keys"}}},"security":[{"oanorKey":[]}],"paths":{"/v1/breakeven":{"get":{"operationId":"get_v1_breakeven","tags":["Margin"],"summary":"Break-even analysis","description":"","parameters":[{"name":"fixed_costs","in":"query","required":true,"description":"Total fixed costs","schema":{"type":"string"},"example":"10000"},{"name":"price","in":"query","required":true,"description":"Selling price per unit","schema":{"type":"string"},"example":"25"},{"name":"variable_cost","in":"query","required":false,"description":"Variable cost per unit (default 0)","schema":{"type":"string"},"example":"15"},{"name":"round","in":"query","required":false,"description":"Decimal places (default 2)","schema":{"type":"string"}}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"price":25,"fixed_costs":10000,"variable_cost":15,"break_even_units":1000,"break_even_revenue":25000,"contribution_margin":10,"contribution_margin_ratio":40,"break_even_units_rounded_up":1000},"meta":{"timestamp":"2026-06-03T09:25:00.902Z","request_id":"ddc2e46d-214e-4e34-a043-62e492e793ae"},"status":"ok","message":"Break-even analysis","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}},"/v1/margin":{"get":{"operationId":"get_v1_margin","tags":["Margin"],"summary":"Solve pricing maths","description":"","parameters":[{"name":"cost","in":"query","required":false,"description":"Unit cost","schema":{"type":"string"},"example":"60"},{"name":"price","in":"query","required":false,"description":"Selling price","schema":{"type":"string"},"example":"100"},{"name":"profit","in":"query","required":false,"description":"Profit per unit","schema":{"type":"string"}},{"name":"margin","in":"query","required":false,"description":"Gross margin % (of price)","schema":{"type":"string"}},{"name":"markup","in":"query","required":false,"description":"Markup % (of cost)","schema":{"type":"string"}},{"name":"round","in":"query","required":false,"description":"Decimal places (default 2)","schema":{"type":"string"}}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"cost":60,"price":100,"profit":40,"profitable":true,"margin_percent":40,"markup_percent":66.67},"meta":{"timestamp":"2026-06-03T09:25:01.018Z","request_id":"c118fc13-c7e7-445e-ad48-45077c10416f"},"status":"ok","message":"Solve pricing maths","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}},"/v1/meta":{"get":{"operationId":"get_v1_meta","tags":["Meta"],"summary":"Spec","description":"","parameters":[],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"name":"Margin & Markup API","notes":"Margin is profit ÷ price; markup is profit ÷ cost — the same price has a lower margin than markup. Two percentages alone (margin + markup) cannot give absolute amounts; include a cost, price or profit. This is pricing maths — for everyday percentage operations use a percentage API. Nothing is stored.","version":"v1","endpoints":[{"path":"/v1/margin","params":{"cost":"unit cost","price":"selling price","round":"decimal places (default 2)","margin":"gross margin % (of price)","markup":"markup % (of cost)","profit":"profit per unit"},"returns":"cost, price, profit, margin % and markup %"},{"path":"/v1/breakeven","params":{"price":"selling price per unit (required)","round":"decimal places (default 2)","fixed_costs":"total fixed costs (required)","variable_cost":"variable cost per unit (default 0)"},"returns":"break-even units, revenue and contribution margin"},{"path":"/v1/meta","params":[],"returns":"this document"}],"description":"Pricing and profitability maths. The margin endpoint solves the relationships between cost, selling price, gross margin (% of price), markup (% of cost) and profit — give it any two of them and it works out the rest, so you can price from a target margin, find the margin of an existing price, or convert markup to margin. The breakeven endpoint computes how many units (and how much revenue) you must sell to cover your fixed costs, given a unit price and variable cost, along with the contribution margin. Pure local maths, no key."},"meta":{"timestamp":"2026-06-03T09:25:01.126Z","request_id":"3a1238fc-4c24-49fb-9a1c-742226d15e3f"},"status":"ok","message":"Meta","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}}},"x-oanor-pricing":[{"slug":"free","name":"Free","price_cents_month":0,"monthly_call_quota":3335,"rps_limit":2,"hard_limit":true},{"slug":"starter","name":"Starter","price_cents_month":485,"monthly_call_quota":12850,"rps_limit":8,"hard_limit":true},{"slug":"pro","name":"Pro","price_cents_month":2475,"monthly_call_quota":179500,"rps_limit":20,"hard_limit":true},{"slug":"mega","name":"Mega","price_cents_month":6275,"monthly_call_quota":940000,"rps_limit":50,"hard_limit":true}],"x-oanor-marketplace-url":"https://www.oanor.com/api/margin-api"}