{"source":"elhub","operation":"get_municipality_consumption","description":"Get one day of measured electricity consumption (kWh) for a municipality,\nhourly, split into private, industry and business customers. Signature: get_municipality_consumption(municipality: string, required; date: string, optional, default None; limit: integer, items, optional, default 25; offset: integer, items, optional, default 0).","signature":"get_municipality_consumption(municipality: string, required; date: string, optional, default None; limit: integer, items, optional, default 25; offset: integer, items, optional, default 0)","parameters":[{"name":"municipality","type":"string","schema":{"type":"string"},"required":true,"default":null,"description":"4-digit kommunenummer (e.g. \"0301\" for Oslo) or the current municipality name, case-insensitive. Ambiguous names (V\u00e5ler) must be given as a kommunenummer.","unit":null},{"name":"date","type":"string","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false,"default":null,"description":"Day wanted, YYYY-MM-DD (default: the day before yesterday, the newest day normally complete). Elhub allows one day per call.","unit":null},{"name":"limit","type":"integer","schema":{"type":"integer","minimum":1,"maximum":100,"default":25},"display_type":"integer","required":false,"default":25,"description":"Maximum list items returned by the gateway (default 25, maximum 100).","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/elhub/get_municipality_consumption?municipality={municipality}&date={date}&limit=25&offset=0","schema_scope":"#/data in the successful operation envelope","response_schema":{"type":"object","properties":{"municipality_code":{"type":"string"},"municipality":{"type":["string","null"]},"date":{"type":"string","format":"date"},"last_updated":{"type":["string","null"],"format":"date-time"},"totals_kwh":{"type":"object","additionalProperties":{"type":"number"}},"total_kwh":{"type":"number"},"hours":{"type":"array","items":{"type":"object","properties":{"start_time":{"type":"string","format":"date-time"},"consumption_group":{"type":["string","null"]},"quantity_kwh":{"type":["number","null"]},"metering_point_count":{"type":["integer","null"]}},"additionalProperties":false,"required":["start_time","consumption_group","quantity_kwh"]}}},"additionalProperties":false,"required":["municipality_code","date","totals_kwh","total_kwh","hours"]},"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/elhub/get_municipality_consumption/schema","operation":"https://allemannsdata.com/wiki/api/v1/kilder/elhub/get_municipality_consumption","source":"https://allemannsdata.com/wiki/api/v1/kilder/elhub","feedback":"https://allemannsdata.com/wiki/api/v1/feedback"},"output_fields":["municipality_code","municipality","date","last_updated","totals_kwh","total_kwh","hours","hours[].start_time","hours[].consumption_group","hours[].quantity_kwh","hours[].metering_point_count"],"output_fields_truncated":false,"canonical_field_aliases":{"date":["date"]},"response_example":{"source":"elhub","operation":"get_municipality_consumption","parameters":{"municipality":"example value","date":"2026-01-15"},"data":{"municipality_code":"example value","municipality":"example value","date":"2026-01-15","last_updated":"2026-01-15T12:00:00Z","totals_kwh":{"example_key":1.0},"total_kwh":1.0,"hours":[{"start_time":"2026-01-15T12:00:00Z","consumption_group":"example value","quantity_kwh":1.0,"metering_point_count":1}]},"entities":[],"_meta":{"retrieved_at":"2026-01-15T12:00:00Z","language":"en","content_languages":["en"],"sources":[{"id":"elhub","name":"Elhub energy data","description":"Measured electricity consumption and production per price area, municipality and customer group, exchange between areas and installed capacity per source.","cache_ttl_seconds":3600,"documentation":"https://api.elhub.no/energy-data-api"}]},"_provenance":{"data":{"source":"elhub","source_api":"https://allemannsdata.com/wiki/api/v1/kilder/elhub"},"entities":{"source":"elhub","source_api":"https://allemannsdata.com/wiki/api/v1/kilder/elhub","derived_from":"#/data","description":"Normalized projection of data."}},"_links":{"self":"https://allemannsdata.com/wiki/api/v1/kilder/elhub/get_municipality_consumption","source":"https://allemannsdata.com/wiki/api/v1/kilder/elhub","wiki":"https://allemannsdata.com/wiki/kilder/elhub/get_municipality_consumption/","feedback":"https://allemannsdata.com/wiki/api/v1/feedback"}}}
