Energinet, the Danish transmission system operator, publishes a lot of its data through Energi Data Service (energidataservice.dk). Everything is available through a free, open REST API at api.energidataservice.dk - no API key or sign-up needed. This post shows how to fetch Danish day-ahead electricity spot prices with it.
The dataset
The current dataset for day-ahead (spot) prices is called DayAheadPrices. It replaced the older Elspotprices dataset, which I checked still responds but whose latest record is from 30 September 2025. If you find old tutorials using Elspotprices, switch to DayAheadPrices for current data.
Each record in DayAheadPrices contains these fields:
-
TimeUTCandTimeDK- the start of the period in UTC and Danish local time -
PriceArea- the bidding zone -
DayAheadPriceEURandDayAheadPriceDKK- the price in EUR/MWh and DKK/MWh
Note that the dataset is now published in 15-minute resolution, so you get four records per hour instead of one. If you need an hourly price, average the four values.
Price areas: DK1 and DK2
Denmark is split into two price areas. DK1 is West Denmark (Jutland and Funen), DK2 is East Denmark (Zealand and the islands). The dataset also contains neighbouring areas such as DE, so always filter on PriceArea unless you want them all. Which area you need depends on where the consumer lives.
Example request with curl
curl -G "https://api.energidataservice.dk/dataset/DayAheadPrices" \
--data-urlencode 'start=2026-10-28T00:00' \
--data-urlencode 'end=2026-10-29T00:00' \
--data-urlencode 'filter={"PriceArea":["DK1"]}' \
--data-urlencode 'sort=TimeUTC asc' \
--data-urlencode 'limit=100'
The response is JSON with a records array, plus total, limit and dataset fields. The filter parameter takes a JSON object where each key is a column and each value is a list of accepted values. sort accepts a column name followed by asc or desc.
The same thing in JavaScript
const params = new URLSearchParams({
start: '2026-10-28T00:00',
end: '2026-10-29T00:00',
filter: JSON.stringify({ PriceArea: ['DK2'] }),
sort: 'TimeUTC asc',
limit: '100',
});
const res = await fetch(
'https://api.energidataservice.dk/dataset/DayAheadPrices?' + params
);
const { records } = await res.json();
for (const r of records) {
const kronerPerKwh = r.DayAheadPriceDKK / 1000;
console.log(r.TimeDK, kronerPerKwh.toFixed(3), 'kr/kWh');
}
Things to watch out for
Units. Prices are given per MWh, not per kWh. To get kr/kWh, divide the DKK price by 1000.
What is not included. The spot price excludes grid tariffs, the electricity tax (elafgift), your supplier's margin and VAT. What you actually pay per kWh is considerably higher in most hours, so do not present the raw spot price as the "price of electricity" without saying so. If you want a realistic number, you need to add the tariffs for your grid company, the tax and 25% VAT.
Publication time. The prices for the next day are published around 13:00 CET. Before that, a request for tomorrow returns no records, so schedule your fetch for the afternoon and handle an empty result gracefully.
Time zones. Use TimeUTC for sorting and joining data, and TimeDK for showing it to people. This avoids headaches around the daylight saving changeover.
Be a good API citizen. The API is free but not unlimited. Cache the result, since the data for a day does not change once published, and fetch once per day instead of on every page view.
Wrapping up
With a single GET request you can get Danish day-ahead prices for either price area, sorted and filtered the way you want. From there it is a matter of dividing by 1000 and deciding which extras to add on top.
We use this data in Elprisdisplay (https://elprisdisplay.dk), a small display that shows the current price at home.
Top comments (0)