curl --request POST \
--url https://stage-api.getswitch.io/forecast/geojson \
--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/geojson"
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/geojson', 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/geojson"
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))
}{
"geojson": {
"features": [
{
"geometry": {
"coordinates": [
[
[
9.18,
45.46
],
[
9.1928,
45.46
],
[
9.1928,
45.469
],
[
9.18,
45.469
],
[
9.18,
45.46
]
]
],
"type": "Polygon"
},
"properties": {
"zone_id": "1042",
"predictions": [
3.2,
4.1,
2.7
]
},
"type": "Feature"
},
{
"geometry": {
"coordinates": [
[
[
9.1928,
45.46
],
[
9.2056,
45.46
],
[
9.2056,
45.469
],
[
9.1928,
45.469
],
[
9.1928,
45.46
]
]
],
"type": "Polygon"
},
"properties": {
"zone_id": "1043",
"predictions": [
1.4,
1.9,
0.8
]
},
"type": "Feature"
}
],
"type": "FeatureCollection"
},
"periods": [
"2026-11-30T08:00:00Z",
"2026-11-30T09:00:00Z",
"2026-11-30T10:00:00Z"
]
}Get Forecasted Demand as GeoJSON
Retrieve demand forecast predictions as GeoJSON format 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 merged with spatial grid geometries in GeoJSON format. Zero-value zones are automatically filtered out.
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.
curl --request POST \
--url https://stage-api.getswitch.io/forecast/geojson \
--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/geojson"
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/geojson', 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/geojson"
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))
}{
"geojson": {
"features": [
{
"geometry": {
"coordinates": [
[
[
9.18,
45.46
],
[
9.1928,
45.46
],
[
9.1928,
45.469
],
[
9.18,
45.469
],
[
9.18,
45.46
]
]
],
"type": "Polygon"
},
"properties": {
"zone_id": "1042",
"predictions": [
3.2,
4.1,
2.7
]
},
"type": "Feature"
},
{
"geometry": {
"coordinates": [
[
[
9.1928,
45.46
],
[
9.2056,
45.46
],
[
9.2056,
45.469
],
[
9.1928,
45.469
],
[
9.1928,
45.46
]
]
],
"type": "Polygon"
},
"properties": {
"zone_id": "1043",
"predictions": [
1.4,
1.9,
0.8
]
},
"type": "Feature"
}
],
"type": "FeatureCollection"
},
"periods": [
"2026-11-30T08:00:00Z",
"2026-11-30T09:00:00Z",
"2026-11-30T10:00:00Z"
]
}Authorizations
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 as GeoJSON with spatial geometries and prediction values.
GeoJSON FeatureCollection with one Polygon feature per forecasted zone; each feature's properties are zone_id and predictions (one value per entry of periods).
{
"features": [
{
"geometry": {
"coordinates": [
[
[9.18, 45.46],
[9.1928, 45.46],
[9.1928, 45.469],
[9.18, 45.469],
[9.18, 45.46]
]
],
"type": "Polygon"
},
"properties": {
"zone_id": "1042",
"predictions": [3.2, 4.1, 2.7]
},
"type": "Feature"
},
{
"geometry": {
"coordinates": [
[
[9.1928, 45.46],
[9.2056, 45.46],
[9.2056, 45.469],
[9.1928, 45.469],
[9.1928, 45.46]
]
],
"type": "Polygon"
},
"properties": {
"zone_id": "1043",
"predictions": [1.4, 1.9, 0.8]
},
"type": "Feature"
}
],
"type": "FeatureCollection"
}
