{"openapi":"3.1.1","info":{"title":"Elredo API","version":"1.0.0","description":"Fri grundanvändning utan API-nyckel. Beräkningsmodeller och källor finns på metodsidan."},"servers":[{"url":"https://elredo.se"}],"externalDocs":{"url":"https://elredo.se/metod/"},"paths":{"/api/v1/calculate":{"post":{"operationId":"calculate","summary":"Beräkna reservkraft eller batteridrifttid","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"loads"},"loads":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"watts":{"type":"number","minimum":0,"maximum":1000000,"description":"Aktiv drifteffekt, W"},"hours":{"type":"number","minimum":0,"maximum":24,"description":"Drifttimmar per dygn"},"pf":{"type":"number","minimum":0.01,"maximum":1,"description":"Effektfaktor"},"startAmps":{"type":"number","minimum":0,"maximum":10000,"description":"Effektiv startström i A vid 230 V enfas. Noll ger inget extra startpåslag."}},"required":["watts","hours","pf","startAmps"],"additionalProperties":false}},"simultaneous":{"type":"boolean"}},"required":["kind","loads","simultaneous"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"battery"},"wh":{"type":"number","minimum":0,"maximum":10000000,"description":"Nominell energi i Wh"},"watts":{"type":"number","minimum":0.01,"maximum":1000000},"hours":{"type":"number","minimum":0,"maximum":8760},"usable":{"type":"number","minimum":1,"maximum":100,"description":"Användbar andel i procent"},"efficiency":{"type":"number","minimum":1,"maximum":100,"description":"Verkningsgrad i procent"}},"required":["kind","wh","watts","hours","usable","efficiency"],"additionalProperties":false}]},"example":{"kind":"battery","wh":1000,"watts":90,"hours":8,"usable":80,"efficiency":90}}}},"responses":{"200":{"description":"Resultat med modellversion och metodreferens","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","anyOf":[{"type":"object","properties":{"modelVersion":{"type":"string","const":"1.0"},"method":{"type":"string","format":"uri"},"kind":{"type":"string","const":"loads"},"result":{"type":"object","properties":{"watts":{"type":"number"},"va":{"type":"number"},"peak":{"type":"number","description":"Startbehov i VA"},"wh":{"type":"number","description":"Wh per dygn"}},"required":["watts","va","peak","wh"],"additionalProperties":false}},"required":["modelVersion","method","kind","result"],"additionalProperties":false},{"type":"object","properties":{"modelVersion":{"type":"string","const":"1.0"},"method":{"type":"string","format":"uri"},"kind":{"type":"string","const":"battery"},"result":{"type":"object","properties":{"delivered":{"type":"number","description":"Wh till lasten"},"runtime":{"type":"number","description":"Timmar"},"required":{"type":"number","description":"Nominell kapacitet i Wh"}},"required":["delivered","runtime","required"],"additionalProperties":false}},"required":["modelVersion","method","kind","result"],"additionalProperties":false}]}}}},"400":{"description":"Ogiltig JSON eller ogiltiga indata"},"413":{"description":"Över 32 KiB"},"415":{"description":"Kräver application/json"}}}},"/api/v1/match":{"post":{"operationId":"matchProducts","summary":"Pröva lastprofil mot granskade produktuppgifter","description":"runningW måste vara minst averageW. Budget anges i SEK, fuelPrice i SEK/liter.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"averageW":{"type":"number","minimum":0.01,"maximum":1000000},"runningW":{"type":"number","minimum":0.01,"maximum":1000000},"hours":{"type":"number","minimum":0.01,"maximum":8760},"startVA":{"type":"number","minimum":0.01,"maximum":10000000},"budget":{"type":"number","minimum":0,"maximum":100000000},"fuelPrice":{"type":"number","minimum":0,"maximum":1000},"batteryOnly":{"type":"boolean"},"resistive":{"description":"Konstant rent resistiv last utan extra startbehov. För elverk förutsätts full tank.","type":"boolean"}},"required":["averageW","runningW","hours"],"additionalProperties":false}}}},"responses":{"200":{"description":"Modellvisa bedömningar","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"matches":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string"},"reasons":{"type":"array","items":{"type":"string"}}},"required":["id","status","reasons"],"additionalProperties":false}}},"required":["matches"],"additionalProperties":false}}}},"400":{"description":"Ogiltig lastprofil"}}}},"/api/v1/products":{"get":{"operationId":"listProducts","summary":"Verifierade produkter och källor","responses":{"200":{"description":"En tom lista betyder att inga produkter har verifierats","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"products":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-z0-9-]+$"},"name":{"type":"string","minLength":1},"manufacturer":{"type":"string","minLength":1},"source":{"type":"object","properties":{"url":{"type":"string","pattern":"^https:\\/\\/"},"title":{"type":"string","minLength":1},"checkedOn":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["url","title","checkedOn"],"additionalProperties":false},"category":{"type":"string","enum":["generator","station","system"]},"specifications":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"key":{"type":"string","enum":["continuousW","continuousVA","maxVA","surgeW","capacityWh","tankL","fuelQuarter","runtimeQuarter","idleW"]},"conditions":{"type":"string","minLength":1},"value":{"type":"number","minimum":0},"unit":{"type":"string","enum":["W","VA","Wh","kg","V","A","l","l/h","h"]},"source":{"type":"object","properties":{"url":{"type":"string","pattern":"^https:\\/\\/"},"title":{"type":"string","minLength":1},"checkedOn":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["url","title","checkedOn"],"additionalProperties":false}},"required":["name","key","conditions","value","unit","source"],"additionalProperties":false}}},"required":["id","name","manufacturer","source","category","specifications"],"additionalProperties":false}}},"required":["products"],"additionalProperties":false}}}}}}}}}