Get Forecasted Demand
curl --request POST \
--url https://stage-api.getswitch.io/forecast \
--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"
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', 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"
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
]
}
}Forecast
Get Forecasted Demand
Retrieve demand forecast predictions for your company, for the forecast type enabled for it and the applied filters. This endpoint automatically picks your company’s only forecast type and returns time-series predictions aggregated by spatial zones.
Failure Modes:
- 400: Invalid filters (unsupported location, granularity, or grid type) or multiple forecast types configured requiring explicit selection
- 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 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.
POST
/
forecast
Get Forecasted Demand
curl --request POST \
--url https://stage-api.getswitch.io/forecast \
--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"
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', 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"
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
HTTPBearerHTTPBearer
Body
application/json
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 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.
