The Solcast API allows for several methods of authentication using your provided API key. In this article we'll go over common ways to authenticate with some examples. In all the examples "YOUR_APIKEY" is 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 via Intercom chat.