curl --request GET \
--url https://stage-api.getswitch.io/grids/stream \
--header 'Authorization: Bearer <token>'import requests
url = "https://stage-api.getswitch.io/grids/stream"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://stage-api.getswitch.io/grids/stream', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://stage-api.getswitch.io/grids/stream"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
9.18,
45.46
],
[
9.1928,
45.46
],
[
9.1928,
45.469
],
[
9.18,
45.469
],
[
9.18,
45.46
]
]
]
},
"properties": {
"zone_id": "1042"
}
},
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
9.1928,
45.46
],
[
9.2056,
45.46
],
[
9.2056,
45.469
],
[
9.1928,
45.469
],
[
9.1928,
45.46
]
]
]
},
"properties": {
"zone_id": "1043"
}
}
]
}Download Grid File For Single Data Scenario
Downloads the spatial grid your company’s forecasts and imbalance are computed on, for one location, grid type and tile size, as a grid.geojson file. The file is a GeoJSON FeatureCollection with one Polygon feature per zone; each feature’s only property is zone_id, the same zone id used as key in forecast and imbalance responses.
Use this endpoint to download the complete grid file.
Failure Modes:
- 400: Location, grid type or tile size not enabled for your company
- 401: Invalid or missing authentication credentials
- 403: Insufficient permissions for grid:read scope
- 404: Your company has no forecast data configured
- 422: Request validation errors (invalid grid_type, missing location)
- 500: The grid file could not be read
Required Auth Scopes:
grid:read
curl --request GET \
--url https://stage-api.getswitch.io/grids/stream \
--header 'Authorization: Bearer <token>'import requests
url = "https://stage-api.getswitch.io/grids/stream"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://stage-api.getswitch.io/grids/stream', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://stage-api.getswitch.io/grids/stream"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
9.18,
45.46
],
[
9.1928,
45.46
],
[
9.1928,
45.469
],
[
9.18,
45.469
],
[
9.18,
45.46
]
]
]
},
"properties": {
"zone_id": "1042"
}
},
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
9.1928,
45.46
],
[
9.2056,
45.46
],
[
9.2056,
45.469
],
[
9.1928,
45.469
],
[
9.1928,
45.46
]
]
]
},
"properties": {
"zone_id": "1043"
}
}
]
}Authorizations
Query Parameters
Type of spatial grid, e.g. squares for a regular grid of square tiles. Only the grid types (and tile sizes) enabled for your company are accepted; a 400 response lists them.
squares, categorical, hdbscan, agent-3, agent-2, agent-1, agent-4, agent-5, agent-6, agent-7, agent-8, agent-9, custom-polygons Response
Grid GeoJSON file downloaded successfully. Returns a GeoJSON FeatureCollection containing polygon features with zone_id properties representing the company's grid configuration.
