Solar Irradiance API

Product concept

OpenWeather are thrilled to announce the launch of our new Solar Irradiance & Energy Prediction service. You will be able to predict the energy generated by a particular solar panel before installation, or check for potential issues with existing panels.

Main features of Solar Irradiance API:

Data is available in JSON format.

The detailed information about what technologies, algorithms, etc. are behind the Solar Irradiance API can be founded here.

How to get access

  1. Sign up to OpenWeather service in case you haven't got your OpenWeather API key yet.
  2. Follow the pricing page to learn details about the price.

    Solar Irradiance API is included in the separate subscription only and allows you to pay only for the number of API calls made to this product. Please find more details on the pricing page.

  3. Just make an API call according to the tech documentation below, remembering to add your key to each call.

Call Solar Irradiance API

How to make an API call

API call

https://api.openweathermap.org/energy/1.0/solar/data?lat={lat}&lon={lon}&date={date}&appid={API key}
Parameters
lat required Latitude, decimal (−90; 90)
lon required Longitude, decimal (−180; 180)
date required Date in the `YYYY-MM-DD` format for which data is requested. Date available from 1979-01-01 up to +15 days to the current date
appid required Your unique API key (you can always find it on your account page under the "API key" tab)
If the service detected timezone for your location incorrectly you can specify correct timezone manually by adding tz parameter in the ±XX:XX format to API call.

API call

https://api.openweathermap.org/energy/1.0/solar/data?lat={lat}&lon={lon}&date={date}&tz={tz}&appid={API key}

Example of API call

https://api.openweathermap.org/energy/1.0/solar/data?lat=60.45&lon=-38.67&date=2023-03-30&tz=+03:00&appid={API key}
Please pay attention that in case timezone is specified time of sunset and sunrise will be returned in accordance with this specified timezone.

Example of API call

https://api.openweathermap.org/energy/1.0/solar/data?lat=34&lon=34&date=2023-03-28&appid={API key}

Example of API response

Example of API response
                
{
   "lat":34,
   "lon":34,
   "date":"2023-03-28",
   "tz":"+02:00",
   "sunrise":"2023-03-28T05:37:14",
   "sunset":"2023-03-28T18:01:37",
   "irradiance":{
      "daily":[
         {
            "clear_sky":{
               "ghi":6694.67,
               "dni":9166.93,
               "dhi":1140.04
            },
            "cloudy_sky":{
               "ghi":6694.67,
               "dni":8962.1,
               "dhi":1120.64
            }
         }
      ],
      "hourly":[
         {
            "hour":0,
            "clear_sky":{
               "ghi":0,
               "dni":0,
               "dhi":0
            },
            "cloudy_sky":{
               "ghi":0,
               "dni":0,
               "dhi":0
            }
         },
         {
            "hour":1,
            "clear_sky":{
               "ghi":0,
               "dni":0,
               "dhi":0
            },
            "cloudy_sky":{
               "ghi":0,
               "dni":0,
               "dhi":0
            }
         },
         {
            "hour":2,
            "clear_sky":{
               "ghi":0,
               "dni":0,
               "dhi":0
            },
            "cloudy_sky":{
               "ghi":0,
               "dni":0,
               "dhi":0
            }
         },
         {
            "hour":3,
            "clear_sky":{
               "ghi":128.2,
               "dni":477.91,
               "dhi":53.3
            },
            "cloudy_sky":{
               "ghi":128.2,
               "dni":460.36,
               "dhi":47.17
            }
         },
         {
            "hour":4,
            "clear_sky":{
               "ghi":344.02,
               "dni":705.53,
               "dhi":82.21
            },
            "cloudy_sky":{
               "ghi":344.02,
               "dni":709.46,
               "dhi":73.51
            }
         },
         {
            "hour":5,
            "clear_sky":{
               "ghi":553.18,
               "dni":816.73,
               "dhi":100.14
            },
            "cloudy_sky":{
               "ghi":553.18,
               "dni":801.59,
               "dhi":101.82
            }
         },
         {
            "hour":6,
            "clear_sky":{
               "ghi":727.62,
               "dni":879.35,
               "dhi":111.8
            },
            "cloudy_sky":{
               "ghi":727.62,
               "dni":864.5,
               "dhi":115.05
            }
         },
         {
            "hour":7,
            "clear_sky":{
               "ghi":849.19,
               "dni":913.88,
               "dhi":118.8
            },
            "cloudy_sky":{
               "ghi":849.19,
               "dni":906.71,
               "dhi":116.74
            }
         },
         {
            "hour":8,
            "clear_sky":{
               "ghi":906.35,
               "dni":928.27,
               "dhi":121.84
            },
            "cloudy_sky":{
               "ghi":906.35,
               "dni":909.35,
               "dhi":129.82
            }
         },
         {
            "hour":9,
            "clear_sky":{
               "ghi":893.86,
               "dni":925.25,
               "dhi":121.17
            },
            "cloudy_sky":{
               "ghi":893.86,
               "dni":908.83,
               "dhi":126.93
            }
         },
         {
            "hour":10,
            "clear_sky":{
               "ghi":812.89,
               "dni":904.28,
               "dhi":116.75
            },
            "cloudy_sky":{
               "ghi":812.89,
               "dni":903.82,
               "dhi":109.46
            }
         },
         {
            "hour":11,
            "clear_sky":{
               "ghi":670.94,
               "dni":861.15,
               "dhi":108.19
            },
            "cloudy_sky":{
               "ghi":670.94,
               "dni":855.43,
               "dhi":104.91
            }
         },
         {
            "hour":12,
            "clear_sky":{
               "ghi":481.8,
               "dni":784.81,
               "dhi":94.59
            },
            "cloudy_sky":{
               "ghi":481.8,
               "dni":778.52,
               "dhi":90.92
            }
         },
         {
            "hour":13,
            "clear_sky":{
               "ghi":266.39,
               "dni":645.45,
               "dhi":73.66
            },
            "cloudy_sky":{
               "ghi":266.39,
               "dni":644.9,
               "dhi":66.16
            }
         },
         {
            "hour":14,
            "clear_sky":{
               "ghi":60.24,
               "dni":324.33,
               "dhi":37.59
            },
            "cloudy_sky":{
               "ghi":60.24,
               "dni":218.62,
               "dhi":38.14
            }
         },
         {
            "hour":15,
            "clear_sky":{
               "ghi":0,
               "dni":0,
               "dhi":0
            },
            "cloudy_sky":{
               "ghi":0,
               "dni":0,
               "dhi":0
            }
         },
         {
            "hour":16,
            "clear_sky":{
               "ghi":0,
               "dni":0,
               "dhi":0
            },
            "cloudy_sky":{
               "ghi":0,
               "dni":0,
               "dhi":0
            }
         },
         {
            "hour":17,
            "clear_sky":{
               "ghi":0,
               "dni":0,
               "dhi":0
            },
            "cloudy_sky":{
               "ghi":0,
               "dni":0,
               "dhi":0
            }
         },
         {
            "hour":18,
            "clear_sky":{
               "ghi":0,
               "dni":0,
               "dhi":0
            },
            "cloudy_sky":{
               "ghi":0,
               "dni":0,
               "dhi":0
            }
         },
         {
            "hour":19,
            "clear_sky":{
               "ghi":0,
               "dni":0,
               "dhi":0
            },
            "cloudy_sky":{
               "ghi":0,
               "dni":0,
               "dhi":0
            }
         },
         {
            "hour":20,
            "clear_sky":{
               "ghi":0,
               "dni":0,
               "dhi":0
            },
            "cloudy_sky":{
               "ghi":0,
               "dni":0,
               "dhi":0
            }
         },
         {
            "hour":21,
            "clear_sky":{
               "ghi":0,
               "dni":0,
               "dhi":0
            },
            "cloudy_sky":{
               "ghi":0,
               "dni":0,
               "dhi":0
            }
         },
         {
            "hour":22,
            "clear_sky":{
               "ghi":0,
               "dni":0,
               "dhi":0
            },
            "cloudy_sky":{
               "ghi":0,
               "dni":0,
               "dhi":0
            }
         },
         {
            "hour":23,
            "clear_sky":{
               "ghi":0,
               "dni":0,
               "dhi":0
            },
            "cloudy_sky":{
               "ghi":0,
               "dni":0,
               "dhi":0
            }
         }
      ]
   }
}

              
              

