How to use the Solar Forecast UK API
You can bring the same solar generation forecasts used by Solar Forecast UK into your own scripts, home automations and dashboards. Here’s how to get started, even if you haven't used an API before.
What does the API provide?
The API estimates how much electricity solar panels could generate, based on your UK location, solar array capacity, panel direction, tilt, system losses and any inverter output limit. It returns daily generation estimates in kWh and hourly power estimates in kW, along with predicted peak output and the strongest generation window.
It is a forecast, not a measurement of what your panels are producing right now. Changing cloud conditions, shading and equipment behaviour can make actual generation different. You do not need to query it every few minutes to plan tomorrow’s generation.
What could you use it for?
Home automation: Let Home Assistant, Node-RED or a custom script consider the predicted high-output hours when planning flexible appliances. You can connect the API using your own integration or automation workflow.
EV and battery charging: Combine estimated solar production with household demand, battery state of charge and your electricity tariff to help decide when charging might make sense. A generation forecast alone cannot calculate your actual surplus or make an electrical installation safe to control.
Dashboards and analysis: Display expected hourly generation beside your smart-meter or inverter readings, or compare a previous forecast with actual output to see where cloud predictions differ.
Step 1: Create an API key
Create a free account or sign in, then open the Developer API page. Create a key for your integration and copy it into a secure password manager or secret store: the complete key is shown only once.
Keep the key on a device or server you control. Never include it in a public webpage, share it in a screenshot, commit it to GitHub or put it in a URL. You can revoke individual keys on the developer page if one is exposed.
Step 2: Request your first forecast
The endpoint is POST /api/v1/forecast. Use a Bearer token in the Authorization header, and send JSON describing your solar installation. In the example below, SOLARFORECAST_API_KEY is an environment variable containing your own private key.
curl https://solarforecast.uk/api/v1/forecast \
-H "Authorization: Bearer $SOLARFORECAST_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"postcode": "TF3 4XX",
"arrays": [
{"name": "South roof", "capacityKw": 4, "azimuth": 0, "tilt": 35}
],
"lossPct": 18,
"inverterLimitKw": 3.68
}'Panel direction: azimuth: 0 means south, -90 means east and 90 means west. tilt is in degrees (0–90). capacityKw describes the array’s rated peak capacity in kWp. The postcode and numbers shown are illustrative: replace them with your own details.
You can send up to six separately oriented solar arrays in the arrays list. You may provide latitude and longitude instead of a postcode. The loss percentage must be between 0 and less than 100; the inverter limit is optional.
Step 3: Read the result
The JSON response includes a days array. Each day has energyKwh (estimated total generation), peakKw (the strongest predicted power), bestWindowStart and bestWindowEnd, plus a points array with hourly time and powerKw values.
For example, your automation could read days[0].energyKwh for today's estimated energy, or look at individual points to identify hours suitable for a flexible load.
The following is a simplified, invented example to explain the field names, not a real API response. Actual responses include additional fields and hourly values.
{
"location": { "postcodeDistrict": "TF3", "latitude": 52.68, "longitude": -2.45 },
"totalCapacityKw": 4,
"days": [
{
"date": "2026-10-23",
"energyKwh": 8.4,
"peakKw": 2.1,
"bestWindowStart": "2026-10-23T11:00",
"bestWindowEnd": "2026-10-23T14:00",
"points": [
{ "time": "2026-10-23T12:00", "powerKw": 1.9 }
]
}
]
}Step 4: Use it responsibly
Under the current limits, each API key can make up to 5 requests a minute and 120 per 24-hour window, with an additional 240 requests per account per 24-hour window limit. Requests are limited to 16 KiB, and you can create up to five active keys per account. Current limits and your usage are shown on the Developer API page.
Identical requests benefit from Solar Forecast UK’s shared forecast cache. For typical planning automations, checking hourly—or when you need a fresh plan—is more useful than polling constantly. If the API responds with HTTP 429, respect the Retry-After header and avoid immediate retries.
The API is intended for server-side integrations rather than direct calls from public browser code; cross-origin browser access is not enabled by default. Keep the key private and do not treat forecast values as guaranteed electricity production or a substitute for appropriate equipment safeguards.