{"openapi":"3.1.0","info":{"title":"Unit Price API","version":"1.0.0","description":"Unit-price and best-value maths as an API — the supermarket \"which is cheaper\" calculation, computed locally and deterministically and entirely currency-agnostic. The unit endpoint normalises a pack price to a price per standard unit: from a price, a pack size and its unit (and an optional multipack count) it returns the price per kilogram, per 100 g and per pound for weight; per litre, per 100 ml and per fluid ounce for volume; or per item for counted goods — plus the price per pack item for multipacks. The compare endpoint takes several pack options as a simple list (such as \"3@500g,5@1kg,4.5@750g\"), ranks them cheapest-per-unit first, names the best value and reports the percentage saving versus the most expensive. The convert endpoint turns a unit price given in one basis (for example per pound) into the other bases for its measure. Everything is computed locally and deterministically, so it is instant and private. Options being compared must share a measure (all weight, all volume or all count). Ideal for shopping and grocery apps, price-comparison and deal sites, budgeting tools, and retail and procurement software. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is unit-price comparison; for profit margin and markup use a margin API.","contact":{"name":"PremiumApi","url":"https://www.oanor.com/by/premiumapi"}},"servers":[{"url":"https://api.oanor.com/unitprice-api","description":"oanor gateway"}],"tags":[{"name":"Price"},{"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/compare":{"get":{"operationId":"get_v1_compare","tags":["Price"],"summary":"Compare options, find best value","description":"","parameters":[{"name":"options","in":"query","required":true,"description":"price@size[unit] list","schema":{"type":"string"},"example":"3@500g,5@1kg,4.5@750g"},{"name":"unit","in":"query","required":false,"description":"Shared unit if options omit it","schema":{"type":"string"}}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"note":"Options ranked cheapest-per-unit first. savings_vs_worst_percent compares the best option to the most expensive per unit.","measure":"weight","options":[{"rank":1,"size":1,"unit":"kg","count":1,"label":"5@1kg","price":5,"is_best":true,"unit_price":{"per_g":0.005,"per_kg":5,"per_lb":2.268,"per_100g":0.5}},{"rank":2,"size":500,"unit":"g","count":1,"label":"3@500g","price":3,"is_best":false,"unit_price":{"per_g":0.006,"per_kg":6,"per_lb":2.7216,"per_100g":0.6}},{"rank":3,"size":750,"unit":"g","count":1,"label":"4.5@750g","price":4.5,"is_best":false,"unit_price":{"per_g":0.006,"per_kg":6,"per_lb":2.7216,"per_100g":0.6}}],"best_value":{"label":"5@1kg","unit_price":{"per_g":0.005,"per_kg":5,"per_lb":2.268,"per_100g":0.5}},"savings_vs_worst_percent":16.67},"meta":{"timestamp":"2026-06-04T01:59:20.112Z","request_id":"17271199-0e7b-45c3-985c-1bce656ab98f"},"status":"ok","message":"Compare options","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/convert":{"get":{"operationId":"get_v1_convert","tags":["Price"],"summary":"Convert a unit price between bases","description":"","parameters":[{"name":"price","in":"query","required":true,"description":"Price per one unit","schema":{"type":"string"},"example":"5"},{"name":"from","in":"query","required":true,"description":"Unit it is per (e.g. lb)","schema":{"type":"string"},"example":"lb"}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"note":"Converts a price expressed per one unit into the standard per-unit bases for that measure.","input":{"from":"lb","price":5,"measure":"weight"},"unit_price":{"per_g":0.011023,"per_kg":11.0231,"per_lb":5,"per_100g":1.1023}},"meta":{"timestamp":"2026-06-04T01:59:20.206Z","request_id":"a7d48585-f00b-4471-abeb-5fcc4d7e274f"},"status":"ok","message":"Convert unit price","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/unit":{"get":{"operationId":"get_v1_unit","tags":["Price"],"summary":"Price per standard unit","description":"","parameters":[{"name":"price","in":"query","required":true,"description":"Pack price","schema":{"type":"string"},"example":"3"},{"name":"size","in":"query","required":true,"description":"Pack size","schema":{"type":"string"},"example":"500"},{"name":"unit","in":"query","required":true,"description":"g|kg|oz|lb|ml|l|floz|each","schema":{"type":"string"},"example":"g"},{"name":"count","in":"query","required":false,"description":"Multipack count","schema":{"type":"string"},"example":"1"}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"note":"Unit price = pack price ÷ total quantity. Multipacks multiply size by count.","input":{"size":500,"unit":"g","count":1,"price":3,"measure":"weight"},"unit_price":{"per_g":0.006,"per_kg":6,"per_lb":2.7216,"per_100g":0.6},"total_base_quantity":500},"meta":{"timestamp":"2026-06-04T01:59:20.297Z","request_id":"6074fb9e-00fd-414f-9825-f0c8cb1abb64"},"status":"ok","message":"Unit price","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":{"note":"Currency-agnostic. Compare options must share a measure (all weight, all volume or all count).","units":{"count":["each","item","pack"],"volume":["ml","cl","l","floz","pt","qt","gal","cup"],"weight":["mg","g","kg","oz","lb"]},"service":"unitprice","endpoints":{"/v1/unit":"Price per kg/litre/100g/item from a pack price, size and unit (with multipack count).","/v1/compare":"Rank several pack options by price per unit and report the saving vs the worst.","/v1/convert":"Convert a unit price (e.g. per lb) into the other bases for its measure."},"description":"Unit-price and best-value maths: normalise pack prices, compare options, and convert a unit price between bases."},"meta":{"timestamp":"2026-06-04T01:59:20.372Z","request_id":"0dbb05cd-ce95-494e-9e0c-03d6ef4d8f9d"},"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":10735,"rps_limit":2,"hard_limit":true},{"slug":"starter","name":"Starter","price_cents_month":1225,"monthly_call_quota":20350,"rps_limit":8,"hard_limit":true},{"slug":"pro","name":"Pro","price_cents_month":3215,"monthly_call_quota":253500,"rps_limit":20,"hard_limit":true},{"slug":"mega","name":"Mega","price_cents_month":7015,"monthly_call_quota":1310000,"rps_limit":50,"hard_limit":true}],"x-oanor-marketplace-url":"https://www.oanor.com/api/unitprice-api"}