Skip to main content
In this guide you find the metering grid area for an address, pick the tariff that fits the connection, and calculate the month’s cost per tariff component. The steps are the same for any connection: an apartment, a house, a business or a producer. The example answers one question: what does a house in Västerås pay for its grid connection in January? It takes about ten minutes.

Before you start

  • An API key. Create one in the console. See Authentication.
  • Access to the Västmanland Södra grid area. On a trial, pick it as your trial metering grid area in the console, under Cost of Energy, before you start. With full access you can skip this.
  • Python 3.10 or later with httpx, for the last step: pip install httpx.
1

Find the metering grid area

A tariff depends on where the house connects to the grid. Look up the metering grid area for the house’s coordinates:
Response
You can also search by address with street, city and zipcode.
2

List the tariffs in the area

A grid area has many tariffs: for apartments, houses, businesses and producers. Each one says who it is for in eligibility:
Response (shortened)
3

Pick the house's tariff

The house has a 20 A main fuse and takes energy from the grid. Match that against eligibility, and leave out the apartment tariff:
Python
That gives Säkringsabonnemang 20 A. Its four components are what the house pays in January 2026:Fetch the tariff with GET /cost-of-energy/v1/tariffs/{tariff_id} to see each component’s calculation pipeline. A component also has a validity window: when the operator changes a price, a new component takes over from that date.
4

Calculate January

Send the house’s consumption for January, one value per quarter-hour in kWh, and get the cost per component back. This example generates a simple household profile: a little at night, more in the morning, most in the evening.
Python
Output
The house pays 1,213.22 SEK for its grid connection in January. It used 1,362 kWh. Its highest weekday hours inside the peak window, 17:00 to 19:00, used 3.6 kW, so the peak fee is 3.6 kW × 47.4 SEK/kW = 170.64 SEK. The same load after 19:00 never counts towards the peak.Each component returns its cost at its own resolution: the peak and fixed fees once for the month, transfer and tax per quarter-hour. Add ?include_intermediate_time_series=true to see every step of each pipeline.

Next steps

Which tool for which question

Calculate, compare tariffs, optimise a battery, or find the expensive hours.

Calculation pipelines

How a component turns consumption into cost, step by step.

Python SDK

Run the same calculation, or an optimisation, on your side.

Cookbook

Runnable recipes: fetch a tariff, calculate a cost, optimise a home battery.