{"openapi":"3.1.0","info":{"title":"Battery Calculator API","version":"1.0.0","description":"Battery and accumulator maths as an API, computed locally and deterministically from basic electrical relationships. The runtime endpoint estimates how long a battery will last under a given load — from the capacity (in mAh, Ah or Wh) and the load (in watts, or amps at a voltage), with adjustable depth-of-discharge and conversion efficiency — and reports the usable energy and the runtime in hours and minutes. The capacity endpoint converts a battery capacity between milliamp-hours, amp-hours, watt-hours, kilowatt-hours and joules at a given voltage. The pack endpoint builds a series/parallel cell pack (for example 3S2P): it returns the pack voltage, capacity and energy and the total cell count — series adds voltage, parallel adds capacity. The charge endpoint estimates the charge time from the capacity and the charge current (or a C-rate), with a charge efficiency and an optional from/to state-of-charge window. Everything is computed locally and deterministically, so it is instant and private. Real-world figures depend on temperature, age, C-rate and the discharge curve, so treat the results as estimates. Ideal for consumer-electronics and IoT tools, solar and off-grid sizing, drone and RC planning, UPS and backup-power sizing, and EV and battery-pack design. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 4 endpoints. This is battery maths; for Ohm's-law voltage/current/resistance use an electronics API.","contact":{"name":"PremiumApi","url":"https://www.oanor.com/by/premiumapi"}},"servers":[{"url":"https://api.oanor.com/battery-api","description":"oanor gateway"}],"tags":[{"name":"Battery"},{"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/capacity":{"get":{"operationId":"get_v1_capacity","tags":["Battery"],"summary":"Convert mAh / Ah / Wh / kWh / J","description":"","parameters":[{"name":"voltage","in":"query","required":true,"description":"Volts","schema":{"type":"string"},"example":"3.7"},{"name":"mah","in":"query","required":false,"description":"mAh","schema":{"type":"string"},"example":"3000"},{"name":"ah","in":"query","required":false,"description":"Or Ah","schema":{"type":"string"}},{"name":"wh","in":"query","required":false,"description":"Or Wh","schema":{"type":"string"}}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"ah":3,"wh":11.1,"kwh":0.0111,"mah":3000,"note":"Wh = (mAh ÷ 1000) × V. Energy in joules = Wh × 3600.","input":{"voltage":3.7},"joules":39960},"meta":{"timestamp":"2026-06-03T17:41:58.752Z","request_id":"31a9d479-5fa0-4275-9854-99ed54c378b9"},"status":"ok","message":"Capacity conversion","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/charge":{"get":{"operationId":"get_v1_charge","tags":["Battery"],"summary":"Charge time","description":"","parameters":[{"name":"mah","in":"query","required":false,"description":"Capacity mAh (or ah)","schema":{"type":"string"},"example":"3000"},{"name":"charge_ma","in":"query","required":false,"description":"Charge current mA","schema":{"type":"string"},"example":"1500"},{"name":"charge_a","in":"query","required":false,"description":"Or charge amps","schema":{"type":"string"}},{"name":"c_rate","in":"query","required":false,"description":"Or C-rate","schema":{"type":"string"}},{"name":"efficiency","in":"query","required":false,"description":"0-1 (default 0.9)","schema":{"type":"string"}},{"name":"from_percent","in":"query","required":false,"description":"Start SOC %","schema":{"type":"string"},"example":"0"},{"name":"to_percent","in":"query","required":false,"description":"Target SOC %","schema":{"type":"string"},"example":"100"}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"note":"Approx CC charge time = charge mAh ÷ charge current ÷ efficiency. Real Li-ion charging slows in the CV phase near full.","input":{"mah":3000,"charge_ma":1500,"efficiency":0.9,"to_percent":100,"from_percent":0},"c_rate":0.5,"charge_mah":3000,"charge_time":"2h 13m","charge_hours":2.222,"charge_minutes":133.3},"meta":{"timestamp":"2026-06-03T17:41:58.862Z","request_id":"7312a652-5cab-4cc5-9d93-87e7c2d20c6e"},"status":"ok","message":"Charge time","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/pack":{"get":{"operationId":"get_v1_pack","tags":["Battery"],"summary":"Series/parallel pack","description":"","parameters":[{"name":"series","in":"query","required":true,"description":"Cells in series (S)","schema":{"type":"string"},"example":"3"},{"name":"parallel","in":"query","required":true,"description":"Strings in parallel (P)","schema":{"type":"string"},"example":"2"},{"name":"cell_voltage","in":"query","required":true,"description":"Cell voltage","schema":{"type":"string"},"example":"3.7"},{"name":"cell_mah","in":"query","required":true,"description":"Cell capacity mAh","schema":{"type":"string"},"example":"2500"}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"note":"Series adds voltage; parallel adds capacity. Pack Wh = pack V × pack Ah.","input":{"series":3,"cell_mah":2500,"parallel":2,"cell_voltage":3.7},"pack_ah":5,"pack_wh":55.5,"pack_mah":5000,"cells_total":6,"pack_voltage":11.1,"configuration":"3S2P"},"meta":{"timestamp":"2026-06-03T17:41:58.943Z","request_id":"54db31de-59ae-4fc7-91d7-9620062e3440"},"status":"ok","message":"Series/parallel pack","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/runtime":{"get":{"operationId":"get_v1_runtime","tags":["Battery"],"summary":"Battery runtime under load","description":"","parameters":[{"name":"wh","in":"query","required":false,"description":"Capacity Wh (or mah/ah+voltage)","schema":{"type":"string"}},{"name":"mah","in":"query","required":false,"description":"Capacity mAh","schema":{"type":"string"}},{"name":"ah","in":"query","required":false,"description":"Capacity Ah","schema":{"type":"string"},"example":"100"},{"name":"voltage","in":"query","required":false,"description":"Volts (for mah/ah or amps)","schema":{"type":"string"},"example":"12"},{"name":"watts","in":"query","required":false,"description":"Load in watts","schema":{"type":"string"},"example":"100"},{"name":"amps","in":"query","required":false,"description":"Or load in amps","schema":{"type":"string"}},{"name":"depth_of_discharge","in":"query","required":false,"description":"0-1 (default 1)","schema":{"type":"string"}},{"name":"efficiency","in":"query","required":false,"description":"0-1 (default 1)","schema":{"type":"string"}}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"note":"Runtime = usable energy ÷ load. Usable energy = capacity × depth-of-discharge × efficiency. Real runtime drops under high C-rate, cold and age.","input":{"load_w":100,"stored_wh":1200,"efficiency":1,"depth_of_discharge":1},"runtime":"12h","usable_wh":1200,"runtime_hours":12,"runtime_minutes":720},"meta":{"timestamp":"2026-06-03T17:41:59.045Z","request_id":"a78bbd94-ea92-4dc4-8970-eedd534bd6ef"},"status":"ok","message":"Battery runtime","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":"Estimates only — real figures vary with temperature, age, C-rate and discharge curve.","service":"battery","endpoints":{"/v1/pack":"Build a series/parallel pack: voltage, capacity, energy and cell count.","/v1/charge":"Estimate charge time from capacity and charge current (or C-rate).","/v1/runtime":"Estimate runtime from capacity and load, with depth-of-discharge and efficiency.","/v1/capacity":"Convert capacity between mAh, Ah, Wh, kWh and joules (with voltage)."},"description":"Battery maths: runtime, mAh/Wh capacity conversion, series/parallel pack building and charge time."},"meta":{"timestamp":"2026-06-03T17:41:59.147Z","request_id":"ae0a4ee7-0da0-42cd-80e2-2c0d7ad1f65d"},"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":9535,"rps_limit":2,"hard_limit":true},{"slug":"starter","name":"Starter","price_cents_month":1105,"monthly_call_quota":19150,"rps_limit":8,"hard_limit":true},{"slug":"pro","name":"Pro","price_cents_month":3095,"monthly_call_quota":241500,"rps_limit":20,"hard_limit":true},{"slug":"mega","name":"Mega","price_cents_month":6895,"monthly_call_quota":1250000,"rps_limit":50,"hard_limit":true}],"x-oanor-marketplace-url":"https://www.oanor.com/api/battery-api"}