{"source":"statsregnskapet","operation":"get_accounts","description":"Get what the state actually spent and collected in a year, from the\nmonthly accounts, grouped the way you ask. Signature: get_accounts(year: integer, calendar year, required; department: string, optional, default None; chapter: string, optional, default None; agency_org_nr: string, optional, default None; group_by: string, optional, default 'chapter'; limit: integer, items, optional, default 100; offset: integer, items, optional, default 0).","signature":"get_accounts(year: integer, calendar year, required; department: string, optional, default None; chapter: string, optional, default None; agency_org_nr: string, optional, default None; group_by: string, optional, default 'chapter'; limit: integer, items, optional, default 100; offset: integer, items, optional, default 0)","parameters":[{"name":"year","type":"integer","schema":{"type":"integer"},"required":true,"default":null,"description":"Accounting year, 2014 to the current year (the current year is year-to-date; see `periods_covered`). Unit: calendar year.","unit":"calendar year"},{"name":"department","type":"string","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false,"default":null,"description":"Optional 2-digit department code (\"13\") or part of the department name (\"Samferdsel\").","unit":null},{"name":"chapter","type":"string","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false,"default":null,"description":"Optional chapter number (kapittel), e.g. \"1320\". Chapters 0001-2999 are expenses, 3000-5999 income.","unit":null},{"name":"agency_org_nr","type":"string","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false,"default":null,"description":"Optional organisasjonsnummer of the agency (virksomhet) that booked the entries, e.g. \"971032081\".","unit":null},{"name":"group_by","type":"string","schema":{"type":"string"},"required":false,"default":"chapter","description":"\"chapter\" (default), \"post\", \"agency\", \"department\" or \"month\".","unit":null},{"name":"limit","type":"integer","schema":{"type":"integer"},"required":false,"default":100,"description":"Max rows, 1-500 (default 100), largest expenses first. Unit: items.","unit":"items"},{"name":"offset","type":"integer","schema":{"type":"integer","minimum":0,"default":0},"display_type":"integer","required":false,"default":0,"description":"Number of list items to skip before returning the page.","unit":"items"}],"json_get_url_template":"https://allemannsdata.com/wiki/api/v1/kilder/statsregnskapet/get_accounts?year={year}&department={department}&chapter={chapter}&agency_org_nr={agency_org_nr}&group_by=chapter&limit=100&offset=0","schema_scope":"#/data in the successful operation envelope","response_schema":{"type":"object","properties":{"year":{"type":"integer"},"periods_covered":{"type":"array","items":{"type":"string"}},"filters":{"type":"object","properties":{"department":{"type":["string","null"]},"chapter":{"type":["string","null"]},"agency_org_nr":{"type":["string","null"]}},"additionalProperties":false},"group_by":{"type":"string","enum":["chapter","post","agency","department","month"]},"total_expenses_nok":{"type":"integer"},"total_income_nok":{"type":"integer"},"total_rows":{"type":"integer"},"returned":{"type":"integer"},"rows":{"type":"array","items":{"type":"object","properties":{"period":{"type":["string","null"]},"department_id":{"type":["string","null"]},"department":{"type":["string","null"]},"chapter_id":{"type":["string","null"]},"chapter":{"type":["string","null"]},"post_id":{"type":["string","null"]},"post":{"type":["string","null"]},"post_type":{"type":["string","null"]},"agency_org_nr":{"type":["string","null"]},"agency":{"type":["string","null"]},"expenses_nok":{"type":"integer"},"income_nok":{"type":"integer"}},"additionalProperties":false,"required":["expenses_nok","income_nok"]}}},"additionalProperties":false,"required":["year","periods_covered","filters","group_by","total_expenses_nok","total_income_nok","total_rows","returned","rows"]},"response_schema_status":{"status":"declared","codegen_safe":true,"description":"Maintained response contract."},"entity_projection":{"status":"intentionally_none","entity_types":[],"description":"No stable cross-source entity projection is defined for this operation; entities is intentionally empty."},"error_contract":{"scope":"top-level HTTP error response; never part of a success payload","schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"retryable":{"type":"boolean"},"details":{"type":"object"}},"additionalProperties":false,"required":["code","message","retryable"]},"suggestion":{"type":"string"},"_meta":{"type":"object","properties":{"retrieved_at":{"type":"string","format":"date-time"},"language":{"type":"string","const":"en"},"content_languages":{"type":"array","items":{"type":"string"}},"sources":{"type":"array","items":{"type":"object"}}},"required":["retrieved_at","language","content_languages","sources"]},"_links":{"type":"object","properties":{"self":{"type":"string","format":"uri"},"api_index":{"type":"string","format":"uri"},"feedback":{"type":"string","format":"uri"}},"required":["self","api_index","feedback"],"additionalProperties":false}},"additionalProperties":false,"required":["error","suggestion","_meta","_links"]},"statuses":{"400":{"codes":["MISSING_PARAMETER","INVALID_PARAMETER","INVALID_REQUEST"],"retryable":false},"404":{"codes":["SOURCE_NOT_FOUND","OPERATION_NOT_FOUND","ENTITY_NOT_FOUND"],"retryable":false},"429":{"codes":["RATE_LIMITED","GATEWAY_RATE_LIMITED"],"retryable":true},"502":{"codes":["SOURCE_UNAVAILABLE"],"retryable":true},"500":{"codes":["INTERNAL_ERROR"],"retryable":true}}},"_links":{"self":"https://allemannsdata.com/wiki/api/v1/kilder/statsregnskapet/get_accounts/schema","operation":"https://allemannsdata.com/wiki/api/v1/kilder/statsregnskapet/get_accounts","source":"https://allemannsdata.com/wiki/api/v1/kilder/statsregnskapet","feedback":"https://allemannsdata.com/wiki/api/v1/feedback"},"output_fields":["year","periods_covered","filters","filters.department","filters.chapter","filters.agency_org_nr","group_by","total_expenses_nok","total_income_nok","total_rows","returned","rows","rows[].period","rows[].department_id","rows[].department","rows[].chapter_id","rows[].chapter","rows[].post_id","rows[].post","rows[].post_type","rows[].agency_org_nr","rows[].agency","rows[].expenses_nok","rows[].income_nok"],"output_fields_truncated":false,"canonical_field_aliases":{},"response_example":{"source":"statsregnskapet","operation":"get_accounts","parameters":{"year":1,"department":"example value","chapter":"example value","agency_org_nr":"example value","group_by":"chapter","limit":100},"data":{"year":1,"periods_covered":["example value"],"filters":{"department":"example value","chapter":"example value","agency_org_nr":"example value"},"group_by":"chapter","total_expenses_nok":1,"total_income_nok":1,"total_rows":1,"returned":1,"rows":[{"period":"example value","department_id":"example-id","department":"example value","chapter_id":"example-id","chapter":"example value","post_id":"example-id","post":"example value","post_type":"example value","agency_org_nr":"example value","agency":"example value","expenses_nok":1,"income_nok":1}]},"entities":[],"_meta":{"retrieved_at":"2026-01-15T12:00:00Z","language":"en","content_languages":["en"],"sources":[{"id":"statsregnskapet","name":"Statsregnskapet (state accounts)","description":"Central-government accounts from DF\u00d8: entity search, actual spending and income per chapter, post, agency, department or month since 2014, and the appropriations Stortinget granted.","cache_ttl_seconds":3600,"documentation":"https://statsregnskapet.dfo.no/om-statsregnskapet"}]},"_provenance":{"data":{"source":"statsregnskapet","source_api":"https://allemannsdata.com/wiki/api/v1/kilder/statsregnskapet"},"entities":{"source":"statsregnskapet","source_api":"https://allemannsdata.com/wiki/api/v1/kilder/statsregnskapet","derived_from":"#/data","description":"Normalized projection of data."}},"_links":{"self":"https://allemannsdata.com/wiki/api/v1/kilder/statsregnskapet/get_accounts","source":"https://allemannsdata.com/wiki/api/v1/kilder/statsregnskapet","wiki":"https://allemannsdata.com/wiki/kilder/statsregnskapet/get_accounts/","feedback":"https://allemannsdata.com/wiki/api/v1/feedback"}}}
