{"openapi":"3.1.0","info":{"title":"Molar Mass API","version":"1.0.0","description":"Molar-mass and stoichiometry maths as an API, computed locally and deterministically. The molarmass endpoint parses any chemical formula — with parentheses, square brackets and hydrate dots, such as Ca(OH)2, [Fe(CN)6]3 or CuSO4·5H2O — against the IUPAC conventional atomic weights and returns the molar mass in grams per mole, the total atom count and the per-element breakdown with each element's mass contribution and mass percent. The convert endpoint moves between moles, mass in grams and number of molecules for a formula, using n = mass ÷ M = molecules ÷ Nₐ with Avogadro's number. The percent endpoint gives the percent composition by mass and, for a given sample mass, the mass of each element it contains. The formula is parsed locally, so it works for any valid formula, not just compounds in a database, and is instant and private. Ideal for chemistry-education, laboratory, pharmaceutical and science app developers, stoichiometry and lab-prep tools, and STEM teaching. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This computes molar mass from a formula; for compound database lookup use a chemistry API and for element properties an elements API.","contact":{"name":"PremiumApi","url":"https://www.oanor.com/by/premiumapi"}},"servers":[{"url":"https://api.oanor.com/molarmass-api","description":"oanor gateway"}],"tags":[{"name":"Molar Mass"},{"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/convert":{"get":{"operationId":"get_v1_convert","tags":["Molar Mass"],"summary":"Mole / mass / molecules","description":"","parameters":[{"name":"formula","in":"query","required":true,"description":"Chemical formula","schema":{"type":"string"},"example":"H2O"},{"name":"moles","in":"query","required":false,"description":"Amount (mol)","schema":{"type":"string"},"example":"2"},{"name":"mass","in":"query","required":false,"description":"Or mass (g)","schema":{"type":"string"}},{"name":"molecules","in":"query","required":false,"description":"Or number of molecules","schema":{"type":"string"}}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"note":"n = mass/M = molecules/Nₐ. Nₐ = 6.02214076×10²³ mol⁻¹.","moles":2,"inputs":{"formula":"H2O","molar_mass_g_mol":18.015},"mass_g":36.03,"molecules":1.204428152e+24},"meta":{"timestamp":"2026-06-04T18:38:04.792Z","request_id":"72625459-77e7-4358-9adc-3fa26c0557ac"},"status":"ok","message":"Mole convert","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/molarmass":{"get":{"operationId":"get_v1_molarmass","tags":["Molar Mass"],"summary":"Molar mass of a formula","description":"","parameters":[{"name":"formula","in":"query","required":true,"description":"Chemical formula","schema":{"type":"string"},"example":"CuSO4.5H2O"}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"note":"Molar mass = Σ(atomic weight × count), using IUPAC conventional atomic weights. Percent is the mass fraction of each element.","inputs":{"formula":"CuSO4.5H2O"},"elements":[{"count":1,"element":"Cu","percent":25.451283,"atomic_weight":63.546,"mass_contribution":63.546},{"count":1,"element":"S","percent":12.84059,"atomic_weight":32.06,"mass_contribution":32.06},{"count":9,"element":"O","percent":57.670911,"atomic_weight":15.999,"mass_contribution":143.991},{"count":10,"element":"H","percent":4.037216,"atomic_weight":1.008,"mass_contribution":10.08}],"atom_count":21,"molar_mass_g_mol":249.677},"meta":{"timestamp":"2026-06-04T18:38:04.898Z","request_id":"19ee7c8a-4f3e-40b7-96eb-ba5776846a07"},"status":"ok","message":"Molar mass","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/percent":{"get":{"operationId":"get_v1_percent","tags":["Molar Mass"],"summary":"Percent composition","description":"","parameters":[{"name":"formula","in":"query","required":true,"description":"Chemical formula","schema":{"type":"string"},"example":"C6H12O6"},{"name":"mass","in":"query","required":false,"description":"Sample mass (g) for element masses","schema":{"type":"string"},"example":"100"}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"note":"Mass percent = (element mass in one mole / molar mass) × 100. With a sample mass, the mass of each element is given too.","inputs":{"formula":"C6H12O6","sample_mass_g":100,"molar_mass_g_mol":180.156},"composition":[{"mass_g":40.001998,"element":"C","percent":40.001998},{"mass_g":6.714181,"element":"H","percent":6.714181},{"mass_g":53.283821,"element":"O","percent":53.283821}]},"meta":{"timestamp":"2026-06-04T18:38:05.015Z","request_id":"e9bd47a0-c1af-4f3c-b8ff-e914e0374739"},"status":"ok","message":"Percent comp","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":"Formulas support parentheses, square brackets and hydrate dots (·, ., *), e.g. Ca(OH)2, [Fe(CN)6]3, CuSO4.5H2O. IUPAC conventional atomic weights; Nₐ = 6.02214076×10²³.","service":"molarmass-api","formulae":{"mole":"n = mass / M = molecules / Nₐ","percent":"element mass / molar mass × 100","molar_mass":"Σ(atomic weight × count)"},"endpoints":{"GET /v1/meta":"This document.","GET /v1/convert":"Convert between moles, mass (g) and molecules for a formula.","GET /v1/percent":"Percent composition, and the mass of each element in a given sample mass.","GET /v1/molarmass":"Molar mass, atom count and per-element percent composition of a formula."},"description":"Molar-mass and stoichiometry calculator: parse a chemical formula (parentheses, brackets, hydrates) for its molar mass and percent composition, and convert between moles, mass and molecules."},"meta":{"timestamp":"2026-06-04T18:38:05.142Z","request_id":"b94d3843-0e6b-42b6-b52a-d77030111f09"},"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":3000,"rps_limit":2,"hard_limit":true},{"slug":"starter","name":"Starter","price_cents_month":500,"monthly_call_quota":40000,"rps_limit":5,"hard_limit":true},{"slug":"pro","name":"Pro","price_cents_month":1500,"monthly_call_quota":250000,"rps_limit":15,"hard_limit":true},{"slug":"mega","name":"Mega","price_cents_month":4500,"monthly_call_quota":1500000,"rps_limit":40,"hard_limit":true}],"x-oanor-marketplace-url":"https://www.oanor.com/api/molarmass-api"}