Get Imbalance Snapshot
curl --request POST \
--url https://stage-api.getswitch.io/operations/imbalance \
--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/operations/imbalance"
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/operations/imbalance', 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/operations/imbalance"
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": [
2.5,
1,
-0.5
],
"1043": [
-1.8,
-3.2,
-2.1
]
}
}Operations
Get Imbalance Snapshot
Calculate and retrieve vehicle distribution imbalance for zones within a specified time range. Imbalance is defined as the difference between actual deployed vehicles and forecasted demand per zone, helping identify zones with high demand and low supply for resource allocation optimization.
Failure Modes:
- 400: Location, granularity or grid not enabled for your company
- 401: Invalid or missing authentication credentials
- 403: Insufficient permissions
- 404: Your company has no fleet or forecasts configured
- 422: Invalid request data that fails validation
- 500: Prediction data unavailable, configuration not loaded, or provider communication failure
- 501: Unsupported provider specified in configuration
Required Auth Scopes:
imbalance:read
POST
/
operations
/
imbalance
Get Imbalance Snapshot
curl --request POST \
--url https://stage-api.getswitch.io/operations/imbalance \
--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/operations/imbalance"
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/operations/imbalance', 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/operations/imbalance"
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": [
2.5,
1,
-0.5
],
"1043": [
-1.8,
-3.2,
-2.1
]
}
}Authorizations
HTTPBearerHTTPBearer
Body
application/json
Defines the filters applicable to an imbalance snapshot request.
This schema includes parameters such as location, time granularity, prediction horizon, and grid details.
Response
Imbalance snapshot retrieved successfully with periods and zone-wise imbalance data.
Represents the response structure for an imbalance snapshot.
This schema includes the time periods and imbalance values for different zones.
