Authentication with the Solcast API

Authentication with the Solcast API

Authentication with the Solcast API

The Solcast API allows several ways of authentication using your provided API key. Learn some of the methods you can use.

To show how to authenticate with the Solcast API, you can see the samples below. It is important to note that we’ll use “YOUR_APIKEY” as a replacement for your actual API key.

Pass as query string parameter

The easiest way is to just pass the API key as a query string parameter. For example, if you were trying to request the forecasts for your rooftop site, you would use the following URL.

GET https://api.solcast.com.au/rooftop_sites/abcd-1234-abcd-1234/forecasts?api_key=YOUR_APIKEY

As a curl command this would look like

curl -H "Accept: application/json" https://api.solcast.com.au/rooftop_sites/abcd-1234-abcd-1234/forecasts?api_key=YOUR_APIKEY

Pass as Bearer token within Authorization request header

If, for whatever reason, you prefer to send as a bearer token, it should be passed in the "Authorization" header with the "type" Bearer.

As a curl command this would look like

curl -H "Accept: application/json" -H "Authorization: Bearer YOUR_APIKEY" https://api.solcast.com.au/rooftop_sites/abcd-1234-abcd-1234/forecasts

Pass API as Basic authentication

For use with Basic authentication, the API key is passed only as the username with an empty password.

As a curl command this would look like

curl -H "Accept: application/json" -u YOUR_APIKEY: https://api.solcast.com.au/rooftop_sites/abcd-1234-abcd-1234/forecasts

If you are still having problems authenticating with our API or want to suggest improvements to this article, please reach out to us - support@solcast.com.au.