{"openapi":"3.1.0","info":{"title":"Aspect Ratio API","version":"1.0.0","description":"Aspect-ratio and resize maths on plain dimensions — no image upload needed. The ratio endpoint reduces a width×height to its simplest integer ratio (1920×1080 → 16:9), its decimal value and a common name. The resize endpoint scales a dimension while preserving the ratio: give a new width or a new height and get the other side. The fit endpoint fits a source size into a target box using contain (letterbox) or cover (crop), returning the resulting size, the scale factor and the centering offset. Perfect for responsive layouts and CSS aspect-ratio, video and thumbnail framing, image-grid planning and print sizing. Pure local computation — it works on numbers only and never touches image files. Live, nothing stored. 4 endpoints. Distinct from image processing/resizing (which operates on actual files) and from geometry of shapes.","contact":{"name":"PremiumApi","url":"https://www.oanor.com/by/premiumapi"}},"servers":[{"url":"https://api.oanor.com/aspectratio-api","description":"oanor gateway"}],"tags":[{"name":"Aspect Ratio"},{"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/fit":{"get":{"operationId":"get_v1_fit","tags":["Aspect Ratio"],"summary":"Fit dimensions into a box","description":"","parameters":[{"name":"width","in":"query","required":true,"description":"Source width","schema":{"type":"string"},"example":"1920"},{"name":"height","in":"query","required":true,"description":"Source height","schema":{"type":"string"},"example":"1080"},{"name":"box_width","in":"query","required":true,"description":"Box width","schema":{"type":"string"},"example":"800"},{"name":"box_height","in":"query","required":true,"description":"Box height","schema":{"type":"string"},"example":"800"},{"name":"mode","in":"query","required":false,"description":"contain|cover (default contain)","schema":{"type":"string"},"example":"contain"}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"box":{"width":800,"height":800},"mode":"contain","scale":0.416667,"width":800,"height":450,"offset":{"x":0,"y":175},"source":{"width":1920,"height":1080}},"meta":{"timestamp":"2026-06-02T16:51:44.710Z","request_id":"fbaff8f9-eb21-43dc-9760-530cbd003b19"},"status":"ok","message":"Fit into a box","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/ratio":{"get":{"operationId":"get_v1_ratio","tags":["Aspect Ratio"],"summary":"Simplify an aspect ratio","description":"","parameters":[{"name":"width","in":"query","required":true,"description":"Width","schema":{"type":"string"},"example":"1920"},{"name":"height","in":"query","required":true,"description":"Height","schema":{"type":"string"},"example":"1080"}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"ratio":"16:9","width":1920,"height":1080,"decimal":1.777778,"common_name":"Widescreen HD (16:9)"},"meta":{"timestamp":"2026-06-02T16:51:44.802Z","request_id":"b8ff6cb3-9add-48b4-bc8b-4bddab54052c"},"status":"ok","message":"Simplify an aspect ratio","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/resize":{"get":{"operationId":"get_v1_resize","tags":["Aspect Ratio"],"summary":"Resize keeping the ratio","description":"","parameters":[{"name":"width","in":"query","required":true,"description":"Original width","schema":{"type":"string"},"example":"1920"},{"name":"height","in":"query","required":true,"description":"Original height","schema":{"type":"string"},"example":"1080"},{"name":"new_width","in":"query","required":false,"description":"Target width (or set new_height)","schema":{"type":"string"},"example":"1280"},{"name":"new_height","in":"query","required":false,"description":"Target height (or set new_width)","schema":{"type":"string"}}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"from":{"width":1920,"height":1080},"scale":0.666667,"width":1280,"height":720},"meta":{"timestamp":"2026-06-02T16:51:44.902Z","request_id":"364f7fa4-b010-4be7-8ec7-7ccbaee5dc4f"},"status":"ok","message":"Resize keeping ratio","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":"Aspect Ratio API","notes":"Operates on numbers only — for layout, video frames, thumbnails and responsive planning. It does not process image files.","version":"v1","endpoints":[{"path":"/v1/ratio","params":{"width":"required","height":"required"},"returns":"simplified ratio (e.g. 16:9), decimal, common name"},{"path":"/v1/resize","params":{"width":"required","height":"required","new_width":"or","new_height":"one of these"},"returns":"the other dimension, keeping the ratio"},{"path":"/v1/fit","params":{"mode":"contain|cover","width":"required","height":"required","box_width":"required","box_height":"required"},"returns":"fitted width/height, scale and centering offset"},{"path":"/v1/meta","params":[],"returns":"this document"}],"description":"Aspect-ratio and resize maths on plain dimensions — no image upload. Reduce a width×height to its simplest ratio, scale a dimension while keeping the ratio, and fit a size into a box (contain/cover). Pure local, no key."},"meta":{"timestamp":"2026-06-02T16:51:44.988Z","request_id":"677815ce-51bf-402b-93e9-d4d24337cdce"},"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":840,"rps_limit":2,"hard_limit":true},{"slug":"starter","name":"Starter","price_cents_month":150,"monthly_call_quota":6900,"rps_limit":8,"hard_limit":true},{"slug":"pro","name":"Pro","price_cents_month":1980,"monthly_call_quota":129000,"rps_limit":20,"hard_limit":true},{"slug":"mega","name":"Mega","price_cents_month":5580,"monthly_call_quota":665000,"rps_limit":50,"hard_limit":true}],"x-oanor-marketplace-url":"https://www.oanor.com/api/aspectratio-api"}