{"openapi":"3.1.0","info":{"title":"Magnetic Field & Force API","version":"1.0.0","description":"Magnetic fields and forces as an API, computed locally and deterministically. The wire endpoint computes the magnetic field around a long straight current-carrying wire, B = μ0·I/(2π·r) — the field at a distance r from a wire carrying a current I — and solves for whichever of the current, the distance or the field you leave out, reporting the field in tesla, millitesla, microtesla and gauss. The solenoid endpoint gives the uniform field inside a long solenoid, B = μ0·n·I (n turns per metre, given directly or as a total number of turns over a length), or the field at the centre of a circular loop, B = μ0·N·I/(2R). The force endpoint computes the magnetic force on a moving charge, F = q·v·B·sin(θ) (the Lorentz force), or on a current-carrying wire in a field, F = B·I·L·sin(θ), with the force per metre. The vacuum permeability μ0 = 4π×10⁻⁷ is built in, with an optional relative permeability for a magnetic core. Everything is computed locally and deterministically, so it is instant and private. Ideal for electromagnetism-education tools, electromagnet, motor and inductor design, magnetic-sensor and physics-simulation apps. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is magnetostatics; for Coulomb electrostatics use a Coulomb API and for Ohm's-law circuits use an Ohm's-law API.","contact":{"name":"PremiumApi","url":"https://www.oanor.com/by/premiumapi"}},"servers":[{"url":"https://api.oanor.com/magnetic-api","description":"oanor gateway"}],"tags":[{"name":"Magnetic"},{"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/force":{"get":{"operationId":"get_v1_force","tags":["Magnetic"],"summary":"Magnetic force","description":"","parameters":[{"name":"magnetic_field","in":"query","required":true,"description":"Field B (T)","schema":{"type":"string"},"example":"0.5"},{"name":"charge","in":"query","required":false,"description":"Charge q (C) for a moving charge","schema":{"type":"string"}},{"name":"velocity","in":"query","required":false,"description":"Velocity v (m/s)","schema":{"type":"string"}},{"name":"current","in":"query","required":false,"description":"Or current I (A) for a wire","schema":{"type":"string"},"example":"10"},{"name":"length","in":"query","required":false,"description":"And wire length L (m)","schema":{"type":"string"},"example":"0.2"},{"name":"angle","in":"query","required":false,"description":"Angle θ to the field (deg, default 90)","schema":{"type":"string"},"example":"90"}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"mode":"current_wire","force_n":1,"formula":"F = B·I·L·sin(θ).","length_m":0.2,"angle_deg":90,"current_a":10,"force_per_metre_n":5,"magnetic_field_tesla":0.5},"meta":{"timestamp":"2026-06-04T10:18:44.463Z","request_id":"4bbb84c1-85fa-46b4-9958-899512983c41"},"status":"ok","message":"Magnetic force","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/solenoid":{"get":{"operationId":"get_v1_solenoid","tags":["Magnetic"],"summary":"Solenoid / loop field","description":"","parameters":[{"name":"current","in":"query","required":true,"description":"Current I (A)","schema":{"type":"string"},"example":"2"},{"name":"turns_per_metre","in":"query","required":false,"description":"Turns per metre n (solenoid)","schema":{"type":"string"},"example":"1000"},{"name":"turns","in":"query","required":false,"description":"Or total turns N","schema":{"type":"string"}},{"name":"length","in":"query","required":false,"description":"And length (m)","schema":{"type":"string"}},{"name":"type","in":"query","required":false,"description":"solenoid | loop","schema":{"type":"string"},"example":"solenoid"},{"name":"radius","in":"query","required":false,"description":"Radius for a loop (m)","schema":{"type":"string"}}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"formula":"B = μ0·n·I (n = turns per metre) inside a long solenoid.","current_a":2,"configuration":"solenoid","turns_per_metre":1000,"magnetic_field_mt":2.5132741242,"magnetic_field_ut":2513.27412424,"magnetic_field_gauss":25.13274124,"magnetic_field_tesla":0.00251327412424},"meta":{"timestamp":"2026-06-04T10:18:44.561Z","request_id":"e69a4485-593c-4640-a185-b9a88ab65f18"},"status":"ok","message":"Solenoid / loop field","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/wire":{"get":{"operationId":"get_v1_wire","tags":["Magnetic"],"summary":"Field around a straight wire","description":"","parameters":[{"name":"current","in":"query","required":false,"description":"Current I (A)","schema":{"type":"string"},"example":"10"},{"name":"distance","in":"query","required":false,"description":"Distance r from the wire (m)","schema":{"type":"string"},"example":"0.05"},{"name":"magnetic_field","in":"query","required":false,"description":"Or field B (T) to solve another","schema":{"type":"string"}},{"name":"relative_permeability","in":"query","required":false,"description":"Relative permeability (default 1)","schema":{"type":"string"}}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"formula":"B = μ0·I/(2π·r).","current_a":10,"distance_m":0.05,"magnetic_field_mt":0.04,"magnetic_field_ut":40.00000002,"magnetic_field_gauss":0.4,"magnetic_field_tesla":4.000000002e-5},"meta":{"timestamp":"2026-06-04T10:18:44.667Z","request_id":"c44dd53a-8a40-4958-89d1-b24aa73a1a2f"},"status":"ok","message":"Field around a straight wire","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":{"api":"magnetic","note":"Magnetic fields & forces — computed locally and deterministically, no key, no third-party service.","constants":{"vacuum_permeability":1.25663706212e-6},"endpoints":["/v1/wire","/v1/solenoid","/v1/force","/v1/meta"]},"meta":{"timestamp":"2026-06-04T10:18:44.774Z","request_id":"b3a911c3-20da-4384-9c9b-59e42e9ba5a3"},"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":2000,"rps_limit":2,"hard_limit":true},{"slug":"starter","name":"Starter","price_cents_month":900,"monthly_call_quota":40000,"rps_limit":5,"hard_limit":true},{"slug":"pro","name":"Pro","price_cents_month":2400,"monthly_call_quota":250000,"rps_limit":15,"hard_limit":true},{"slug":"mega","name":"Mega","price_cents_month":7500,"monthly_call_quota":1509000,"rps_limit":40,"hard_limit":true}],"x-oanor-marketplace-url":"https://www.oanor.com/api/magnetic-api"}