curl --request POST \
--url https://stage-api.getswitch.io/forecast/{forecast_type} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"grid": {
"grid_type": "squares",
"location": "milan",
"tile_size": 1000
},
"prediction_horizon_size": 3,
"time_granularity_minutes": 60
}
'import requests
url = "https://stage-api.getswitch.io/forecast/{forecast_type}"
payload = {
"grid": {
"grid_type": "squares",
"location": "milan",
"tile_size": 1000
},
"prediction_horizon_size": 3,
"time_granularity_minutes": 60
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
grid: {grid_type: 'squares', location: 'milan', tile_size: 1000},
prediction_horizon_size: 3,
time_granularity_minutes: 60
})
};
fetch('https://stage-api.getswitch.io/forecast/{forecast_type}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://stage-api.getswitch.io/forecast/{forecast_type}"
payload := strings.NewReader("{\n \"grid\": {\n \"grid_type\": \"squares\",\n \"location\": \"milan\",\n \"tile_size\": 1000\n },\n \"prediction_horizon_size\": 3,\n \"time_granularity_minutes\": 60\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"periods": [
"2026-11-30T08:00:00Z",
"2026-11-30T09:00:00Z",
"2026-11-30T10:00:00Z"
],
"zones": {
"1042": [
3.2,
4.1,
2.7
],
"1043": [
1.4,
1.9,
0.8
]
}
}Get Forecasted Demand by Type
Retrieve demand forecast predictions for a specific forecast type within your company’s forecasts. This endpoint allows explicit selection of the forecast type when multiple types are configured, providing time-series predictions aggregated by spatial zones for the specified forecast model.
Failure Modes:
- 400: Invalid filters (unsupported location, granularity, or grid type) for the specified forecast type
- 401: Invalid or missing Bearer token credentials
- 403: Insufficient permissions (missing ‘forecast:read’ scope or no forecast access)
- 404: Your company has no forecasts configured, or the specified forecast type is not enabled for it
- 422: Invalid request data that fails validation
- 500: Missing configuration data, malformed prediction data, or inability to locate any viable predictions
Required Auth Scopes:
forecast:read
Supported Forecast Types:
demand- Demand forecast predictions aggregated by spatial zones.unsatisfied-demand- Unsatisfied demand forecast predictions aggregated by spatial zones.
curl --request POST \
--url https://stage-api.getswitch.io/forecast/{forecast_type} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"grid": {
"grid_type": "squares",
"location": "milan",
"tile_size": 1000
},
"prediction_horizon_size": 3,
"time_granularity_minutes": 60
}
'import requests
url = "https://stage-api.getswitch.io/forecast/{forecast_type}"
payload = {
"grid": {
"grid_type": "squares",
"location": "milan",
"tile_size": 1000
},
"prediction_horizon_size": 3,
"time_granularity_minutes": 60
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
grid: {grid_type: 'squares', location: 'milan', tile_size: 1000},
prediction_horizon_size: 3,
time_granularity_minutes: 60
})
};
fetch('https://stage-api.getswitch.io/forecast/{forecast_type}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://stage-api.getswitch.io/forecast/{forecast_type}"
payload := strings.NewReader("{\n \"grid\": {\n \"grid_type\": \"squares\",\n \"location\": \"milan\",\n \"tile_size\": 1000\n },\n \"prediction_horizon_size\": 3,\n \"time_granularity_minutes\": 60\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"periods": [
"2026-11-30T08:00:00Z",
"2026-11-30T09:00:00Z",
"2026-11-30T10:00:00Z"
],
"zones": {
"1042": [
3.2,
4.1,
2.7
],
"1043": [
1.4,
1.9,
0.8
]
}
}Authorizations
Path Parameters
Body
Defines the filters applicable to a forecast request.
This schema includes parameters such as location, time granularity, prediction horizon, and grid details.
Response
Successfully retrieved forecast predictions for the specified type with time periods and zone-aggregated values.
Represents the response structure for a forecast request.
This schema includes the time periods and forecasted values for different zones.