Fields in API response

  • lat Latitude of the location,decimal (−90; 90)
  • lon Longitude of the location,decimal (-180; 180)
  • date Date specified in the API request in the `YYYY-MM-DD` format (from 1979-01-01 up to +15 days to the current date)
  • tz Timezone in the ±XX:XX format
  • sunrise Date and time of sunrise based on date specified in the API request and timezone authomatically determinated by on latitude and longitute of requested location. If you added timezone parameter into API request, then time of sunrise will be recalculated in accordance with this timezone. For polar areas in midnight sun and polar night periods this parameter is not returned in the response
  • sunsetDate and time of sunset based on date specified in the API request and timezone authomatically determinated by on latitude and longitute of requested location. If you added timezone parameter into API request, then time of sunset will be recalculated in accordance with this timezone. For polar areas in midnight sun and polar night periods this parameter is not returned in the response
  • irradianceIrradiance related information

Bulk downloading

We provide number of bulk files for historical solar irradiance data. The service allows you to regularly download solar irradiance history and solar irradiance history forecast bulks. There is no need to call an API to do this. More information is on the Solar Irradiance History Bulk and Solar Irradiance History Forecast Bulk pages.

API errors

Structure of API errors

In case of incorrected API call you will receive API error response. Error response payload returned for all types of errors with the structure below.

Example of error response

Example of error response
                
{
    "code": "400",
    "message": "Invalid date format",
    "parameters": [
        "date"
    ]
}
        
              

Fields in error response

  • code Code of error
  • message Description of error
  • parameters(optional) List of request parameters names that are related to this particular error

Errors list


Please find more detailed information about some popular errors below.

API calls return an error 400

Error 400 - Bad Request. You can get error 400 error if either some mandatory parameters in the request are missing or some of request parameters have incorrect format or values out of allowed range. List of all parameters names that are missong or incorrect will be returned in `parameters`attribute of the `ErrorResponse` object.

API calls return an error 401

Error 401 - Unauthorized. You can get 401 error if API token did not providen in the request or in case API token provided in the request does not grant access to this API. You must add API token with granted access to theistory Daily Aggregation API to the request before returing it.

API calls return an error 404

Error 404 - Not Found. You can get 404 error if data with requested parameters (`lat`, `lon` and `date`) does not exist in service database. You must not retry the same request.

API calls return an error 429

Error 429 - Too Many Requests. You can get 429 error if key quato of requests for provided API to this API was exceeded. You may retry request after some time or after extending your key quota.

API calls return errors '5xx'

Errors 5xx - Unexpected Error. You can get '5xx' error in case of other internal errors. Error Response code will be `5xx`. Please contact us and enclose an example of your API request that receives this error into your email to let us analyze it and find a solution for you promptly. You may retry the request which led to this error.