Get Started

Use RayCast for short-term solar irradiance forecasting. Find more documentation here

Step 1: Register and get API key.

Register to get an account.

Step 2: understand API endpoints

  • Get to know the available endpoints. Detailed information can be found here.
  • In short, we provide two types of endpoints: one for specific locations and another for the entire grid of the Netherlands.

Step 3: Make your first API call

  1. Import packages

import requests
import json

def get_firebase_auth_headers(
    username: str,
    password: str
) -> dict[str, str]:
    """
    Authenticate a user with Firebase and return 
    the authorization headers required for subsequent 
    API requests.
    
    Parameters:
    ----------
    username: str
        The email address of the user.
    password: str
        The password of the user.
    """ 
    firebase_key = "AIzaSyCECGQmWsGaZ3x7n_uGiq3kt-lyo-IYPvI"
    firebase_url = "https://identitytoolkit.googleapis.com/v1"
    firebase_endpoint = f"{firebase_url}/accounts:signInWithPassword?key={firebase_key}"
    data_dict = {'email': username, 'password': password, 'returnSecureToken': 'true'}
    response_post_token = requests.post(
        firebase_endpoint, 
        data=data_dict
        )
    if response_post_token.status_code == 200:
        id_token = response_post_token.json()['idToken']
        headers = {
            "Content-Type": "application/json", 
            "Authorization": f"Bearer {id_token}"
            }   
    else:
        print(f"Failed to authenticate user with Firebase. {response_post_token.text}")
        headers = {
            "Content-Type": "application/json", 
            "Authorization" : ""
            } 
    return headers
  1. Authenticate
username = 'your_username'
password = 'your_password'

headers = get_firebase_auth_headers(username, password)
print(headers)
  1. Make a request
data = json.dumps({
    "forecast_datetime":"2025-01-01T12:00:00Z"
})

response=requests.post(
    "https://api.raycast.nl/irradiance", 
    headers=headers, 
    data=data
)

with open ('output.nc','wb') as f: 
  f.write(response.content)

Step 4: integrate the API into your application

  • Choose your preferred programming language (e.g., Python, Rust etc.)