{"openapi":"3.1.0","info":{"title":"Center of Mass API","version":"1.0.0","description":"Centre-of-mass and barycentre mechanics as an API, computed locally and deterministically. The point-masses endpoint computes the centre of mass of a system of point masses in one, two or three dimensions, applying x_com = Σ(m_i·x_i)/Σm_i to each axis from a list of masses and their x (and optional y and z) coordinates — masses of 1, 2 and 3 at positions 0, 1 and 2 give a centre of mass at 1.333, and four equal masses at the corners of a square sit at its centre. The two-body endpoint computes the barycentre of two masses separated by a distance, r1 = d·m2/(m1+m2) from the first body, which always lies closer to the heavier one — for the Earth-Moon system the barycentre is about 4 670 km from Earth’s centre, still inside the planet. Lists may be passed as comma-separated values (masses=1,2,3&x=0,1,2) or as JSON arrays in a POST body, and units are consistent and unit-agnostic. Everything is computed locally and deterministically, so it is instant and private. Ideal for physics, engineering-statics, astronomy, robotics, game-physics and mechanics-education app developers, balance-point and barycentre tools, and simulation software. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 2 endpoints. This is the centre of mass; for the rotational moment of inertia use a moment-of-inertia API.","contact":{"name":"PremiumApi","url":"https://www.oanor.com/by/premiumapi"}},"servers":[{"url":"https://api.oanor.com/centerofmass-api","description":"oanor gateway"}],"tags":[{"name":"CenterOfMass"},{"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/point-masses":{"get":{"operationId":"get_v1_point_masses","tags":["CenterOfMass"],"summary":"Center of mass of point masses","description":"","parameters":[{"name":"masses","in":"query","required":true,"description":"Masses (comma-separated or array)","schema":{"type":"string"},"example":"1,2,3"},{"name":"x","in":"query","required":true,"description":"x coordinates","schema":{"type":"string"},"example":"0,1,2"},{"name":"y","in":"query","required":false,"description":"y coordinates (2D/3D)","schema":{"type":"string"}},{"name":"z","in":"query","required":false,"description":"z coordinates (3D)","schema":{"type":"string"}}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"note":"Centre of mass x_com = Σ(m_i·x_i)/Σm_i, applied per axis. Masses [1,2,3] at x [0,1,2] give x_com = 8/6 ≈ 1.3333.","x_com":1.33333333,"inputs":{"count":3,"total_mass":6},"dimensions":1},"meta":{"timestamp":"2026-06-05T19:50:22.935Z","request_id":"fee3e554-2556-4361-9647-ad0cab42e1f8"},"status":"ok","message":"Center of mass of point masses","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/two-body":{"get":{"operationId":"get_v1_two_body","tags":["CenterOfMass"],"summary":"Two-body barycentre","description":"","parameters":[{"name":"m1","in":"query","required":true,"description":"First mass","schema":{"type":"string"},"example":"10"},{"name":"m2","in":"query","required":true,"description":"Second mass","schema":{"type":"string"},"example":"2"},{"name":"separation","in":"query","required":true,"description":"Distance between them","schema":{"type":"string"},"example":"12"}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"note":"Two-body barycentre: r1 = d·m2/(m1+m2) from the first mass; the barycentre lies closer to the heavier body. For the Earth-Moon system it sits inside the Earth.","inputs":{"m1":10,"m2":2,"separation":12},"mass_ratio":5,"distance_from_m1":2,"distance_from_m2":10},"meta":{"timestamp":"2026-06-05T19:50:23.035Z","request_id":"ff6e002e-b843-4134-8482-f021f3c28a57"},"status":"ok","message":"Two-body barycentre","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":{"notes":"Lists may be given as comma-separated values (e.g. masses=1,2,3&x=0,1,2) or as JSON arrays in a POST body. Units are consistent and unit-agnostic.","service":"centerofmass-api","endpoints":{"GET /v1/meta":"This document.","GET /v1/two-body":"Barycentre distances of two masses separated by a distance.","GET /v1/point-masses":"Centre of mass from lists of masses and x (and optional y, z) coordinates."},"description":"Centre of mass of a point-mass system (1D/2D/3D) and the barycentre of a two-body system."},"meta":{"timestamp":"2026-06-05T19:50:23.141Z","request_id":"dc2d1f9b-24bf-470e-bdc7-ca09b99c735b"},"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":5100,"rps_limit":2,"hard_limit":true},{"slug":"starter","name":"Starter","price_cents_month":440,"monthly_call_quota":51000,"rps_limit":6,"hard_limit":true},{"slug":"pro","name":"Pro","price_cents_month":1200,"monthly_call_quota":230000,"rps_limit":15,"hard_limit":true},{"slug":"mega","name":"Mega","price_cents_month":3800,"monthly_call_quota":1340000,"rps_limit":40,"hard_limit":true}],"x-oanor-marketplace-url":"https://www.oanor.com/api/centerofmass-api"}