milloin.xyz

Developer docs

Custom plans

Describe your own load and get the cheapest time to run it. The presets are the same request with the parameters filled in.

Parameters of GET /v1/electricity/plans

ParameterMeaning
durationHoursHow long the load runs, in steps of 0.25 hours, up to 24.
energyKwhEnergy it uses. With it the answer has costs in cents; without it, only average prices.
maxPowerKwIts power, such as a charger's 11 kW, with energyKwh instead of durationHours.
pausabletrue for a load that can stop and go on later. Defaults to false.
minBlockHoursPausable loads: the shortest time it runs once switched on, in steps of 0.25 hours. Defaults to 0.25.
earliestStartStart of the search; defaults to now. May be in the past back to midnight today, so a plan stays the same as time passes. today and tomorrow mean midnight, Finnish time.
latestEndWhen it must be done, such as when the car leaves. Defaults to the last published price. tomorrow is midnight tonight.
limitContinuous loads: how many runs to return, 1 to 10. Defaults to 3.
resolutionhour plans on hourly average prices with starts on the full hour. Defaults to 15min.
vatfalse for prices and costs without VAT.

A continuous load

A dishwasher that runs 3 hours on 1.2 kWh and should be done by midnight:

curl "https://milloin.xyz/api/v1/electricity/plans?durationHours=3&energyKwh=1.2&latestEnd=tomorrow"

A pausable load

Charging 50 kWh at 11 kW before 7:00 tomorrow morning, an hour at least at a time:

curl "https://milloin.xyz/api/v1/electricity/plans?pausable=true&energyKwh=50&maxPowerKw=11&minBlockHours=1&latestEnd=2026-10-13T07:00:00%2B03:00"

The plan has one or more blocks, each with its energyKwh. At full power the energy may be in up to 15 minutes before a block's endTime.

Following a plan with a device

Switch the device on while activeNow is true, and ask again at nextChangeAt. Keep earliestStart and latestEnd fixed for the period, as the Home Assistant example does with today and tomorrow: a search from now would plan the whole load again each time.

A power profile and given start times

POST /v1/electricity/plans/search takes the same fields as a JSON body, plus profileKwh, the energy for each slot of the run for a load whose power changes, and startTimes to cost given starts, such as the delays a washing machine's timer offers. A sauna heater that draws 4 kWh in its first hour and 2 kWh in the next two, compared with warming it at 17 or 19:

Request

curl -X POST https://milloin.xyz/api/v1/electricity/plans/search \
  -H "Content-Type: application/json" \
  -d '{
    "resolution": "hour",
    "profileKwh": [4, 2, 2],
    "startTimes": ["2026-10-12T17:00:00+03:00", "2026-10-12T19:00:00+03:00"],
    "limit": 1
  }'

Response, shortened

{
  "request": { "pausable": false, "durationHours": 3, "energyKwh": 8, "resolution": "hour", ... },
  "plans": [
    { "startTime": "2026-10-13T01:00:00.000Z", "endTime": "2026-10-13T04:00:00.000Z",
      "priceAvg": 2, "costCents": 16, "savingsCents": 68, ... }
  ],
  "startTimes": [
    { "requestedStart": "2026-10-12T17:00:00+03:00", "startTime": "2026-10-12T14:00:00.000Z",
      "endTime": "2026-10-12T17:00:00.000Z", "priceAvg": 10.25, "category": "EXPENSIVE", "costCents": 82 },
    { "requestedStart": "2026-10-12T19:00:00+03:00", "startTime": "2026-10-12T16:00:00.000Z",
      "endTime": "2026-10-12T19:00:00.000Z", "priceAvg": 9.75, "category": "NORMAL", "costCents": 78 }
  ],
  ...
}

Responses to POST are not cached by the CDN, so use GET when it is enough.