curl --request POST \
--url https://stage-api.getswitch.io/operations/rebalance \
--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/rebalance"
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/rebalance', 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/rebalance"
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"
],
"suggestions": [
{
"additional_notes": "Battery level (12.0%) below threshold (20.0%)",
"generated_at": "2026-11-30T07:55:00Z",
"latitude": 45.4642,
"longitude": 9.1856,
"operation_type": "battery_swap",
"priority": "high",
"priority_value": 2.4,
"vehicle_id": "acme-sc-0193",
"vehicle_properties": {
"battery_level": 12,
"id": "acme-sc-0193",
"last_moved": "2026-11-30T06:41:03Z",
"last_seen": "2026-11-30T07:50:12Z",
"lat": 45.4642,
"licence_plate": "SC0193",
"lon": 9.1856,
"status": "available",
"vehicle_model": "S-200",
"vehicle_type": "scooter"
},
"zone_id": "1042"
},
{
"additional_notes": "Zone surplus 1.0 vehicles (threshold: 1.5)",
"generated_at": "2026-11-30T07:55:00Z",
"latitude": 45.4671,
"longitude": 9.1883,
"operation_type": "pickup",
"priority": "medium",
"priority_value": 2.1,
"valid_from": "2026-11-30T08:00:00Z",
"valid_until": "2026-11-30T09:00:00Z",
"vehicle_id": "acme-sc-0457",
"zone_id": "1042"
}
]
}Get Rebalancing Suggestions
Deprecated: use POST /operations/suggest, which supports configurable strategies.
Generate actionable rebalancing suggestions for zones based on imbalance data and vehicle status. This endpoint analyzes current vehicle distribution and battery levels to recommend operations such as pickups, dropoffs, and battery swaps to optimize service efficiency and meet demand.
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:
rebalance:read
curl --request POST \
--url https://stage-api.getswitch.io/operations/rebalance \
--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/rebalance"
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/rebalance', 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/rebalance"
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"
],
"suggestions": [
{
"additional_notes": "Battery level (12.0%) below threshold (20.0%)",
"generated_at": "2026-11-30T07:55:00Z",
"latitude": 45.4642,
"longitude": 9.1856,
"operation_type": "battery_swap",
"priority": "high",
"priority_value": 2.4,
"vehicle_id": "acme-sc-0193",
"vehicle_properties": {
"battery_level": 12,
"id": "acme-sc-0193",
"last_moved": "2026-11-30T06:41:03Z",
"last_seen": "2026-11-30T07:50:12Z",
"lat": 45.4642,
"licence_plate": "SC0193",
"lon": 9.1856,
"status": "available",
"vehicle_model": "S-200",
"vehicle_type": "scooter"
},
"zone_id": "1042"
},
{
"additional_notes": "Zone surplus 1.0 vehicles (threshold: 1.5)",
"generated_at": "2026-11-30T07:55:00Z",
"latitude": 45.4671,
"longitude": 9.1883,
"operation_type": "pickup",
"priority": "medium",
"priority_value": 2.1,
"valid_from": "2026-11-30T08:00:00Z",
"valid_until": "2026-11-30T09:00:00Z",
"vehicle_id": "acme-sc-0457",
"zone_id": "1042"
}
]
}Authorizations
Body
Defines the filters applicable to a rebalancing request.
.. deprecated::
Only used by the deprecated /rebalance endpoint.
Use OperationsGenerationConfiguration from the /suggest endpoint
instead.
This schema includes parameters to filter operation types and override default strategy configurations.
Response
Rebalancing suggestions retrieved successfully with recommended operations for optimization.
Represents the response structure for a rebalancing request.
.. deprecated::
Only used by the deprecated /rebalance endpoint.
Use the /suggest endpoint and OperationsGenerationResponse instead.
This schema includes a list of suggested operations for rebalancing vehicles across different zones and time periods. It also includes the time periods for which the suggestions are provided.
