{"openapi":"3.1.0","info":{"title":"Beräkningssnurran calculation API","version":"2026-legacy-692da46","description":"AI assistants: read /api and /openapi.json. Ask for missing inputs. Prefer POST /api/v1/calculate with a JSON body. If your tools only read URLs, open /result/RULES_VERSION/MONTHLY_SALARY/STUDY_PERCENT/COLLECTIVE/LOAN/PERIOD. Use whole study percentages (100, 75, 60, 50, 40, 20), yes/no for both options, and week/4weeks/month. using the user's actual choices; this GET page calls the same API and returns readable calculated HTML. If you can only open linked URLs, open /result/RULES_VERSION and follow its links. Only report amounts from a successful API response or result page. If neither works, link to /calculator without estimating replacement amounts. See /llms.txt. Results are preliminary; eligibility is not determined. Request bodies are limited to 4096 bytes."},"servers":[{"url":"https://berakningssnurran.se","description":"Same origin as this specification"}],"externalDocs":{"url":"https://berakningssnurran.se/api","description":"API documentation and AI-tool instructions"},"paths":{"/result/{rulesVersion}/{salary}/{percent}/{collective}/{loan}/{period}":{"get":{"operationId":"readCalculatedResultPath","summary":"Retrieve an API-calculated HTML table using a simple GET path","description":"Preferred GET format for web readers. Whole study percentages and yes/no options differ from the POST/query values. Rule version pins the year. Return amounts unchanged; never substitute example inputs for the user's choices. No calculation query parameters are accepted.","parameters":[{"name":"rulesVersion","schema":{"type":"string","enum":["2026-legacy-692da46"]},"in":"path","required":true},{"name":"salary","schema":{"type":"integer","minimum":1,"maximum":173215370283480},"in":"path","required":true},{"name":"percent","schema":{"type":"integer","enum":[100,75,60,50,40,20]},"in":"path","required":true},{"name":"collective","schema":{"type":"string","enum":["yes","no"]},"in":"path","required":true},{"name":"loan","schema":{"type":"string","enum":["yes","no"]},"in":"path","required":true},{"name":"period","schema":{"type":"string","enum":["week","4weeks","month"]},"in":"path","required":true}],"responses":{"200":{"description":"API-calculated HTML table, inputs, year, version and limitations","content":{"text/html":{"schema":{"type":"string"}}}},"400":{"description":"Disallowed URL query parameter"},"422":{"description":"Invalid input or unsupported rules; no result table"},"503":{"description":"Calculation service unavailable; no substitute estimate"}}}},"/result":{"get":{"operationId":"readCalculatedResult","summary":"Retrieve an actual API calculation as readable HTML using GET","description":"For web-reading tools without POST. Uses the same calculation API; report table values unchanged. Ask for missing inputs. Errors contain no calculation. URL inputs are supported on this route only.","parameters":[{"name":"salary","in":"query","required":true,"schema":{"type":"integer","minimum":1,"maximum":173215370283480}},{"name":"percent","in":"query","required":true,"schema":{"type":"number","enum":[1,0.75,0.6,0.5,0.4,0.2]}},{"name":"collective","in":"query","required":true,"schema":{"type":"boolean"}},{"name":"loan","in":"query","required":true,"schema":{"type":"boolean"}},{"name":"period","in":"query","required":true,"schema":{"type":"string","enum":["week","4weeks","month"]}},{"name":"calculationYear","in":"query","schema":{"type":"integer","enum":[2026]}},{"name":"rulesVersion","in":"query","schema":{"type":"string","enum":["2026-legacy-692da46"]}}],"responses":{"200":{"description":"Readable HTML calculation with inputs, exact amounts, year, rule version and limitations. With no query, returns instructions only, not a calculation.","content":{"text/html":{"schema":{"type":"string"}}}},"400":{"description":"Unknown URL parameter"},"422":{"description":"Missing, invalid or duplicate inputs, or unsupported rules"},"503":{"description":"Calculation service unavailable; no estimated replacement amounts"}}}},"/api/v1/calculate":{"post":{"operationId":"calculateSupport","summary":"Calculate preliminary support using a JSON POST body","description":"AI assistants: read /api and /openapi.json. Ask for missing inputs. Prefer POST /api/v1/calculate with a JSON body. If your tools only read URLs, open /result/RULES_VERSION/MONTHLY_SALARY/STUDY_PERCENT/COLLECTIVE/LOAN/PERIOD. Use whole study percentages (100, 75, 60, 50, 40, 20), yes/no for both options, and week/4weeks/month. using the user's actual choices; this GET page calls the same API and returns readable calculated HTML. If you can only open linked URLs, open /result/RULES_VERSION and follow its links. Only report amounts from a successful API response or result page. If neither works, link to /calculator without estimating replacement amounts. See /llms.txt.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["salary","percent","collective","loan","period"],"properties":{"salary":{"type":"integer","minimum":1,"maximum":173215370283480,"description":"Monthly gross salary in whole SEK. Send in the body for this POST endpoint."},"percent":{"type":"number","enum":[1,0.75,0.6,0.5,0.4,0.2]},"collective":{"type":"boolean","description":"Include assumed collective-agreement supplement."},"loan":{"type":"boolean","description":"Include CSN loan."},"period":{"type":"string","enum":["week","4weeks","month"]},"calculationYear":{"type":"integer","enum":[2026],"description":"Optional for compatibility; supply with rulesVersion for reproducibility."},"rulesVersion":{"type":"string","enum":["2026-legacy-692da46"],"description":"Optional for compatibility; pin the published version."}}}}}},"responses":{"200":{"description":"API-calculated amounts in SEK. Preserve separately rounded totals. display applies to the requested period; weekly is the weekly basis.","content":{"application/json":{"schema":{"type":"object","required":["weekly","display","shares","calculationYear","rulesVersion","currency","period"],"properties":{"weekly":{"type":"object","required":["income","grant","supplement","loan","total","shortfall"],"properties":{"income":{"type":"integer"},"grant":{"type":"integer"},"supplement":{"type":"integer"},"loan":{"type":"integer"},"total":{"type":"integer"},"shortfall":{"type":"integer"}}},"display":{"type":"object","required":["income","grant","supplement","loan","total","shortfall"],"properties":{"income":{"type":"integer"},"grant":{"type":"integer"},"supplement":{"type":"integer"},"loan":{"type":"integer"},"total":{"type":"integer"},"shortfall":{"type":"integer"}}},"shares":{"type":"object","description":"Rounded percentages of weekly income, not monetary amounts.","required":["grant","supplement","loan","total","shortfall"],"properties":{"grant":{"type":"integer"},"supplement":{"type":"integer"},"loan":{"type":"integer"},"total":{"type":"integer"},"shortfall":{"type":"integer"}}},"calculationYear":{"type":"integer"},"rulesVersion":{"type":"string"},"currency":{"type":"string","const":"SEK"},"period":{"type":"string","enum":["week","4weeks","month"]}}}}}},"400":{"description":"Invalid JSON or disallowed URL parameters"},"405":{"description":"Method not allowed; use POST"},"413":{"description":"Request body exceeds 4096 bytes"},"415":{"description":"Content-Type must be application/json"},"422":{"description":"Invalid input or unsupported_rules"},"503":{"description":"Calculation service unavailable; do not substitute independent estimates"}}}},"/api/v1/rules/{year}":{"get":{"operationId":"readCalculationRules","summary":"Read supported rules and provenance; this does not perform a calculation","parameters":[{"name":"year","in":"path","required":true,"schema":{"type":"integer","enum":[2026]}}],"responses":{"200":{"description":"Rule parameters, calculationYear, rulesVersion and provenance","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"URL parameters are not allowed"},"404":{"description":"Rules not found"},"503":{"description":"Calculation service unavailable"}}}}}}